-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathdotfiles.sh
114 lines (110 loc) · 5.4 KB
/
dotfiles.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
log() { echo -e $yellow$@$reset; }
which brew &>/dev/null || {
log "> Install Package Manager"
xcode-select --install
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
eval $(/opt/homebrew/bin/brew shellenv)
}
ls ~/.dotfiles &>/dev/null || {
log "> Install Dotfiles"
git clone https://github.com/vbrajon/dotfiles.git ~/.dotfiles
for f in $(ls -d ~/.dotfiles/.* | grep -v '\.$' | grep -v '\.git$');do ln -fs $f ~;done
}
[[ -f ~/.extra ]] || {
log "> Configure Dotfiles"
[[ $NAME ]] || NAME=$(whoami)
[[ $EMAIL ]] || EMAIL=$(git config user.email)
[[ $HOSTNAME ]] || HOSTNAME=$(hostname)
read -p "Name: ($NAME) " NAME
read -p "Email: ($EMAIL) " EMAIL
read -p "Hostname: ($HOSTNAME) " HOSTNAME
[[ $NAME ]] || NAME=$(whoami)
[[ $EMAIL ]] || EMAIL=$(git config user.email)
[[ $HOSTNAME ]] || HOSTNAME=$(hostname)
cat > ~/.extra <<EOL
NAME="$NAME"
EMAIL="$EMAIL"
HOSTNAME="$HOSTNAME"
EOL
cat > ~/.gitextra <<EOL
[user]
name = $NAME
email = $EMAIL
EOL
echo "# https://raw.githubusercontent.com/github/gitignore/master/Global/macOS.gitignore" >> ~/.gitexcludes
curl -s https://raw.githubusercontent.com/github/gitignore/master/Global/macOS.gitignore >> ~/.gitexcludes
echo "# https://raw.githubusercontent.com/github/gitignore/master/Node.gitignore" >> ~/.gitexcludes
curl -s https://raw.githubusercontent.com/github/gitignore/master/Node.gitignore >> ~/.gitexcludes
curl -s https://raw.githubusercontent.com/rupa/z/master/z.sh > ~/.z.sh
cat > ~/.extra-packages.sh <<EOL
brew install node brave-browser visual-studio-code microsoft-office
npm install -g http-server
brew install coreutils findutils gnu-tar gnu-sed gawk gnutls gnu-indent gnu-getopt grep
brew install bash bash-completion@2 git git-delta tmux
brew install bat btop duf dust eza fd fzf ripgrep
brew install httpie sampler
brew tap homebrew/cask-fonts
brew install font-monaspace-nerd-font
EOL
vim ~/.extra-packages.sh
bash ~/.extra-packages.sh
cat > ~/.extra-preferences.sh <<EOL
sudo sh -c "echo /opt/homebrew/bin/bash >> /etc/shells"
chsh -s /opt/homebrew/bin/bash
osascript -e 'tell application "System Preferences" to quit'
open ~/.dotfiles/Raw.terminal
defaults write com.apple.terminal "Default Window Settings" "Raw"
defaults write com.apple.terminal "Startup Window Settings" "Raw"
sudo scutil --set HostName "\$HOSTNAME"
sudo scutil --set LocalHostName "\$HOSTNAME"
sudo scutil --set ComputerName "\$HOSTNAME"
dscacheutil -flushcache
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
sudo chflags nohidden /Volumes
chflags nohidden ~/Library
hash tmutil &> /dev/null && sudo tmutil disable
touch ~/.bash_sessions_disable
sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName
defaults write com.apple.dashboard mcx-disabled -bool true
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
defaults write com.apple.dock autohide -bool true
defaults write com.apple.dock autohide-delay -float 0
defaults write com.apple.dock autohide-time-modifier -float 0
defaults write com.apple.dock expose-animation-duration -float 0.1
defaults write com.apple.dock expose-group-by-app -bool false
defaults write com.apple.dock launchanim -bool false
defaults write com.apple.dock mru-spaces -bool false
defaults write com.apple.dock showhidden -bool true
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
defaults write com.apple.finder _FXSortFoldersFirst -bool true
defaults write com.apple.finder DisableAllAnimations -bool true
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
defaults write com.apple.finder FXInfoPanesExpanded -dict General -bool true OpenWith -bool true Privileges -bool true
defaults write com.apple.finder QuitMenuItem -bool true
defaults write com.apple.finder ShowPathbar -bool true
defaults write com.apple.finder ShowStatusBar -bool true
defaults write com.apple.finder WarnOnEmptyTrash -bool false
defaults write com.apple.ImageCapture disableHotPlug -bool true
defaults write com.apple.LaunchServices LSQuarantine -bool false
defaults write com.apple.screencapture disable-shadow -bool true
defaults write com.apple.screencapture location -string "\$HOME/Desktop"
defaults write com.apple.screencapture type -string "png"
defaults write com.apple.terminal StringEncodings -array 4
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
defaults write NSGlobalDomain com.apple.springing.delay -float 0
defaults write NSGlobalDomain com.apple.springing.enabled -bool true
defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false
defaults write NSGlobalDomain InitialKeyRepeat -int 10
defaults write NSGlobalDomain KeyRepeat -int 2
defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
defaults write com.brave.Browser AppleEnableSwipeNavigateWithScrolls -bool FALSE
EOL
vim ~/.extra-preferences.sh
bash ~/.extra-preferences.sh
}