-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
executable file
·211 lines (186 loc) · 5.16 KB
/
install.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
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
#!/bin/sh
#
# install.sh: Quickly setup a new workstation
# shellcheck disable=SC2317
#
cd ~ || exit
# Assume that systems without doas(1) have sudo(1) installed by default
command -v doas >/dev/null 2>&1 || doas()(sudo "$@")
# Silence is golden
[ -e .hushlogin ] || touch .hushlogin
# Create symlinks in $HOME
dotfiles='
.alacritty.yml
.bash_logout
.bash_profile
.curlrc
.exrc
.gitconfig
.inputrc
.irbrc
.manpath
.npmrc
.profile
.vimrc
.wgetrc
.zshenv
.zshrc
'
# Link `$HOME/$file` to `$HOME/.files/$file` unless it's already symlinked
# shellcheck disable=SC2086
for file in $dotfiles; do [ -h $file ] || {
ln -sf .files/$file
printf 'Symlinked: %s -> %s\n' $file .files/$file;
}
done; unset file
# Link SSH config
[ ! -s .ssh/config ] && {
ln -f .files/etc/ssh-config .ssh/config
printf 'Linked: %s -> %s\n' .files/etc/ssh-config .ssh/config
}
# Tighten permissions on `~/.ssh' directory
chmod go-rwx .ssh/*
# Link Konsole profile
command -v konsole >/dev/null 2>&1 && [ ! -h .local/share/konsole ] && {
[ -d .local/share ] || mkdir -p .local/share
rm -rf .local/share/konsole
ln -sf ~/.files/etc/konsole .local/share/konsole
}
# Install editor font
if [ "`uname -s`" = Darwin ]; then
mkdir -p ~/Library/Fonts
ln -f .files/share/desktop/Menlig.otf ~/Library/Fonts
else
fonts=/usr/local/share/fonts
[ -d "$fonts" ] && [ ! -e "$fonts/Menlig.otf" ] &&
doas cp .files/share/desktop/Menlig.otf "$fonts/Menlig.otf"
unset fonts
fi
# Link Inkscape preferences
[ -d .config/inkscape ] && {
ln -sf ~/.files/etc/inkscape/preferences.xml .config/inkscape/
}
# Link youtube-dl(1) configuration
command -v youtube-dl >/dev/null 2>&1 && {
[ -d .config/youtube-dl ] || mkdir -p .config/youtube-dl
ln -sf ~/.files/etc/youtube-dl.conf .config/youtube-dl/config
}
# Link Troff macros
# shellcheck disable=SC2167,SC2165
for tmac in /usr/local /usr; do
cd >/dev/null 2>&1 "$tmac/share/groff/site-tmac" || \
cd >/dev/null 2>&1 "$tmac/etc/groff/site-tmac" || \
continue
for tmac in ~/.files/share/tmac/*; do
[ ! -h "./${tmac##*/}" ] || continue
[ -w "$PWD" ] && unset doas || doas='doas'
printf 'Linked: %s -> %s\n' "$tmac" "$PWD"
$doas ln -sf "$tmac" .
done
cd - >/dev/null 2>&1 && break
done; unset tmac
# Link Contour configuration
command -v contour >/dev/null 2>&1 && {
[ -d .config/contour ] || mkdir -p .config/contour
ln -sf ~/.files/etc/contour.yml .config/contour/
}
# Disable blinking cursor in Gnome Terminal
command -v gsettings >/dev/null 2>&1 && [ "$DISPLAY" ] && {
gsettings set org.gnome.desktop.interface cursor-blink false
}
# Configure GNU Nano
command -v nano >/dev/null 2>&1 && make -C ~/.files/share/nano
# Configure Xfce4
command -v startxfce4 >/dev/null 2>&1 && [ "$DISPLAY" ] && {
xfconf-query -nt int -c keyboards -p /Default/KeyRepeat/Delay -s 200
xfconf-query -nt int -c keyboards -p /Default/KeyRepeat/Rate -s 60
xfconf-query -nt int -c xfwm4 -p /general/workspace_count -s 1
xfconf-query -nt string -c xfce4-desktop \
-p /backdrop/screen0/monitorLVDS-1/workspace0/last-image \
-s ~/.files/share/desktop/wallpaper.jpg
xfconf-query -nt int -c xfce4-screensaver -p /lock/saver-activation/delay -s 5
xfconf-query -nt int -c xfce4-screensaver -p /saver/idle-activation/delay -s 10
xfconf-query -nt bool -c xfce4-screensaver -p /saver/fullscreen-inhibit -s true
xfconf-query -nt string -c xfce4-keyboard-shortcuts \
-p /commands/custom/Super_L \
-s xfce4-popup-applicationsmenu
# Symlink xfce4-terminal(1) configuration
[ -h .config/xfce4/terminal ] || {
rm -rf .config/xfce4/terminal
ln -sf ~/.files/etc/xfce4/terminal .config/xfce4/terminal
chmod -w .config/xfce4/terminal/accels.scm
}
}
# Link Audacity preferences
# shellcheck disable=SC2165,SC2167,SC3009
for dir in ~/Library/Application\ Support/audacity ~/.audacity-data; do
[ -d "$dir" ] || continue
link=~/.files/etc/audacity/config
[ -h "$link" ] || ln -sf "$dir" "$link"
for dir in "${link%/*}"/{Macros,Plug-Ins}; do
set -- "${link%/*}/${dir##*/}" "$link/${dir##*/}"
[ -h "$2" ] || rm -rf "$2" && ln -sf "$@"
done
break
done
# Perform platform-specific install stuff
case `uname -s` in
OpenBSD)
doas ln -sf ~/.files/etc/hosts /etc
doas ln -sf ~/.files/etc/sysctl.conf /etc
doas ln -sf ~/.files/etc/wsconsctl.conf /etc
;;
[Dd]arwin)
cd ~/.files/etc/darwin && make
;;
esac
exit
# XXX: Leave NPM package installation alone for now, it slows everything else
# down (such as when running `install.sh` to repair missing/deleted symlinks).
# Install Node programs
command -v npm >/dev/null 2>&1 && {
npm=`npm --global root`
install=
modules='
acorn
babel-eslint
c8
chai
clean-css-cli
coffeelint
cson
electron
eslint
guess-sig
hint
jsdoc
json
karma
karma-coverage
karma-chrome-launcher
karma-firefox-launcher
karma-mocha-reporter
karma-mocha
mocha
mocha-when
nyc
ppjson
prettier
rollup
semver
terser
tslint
ts-node
typedoc
typescript
'
case `uname -s` in *BSD)
modules=`printf %s "$modules" | grep -v electron` ;;
esac
for module in $modules; do
[ -d "$npm/$module" ] || install="$install $module";
done
# shellcheck disable=SC2086
[ "$install" ] && npm --global install $install
unset install module
}