-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfreyr
More file actions
executable file
·321 lines (278 loc) · 9.43 KB
/
freyr
File metadata and controls
executable file
·321 lines (278 loc) · 9.43 KB
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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
#! /bin/bash
# The setup, install, retrieving and applying config script. Called Freyr after the Norse god, who
# 'is a widely attested god associated with sacral kingship, virility and prosperity, with sunshine
# and fair weather, and pictured as a phallic fertility god in Norse mythology. Freyr is said to
# "bestow peace and pleasure on mortals"' (From wikipedia)
# And this script brings me peace, maybe not pleasure. A bit prosperity.
set -a
FREYR_DIR=`dirname "$0"`
set +a
bash $FREYR_DIR/_freyr/migrations.sh
bash $FREYR_DIR/_freyr/utils.sh
help_message () {
echo "Usage: freyr [COMMAND]"
echo "bash script to set up the system by installing programs, "
echo "setting up services, fixing issues, applying configurations..."
echo ""
echo " --help Display this message"
echo " -u, --update Update system (using package manager)"
echo " --hostname <new hostname> Only real option, if present, it will be the new hostname"
echo " -m, --migrate Execute migrations"
echo " -s, --setup Setup system (links dotfiles, install packages, ...)"
}
setup_ssh () {
bash ./_ssh/_setup.sh
}
setup_tir () {
echo "Setting up tir ..."
bash ./_hosts/tir/_setup.sh
echo "Setting up tir ... done!"
}
setup_abulafia () {
echo "Setting up abulafia ..."
bash ./_hosts/abulafia/_setup.sh
echo "Setting up abulafia ... done!"
}
update_system () {
echo "Updating system ..."
sudo dnf -y update
sudo flatpak update -y
echo "Updating system ... done!"
}
setup_android_dev () {
sudo dnf install -y android-tools
}
install_ruby () {
echo "Installing rvm & ruby ..."
gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
curl -sSL https://get.rvm.io -o /tmp/rvm-install.sh
bash /tmp/rvm-install.sh -ignore-dotfiles
rm /tmp/rvm-install.sh
rvm install 2.6
rvm use 2.6
gem install tmuxinator
echo "Installing rvm & ruby ... done"
}
install_node () {
echo "Installing node"
echo "Installing node: installing nvm (maybe check version, last update 2019-08-02)"
NVM_DIR="$HOME/.local/nvm"
curl -o /tmp/nvm-install.sh https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh
NVM_DIR=$NVM_DIR bash /tmp/nvm-install.sh && \
rm /tmp/nvm-install.sh && \
echo "Installing node: installing node" && \
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \
nvm install node
echo "Installing node: installing yarn"
curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo -o /tmp/yarn.repo
sudo cp /tmp/yarn.repo /etc/yum.repos.d/yarn.repo
rm /tmp/yarn.repo
sudo dnf install yarn
echo "Installing node: done"
}
install_games () {
echo "installing games"
#flatpak install flathub com.play0ad.zeroad
echo "installing steam ..."
if [ `hostname -s` = "abulafia" ]; then
sudo dnf -y install xorg-x11-drv-intel mesa-libGL.i686 mesa-dri-drivers.i686
else
sudo dnf -y install xorg-x11-drv-nouveau mesa-libGL.i686 mesa-dri-drivers.i686
fi
sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
sudo dnf -y install steam
echo "installing steam ... done"
echo "installing games: done"
}
install_packages () {
echo "Installing packages ..."
# wmctrl for launching and switching to applications, used by user defined (you, the reader) gnome-shortcuts
sudo dnf copr enable -y daniruiz/flat-remix
sudo dnf copr enable -y user501254/Arc
sudo dnf install -y dnf-plugins-core \
llvm lldb clang \
vim gvim the_silver_searcher git zsh powerline \
tmux tmux-powerline \
keepassxc xclip \
curl wget \
calibre \
wmctrl \
gstreamer-plugins-base gstreamer1-plugins-base gstreamer-plugins-bad gstreamer-plugins-ugly \
gstreamer1-plugins-ugly gstreamer-plugins-good-extras gstreamer1-plugins-good-extras \
gstreamer1-plugins-bad-freeworld ffmpeg gstreamer-ffmpeg \
nodejs npm \
vlc \
thunderbird \
stow \
docker \
mozilla-fira-mono-fonts flat-remix arc-theme levien-inconsolata-fonts \
git-lfs gh
echo "Installing gnome specific stuff ..."
sudo dnf install -y gnome-shell-extension-apps-menu \
gnome-shell-extension-background-logo \
gnome-shell-extension-common \
gnome-shell-extension-do-not-disturb-button \
gnome-shell-extension-freon \
gnome-shell-extension-horizontal-workspaces \
gnome-shell-extension-launch-new-instance \
gnome-shell-extension-media-player-indicator \
gnome-shell-extension-places-menu \
gnome-shell-extension-pomodoro \
gnome-shell-extension-topicons-plus \
gnome-shell-extension-user-theme \
gnome-shell-extension-window-list
gnome-shell-extension-installer 277 # impatience
echo "Installing gnome specific stuff ... done"
sudo dnf -y groupinstall "C Development Tools and Libraries"
sudo dnf -y groupinstall "Development Tools"
install_node
install_ruby
bash _protonmail/_setup.sh
echo "Installing packages ... done!"
}
link_dotfiles () {
echo "Linking dotfiles ..."
stow -v git ideavim js jupyter python stow tmux vim zsh bin claude karabiner
echo "Linking dotfiles ... done"
}
setup_vim () {
echo "Setting up vim ..."
mkdir -p ~/.cache/dein
curl https://raw.githubusercontent.com/Shougo/dein.vim/master/bin/installer.sh > /tmp/dein_installer.sh
sh /tmp/dein_installer.sh ~/.cache/dein
rm /tmp/dein_installer.sh
gvim -v +"call dein#install()" +qall
echo "Setting up vim ... done"
}
install_conda () {
echo "installing conda ..."
# conda installation
check_and_remove_file "/tmp/miniconda.sh"
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh
bash /tmp/miniconda.sh -b -p $HOME/.local/opt/miniconda3
rm /tmp/miniconda.sh
echo "installing conda ... done"
}
apply_system_settings () {
echo "applying system settings ..."
bash _system-settings/_setup.sh
echo "applying system settings ... done"
}
name_system () {
# Naming the system
echo "I hearby declare this computer working! Awake ..."
sudo hostnamectl set-hostname --static $1
}
prepare_thunderbird_settings () {
echo "Preparing thunderbird settings. This will copy the settings from ~/.thunderbird"
cp ~/.thunderbird/profiles.ini ./_thunderbird/profiles.ini
egrep 'user_pref\("mail\.(account(manager)?|identity|(smtp)?servers?)[."]' \
< ~/.thunderbird/au07n7ne.default/prefs.js >> ./_thunderbird/prefs.js \
&& vim ./_thunderbird/prefs.js
}
copy_thunderbird_settings () {
echo "Trying to create the correct thunderbird settings ..."
[[ -f ~/.thunderbird/profiles.ini ]] && cp ~/.thunderbird/profiles.ini ~/.thunderbird/profiles_bak.ini
mkdir -p ~/.thunderbird/au07n7ne.default/
cp ./_thunderbird/profiles.ini ~/.thunderbird/
if [ -f ~/.thunderbird/au07n7ne.default/prefs.js ]; then
cp ~/.thunderbird/au07n7ne.default/prefs.js ~/.thunderbird/au07n7ne.default/prefs_bak.js
egrep -v 'user_pref\("mail\.(account(manager)?|identity|(smtp)?servers?)[."]' \
< ~/.thunderbird/au07n7ne.default/prefs.js >> ~/.thunderbird/au07n7ne.default/prefs_new.js \
&& cat ./_thunderbird/prefs.js >> ~/.thunderbird/au07n7ne.default/prefs_new.js \
&& mv ~/.thunderbird/au07n7ne.default/prefs_new.js ~/.thunderbird/au07n7ne.default/prefs.js
else
echo "No prefs found, no clue how that's going to turn out..."
cp ./_thunderbird/prefs.js ~/.thunderbird/au07n7ne.default/prefs.js
fi
echo "Trying to create the correct thunderbird settings ... done"
}
apply_firefox_user_chrome () {
echo "appyling firefox settings ..."
config_dir=$(ls $HOME/.mozilla/firefox | grep 'default')
config_dir="~/.mozilla/firefox/$config_dir/chrome"
mkdir -p $config_dir
cp ./_setup/userChrome.css $config_dir
echo "appyling firefox settings ... done"
}
prepare () {
echo "Preparing..."
prepare_thunderbird_settings
echo "Preparing... done"
}
_setup () {
echo "Starting setup ..."
update_system
install_packages
link_dotfiles
setup_vim
add_autostart_applications
install_conda
apply_system_settings
copy_thunderbird_settings
apply_firefox_user_chrome
setup_ssh
# disable_gnome_software
echo "Starting setup ... done"
}
# got this setup from:
# - https://gist.github.com/magnetikonline/22c1eb412daa350eeceee76c97519da8
# - https://gist.github.com/cosimo/3760587
opts=$(getopt \
-o hums \
--long help,update,setup,hostname:,migrate,dev \
--name "${0##*/}" \
-- "$@"
)
eval set -- "$opts"
setup_system=false
new_host_name=""
while [[ $# -gt 0 ]]; do
case "$1" in
-h | --help )
help_message
shift
exit 0
;;
-u | --update )
update_system
shift
;;
-m | --migrate )
migrate
shift
;;
--hostname )
new_host_name=$2
shift 2
;;
-s | --setup )
setup_system=true
shift
;;
--dev )
add_autostart_applications
shift
;;
-- )
shift
break
;;
* )
echo "huh? no clue what to do with that: $1"
help_message
shift
exit 0
esac
done
if [[ $# -eq 0 ]]; then
help_message
exit 0
fi
if [ "$setup_system" = true ]; then
_setup
if [ ! "x$new_host_name" = "x" ]; then
name_system $new_host_name
fi
fi
exit 1