-
Notifications
You must be signed in to change notification settings - Fork 0
/
rae-setup
executable file
·227 lines (206 loc) · 4.07 KB
/
rae-setup
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
#!/bin/bash
# Download this script and run to install everything on a new macOS
# including $HOME files
# debugging
# set -x
width=$(tput cols)
p() {
echo "$(date) -- $*"
}
containsElement() {
local e match="$1"
shift
for e; do
[ "$e" = "$match" ] && return 0
done
return 1;
}
parr() {
for i; do
echo "$i"
done \
| git column --mode=column --width $((width-2)) \
| sed 's/^/ /'
}
install() {
local app="$1"
if containsElement "${app}" "${brews[@]}"; then
p "Already installed: ${app}" > /dev/null
else
p "Installing: ${app}"
brew install "${app}" 2>&1 | sed -e 's/^/ /'
# The first time brew runs, it updates itself. Do not update Homebrew again
export HOMEBREW_NO_AUTO_UPDATE=1
fi
}
# Where Homebrew lives on the net
BREW_URL="https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh"
# disable per-install cleanup
export HOMEBREW_NO_INSTALL_CLEANUP=1
# tell Homebrew to keep quiet
export HOMEBREW_NO_ENV_HINTS=1
# cd to $HOME
cd
if [ ! -r /usr/bin/git ]; then
p installing Xcode command line tools - may involve clicking "OK" ion a dialog..
xcode-select --install || exit 1
fi
if [ ! -r /usr/local/bin/brew -a ! -r /opt/homebrew/bin/brew ]; then
p Setting up homebrew
/bin/bash -c "$(curl -fsSL ${BREW_URL})" || exit 1
# update hash
hash -r
fi
# get list of installed brews
p List of installed brews:
brews=($(brew list -1))
parr "${brews[@]}" | sed 's/^/ /'
# set up home directory based on a remote git repo
if [ ! -r bin/noarch ]; then
p Trying to use git to clone "'home'"
git clone --recursive [email protected]:git/home
mv -f .ssh .ssh-orig 2>/dev/null
cd home
mv -i * .[a-zA-Z0-9]* ~
cd
rmdir home
fi
# "coretools" include GNU ls et al.
installs=( \
chocolate-doom \
cmake \
cmake-docs \
coreutils \
cvs \
docker \
ffmpeg \
github \
gnumeric \
gnu-getopt \
gping \
internetarchive \
jove \
jq \
libdvdcss \
media-info \
mkvtoolnix \
ncftp \
node \
p7zip \
qprint \
rar \
speedtest-cli \
telnet \
wget \
youtube-dl \
\
publish \
)
p installing:
parr "${installs[@]}"
for i in "${installs[@]}"; do
install "$i"
done
# macOS apps in /Applications. These are grouped roughtly by smiilarity,
# and then alphabetical
# - not firefox
# - not google-chrome
casks=(\
calibre \
qlmarkdown \
webpquicklook \
textmate \
\
authy \
byobu \
betterzip \
betterdisplay \
discord \
firefox \
fork \
go2shell \
google-chrome \
google-chat \
ipfs \
iterm2 \
qview \
signal \
sketch \
slack \
steam \
telegram \
tor-browser \
transmission \
whatsapp \
wireshark \
\
dropbox \
\
4k-video-downloader \
audio-hijack \
blender \
freac \
handbrake \
krita \
makemkv \
openshot-video-editor \
vuescan \
vlc \
\
devdocs \
kitematic \
qlswift \
sourcetree \
\
aerial \
clipy \
fission \
gnucash \
megasync \
simple-comic \
\
angband \
bzflag \
gog-galaxy \
ioquake3 \
open-adventure \
\
postman \
\
dbeaver-community \
mesasqlite \
provisionql \
qlmobi \
)
p installing to /Applications:
parr "${casks[@]}"
for cask in "${casks[@]}"; do
install "$cask"
done
p Setting up macOS
# defaults write com.apple.menuextra.battery ShowPercent YES
defaults write com.apple.menuextra.clock DateFormat "EEE MMM d HH:mm"
# all of this is to simply set the default name of screenshots to yyyy-mm-dd.hhmm.ss.jpg
#
shotPList="~/Library/LaunchAgents/local.job.plist"
if [ ! -r "$shotPList" ]; then
p "Setting up screenshots launchd job (will need to logout and log back in)"
[ -d ~/Library/LaunchAgents ] || mkdir -p ~/Library/LaunchAgents
cat > ~/Library/LaunchAgents/local.job.plist <<"EOF"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled</key><false/>
<key>Label</key><string>local.job</string>
<key>Program</key><string>$HOME/bin/noarch-public/ss-rename</string>
<key>RunAtLoad</key><true/>
<key>WatchPaths</key><array><string>$HOME/Desktop</string></array>
</dict>
</plist>
EOF
fi
# final Homebrew cleanup
p "Cleaning up homebrew"
brew cleanup 2>&1 | sed 's/^/ /'
p All done.