-
Notifications
You must be signed in to change notification settings - Fork 0
/
sudo-user-install.sh
228 lines (197 loc) · 9.35 KB
/
sudo-user-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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
#!/bin/sh
#### Check preconditions ####
if [ -z "$(ls -A $PWD/thirdparty)" ]; then
echo "First step, update git submodule"
exit -1
fi
# Make sure user has sudo privilages.
sudo echo
if [[ $? -ne 0 ]]; then
echo "This script needs sudo privilages to run" 1>&2
exit 1
fi
#Install systemd scripts for decrypt HDD.
sudo cp "$PWD/etc/systemd/system/sysinit.target.wants/decrypt-hdd-disk.service" /etc/systemd/system/sysinit.target.wants/
#Install udev rules for ssh scheduler
sudo cp "$PWD/etc/udev/rules.d/60-ssd-scheduler.rules" /etc/udev/rules.d/
#Install fstrim service for ssh disk.
sudo cp "$PWD/etc/systemd/system/fstrim.service" /etc/systemd/system/
#Install redirection of user .cache
sudo cp "$PWD/etc/systemd/user/xdg-cache-home.service" /etc/systemd/user/
#Copy tmpfs-ccache files.
# TODO User privilages of tmp directory and copy ccache.conf
sudo cp "$PWD/thirdparty/tmpfs-ccache/etc/tmpfs-ccache" /etc/
sudo cp "$PWD/thirdparty/tmpfs-ccache/etc/systemd/system/tmpfs-ccache.service" /etc/systemd/system/
sudo cp "$PWD/thirdparty/tmpfs-ccache/usr/local/bin/tmpfs-ccache-service.sh" /usr/local/bin/
sudo cp "$PWD/thirdparty/tmpfs-ccache/usr/local/bin/tmpfs-ccache-user.sh" /usr/local/bin/
#Copy squash portage script
sudo cp "$PWD/thirdparty/squash-portage/squash-portage.sh" /usr/local/bin/
#TODO Layman
#TODO My local portage
# Install git-foresta
#curl -L https://github.com/takaaki-kasai/git-foresta/raw/master/git-foresta -o ~/.local/bin/git-foresta && chmod +x ~/.local/bin/git-foresta
# Install jq. Used in zshenv.
# Insntall fonts dejavu y inconsolata
# emerge sphinxcontrib-spelling for check document spelling.
# gem install mdl # Installl mardownlinter
# emerge doc8 # RST checker
# Install neovim and application needed for its plugins.
applications_to_merge="$applications_to_merge neovim zathura texlive clang"
# Install vim files
ln -s "$PWD/thirdparty/vim-conf" ~/.vim
mkdir -p ~/.config/nvim && ln -s "$PWD/thirdparty/vim-conf/init.vim" ~/.config/nvim/init.vim
# Install vim plugin dependencies
## InstantRst -> install server
pip3 install --user https://github.com/Rykka/instant-rst.py/archive/master.zip
# TODO install my changes on markdown viewer plugin
# Install ranger file system manager.
applications_to_merge="$applications_to_merge ranger"
ln -s "$PWD/ranger" ~/.config/ranger
# Install cron daemon to interrupt gpe12 for ssd disk in my toshiba.
applications_to_merge="$applications_to_merge vixie-cron"
# Install oh-my-zsh and zsh-notify plugin
# TODO Install oh-my-zsh
applications_to_merge="$applications_to_merge xdotool"
ln -s "$PWD/thirdparty/zsh-notify" ~/.oh-my-zsh/custom/plugins/notify
ln -s "$PWD/thirdparty/zsh-mkc" ~/.oh-my-zsh/custom/plugins/mkc
# Install my theme
ln -s "$PWD/zsh/richiware.zsh-theme" ~/.oh-my-zsh/custom/themes
# Install email, contacts
sudo mkdir /var/spool/richi_mail
sudo chown ricardo:ricardo /var/spool/richi_mail
ln -s /var/spool/richi_mail ~/.mail
## Install vdirsyncer
applications_to_merge="$applications_to_merge requests-oauthlib vdirsyncer"
mkdir "~/.vdirsyncer"
ln -s "$PWD/thirdparty/email-conf/vdirsyncer/config" ~/.vdirsyncer/config
sudo cp "$PWD/thirdparty/email-conf/vdirsyncer/vdirsyncer.service" /etc/systemd/user
sudo cp "$PWD/thirdparty/email-conf/vdirsyncer/vdirsyncer.timer" /etc/systemd/user
systemctl --user enable vdirsyncer.timer
## Install khard
applications_to_merge="$applications_to_merge khard"
mkdir ~/.config/khard/
ln -s "$PWD/thirdparty/email-conf/khal/config" ~/.config/khal/config
## Install khal
mkdir ~/.config/khal/
ln -s "$PWD/thirdparty/email-conf/khard/khard.conf" ~/.config/khard/khard.conf
## Install offlineimap
applications_to_merge="$applications_to_merge offlineimap keyring"
ln -s "$PWD/thirdparty/email-conf/offlineimap/offlineimaprc" ~/.offlineimaprc
mkdir ~/.mail/offlineimap
mkdir ~/.offlineimap
ln -s "$PWD/thirdparty/email-conf/offlineimap/hooks" ~/.offlineimap/hooks
sudo cp "$PWD/thirdparty/email-conf/offlineimap/offlineimap-oneshot.*" /etc/systemd/user
systemctl --user enable offlineimap-oneshot.timer
## Install notmuch
applications_to_merge="$applications_to_merge notmuch"
ln -s "$PWD/thirdparty/email-conf/notmuch/notmuch-config" ~/.notmuch-config
## Install notifymuch
pip3 install --user thirdparty/email-conf/thirdparty/notifymuch/
mkdir ~/.mail/mail/.notmuch
ln -s "$PWD/thirdparty/email-conf/notmuch/hooks" ~/.mail/mail/.notmuch/hooks
## Install msmtp
applications_to_merge="$applications_to_merge msmtp"
ln -s "$PWD/thirdparty/email-conf/msmtp/msmtprc" ~/.msmtprc
## Install mutt
applications_to_merge="$applications_to_merge mutt muttprint dialog t-prot w3m extract_url"
mkdir ~/.mail/cache/headers
mkdir ~/.mail/cache/bodies
ln -s "$PWD/thirdparty/email-conf/mutt/muttrc" ~/.muttrc
ln -s "$PWD/thirdparty/email-conf/mutt/mailboxes" ~/.mailboxes
ln -s "$PWD/thirdparty/email-conf/mutt/config" ~/.mutt
ln -s "$PWD/thirdparty/email-conf/mutt/extract_urlview" ~/.extract_urlview
ln -s "$PWD/thirdparty/email-conf/mutt/mutt-html-attach" ~/.local/bin/mutt-html-attach
ln -s "$PWD/thirdparty/email-conf/mutt/mutt-save-attach" ~/.local/bin/mutt-save-attach
ln -s "$PWD/thirdparty/email-conf/mutt/mutt-ranger-attach" ~/.local/bin/mutt-ranger-attach
ln -s "$PWD/thirdparty/email-conf/mutt/mutt-view-mail" ~/.local/bin/mutt-view-mail
#Show message about gnome-terminal-colors-solarized
echo "Executing thirdparty/gnome-terminal-colors-solarized/install.sh ..."
echo " Note: remember this package can install also .dircolors"
read -t 10
sh -c "$PWD/thirdparty/gnome-terminal-colors-solarized/install.sh"
# Install powerline
echo 'Installing powerline...'
read -t 10
pip3 install --user powerline-status
# Install draobpilc
echo 'Installing draobpilc...'
read -t 10
pip3 install --user git+https://github.com/awamper/draobpilc
# Install tmux configuration
ln -s "$PWD/tmux/tmux.desktop" ~/.local/share/applications/tmux.desktop
mkdir -p ~/.config/powerline/themes/tmux
ln -s "$PWD/tmux/default.json" ~/.config/powerline/themes/tmux/
# Install zsh configuration
ln -s "$PWD/zsh/zshenv" ~/.zshenv
ln -s "$PWD/zsh/zshrc" ~/.zshrc
#TODO Emerge syslog-ng logrotate task, thefuck
# TODO Install gitignore https://www.gitignore.io/
sudo emerge -va $applications_to_merge
# Execute taskwarrior to create config file
echo "Creating configuration for taskwarrior..."
cp "$PWD/taskwarrior/taskrc" ~/.taskrc
read -t 10
task list
# Install bugwarrior
cp "$PWD/bugwarrior/bugwarriorrc" ~/.bugwarriorrc
echo "Include redmine key in ~/.bugwarriorrc ..."
read -t 10
vim ~/.bugwarriorrc
echo "Include bugwarrior as cron job: add '0 8 * * * /usr/bin/bugwarrior-pull' ..."
read -t 10
sudo crontab -u $USER -e
#TODO Use systemd timer instead of cron
# Install taskwarrior hook
# TODO Remove?
# Until hamster wokrs again. cp "$PWD/thirdparty/taskwarrior-hamster-hook/on-modify.hamster" ~/.task/hooks/
# Install redminetimesync
cp "$PWD/thirdparty/redminetimesync/activities.config.tpl" "$PWD/thirdparty/redminetimesync/activities.config"
cp "$PWD/thirdparty/redminetimesync/redminetimesync.config.tpl" "$PWD/thirdparty/redminetimesync/redminetimesync.config"
echo "Include redmine key in redminetimesync.config ..."
read -t 10
nvim "$PWD/thirdparty/redminetimesync/redminetimesync.config"
# Install IM
applications_to_merge="$applications_to_merge purple-hangouts bitlbee weechat"
# Execute weechat
# Connect to the server: /server add bitlbee localhost/6667 -autoconnect
# Connect: /connect bitlbee
# In bitlbe channel register password: register <password>
# In weechat channel: /set irc.server.bitlbee.command "/msg &bitlbee identify <password>"
# Hangout
## > account add hangouts <email>
## > /OPER hangouts <gmail password>
## > account <email> on
## Follow https://github.com/tdryer/hangups/issues/260#issuecomment-246578670
#Show message about crontab and interrupt gpe12
echo 'Execute "crontab -e" and add next line:'
echo ' @reboot echo "disable" > /sys/firmware/acpi/interrupts/gpe12'
#Show message for vdirsyncer
echo 'vdirsyncer: store credentials in Gnome Keyring using python:'
echo ' python'
echo ' >>> import keyring'
echo ' >>> keyring.set_password("vdirsyncer", "personal_client_id" ,"[client_id]")'
echo ' >>> keyring.set_password("vdirsyncer", "personal_client_secret", "[client_secret]")'
echo ' >>> quit()'
echo 'vdirsyncer: create google credentials and execute:'
echo ' vdirsyncer discover'
echo ' vdirsyncer metasync'
#show message for offlineimap
echo 'offlineimap: create google app password for offlineimap and msmtp.'
echo 'offlineimap: store credentials in Gnome Keyring using python:'
echo ' python'
echo ' >>> import keyring'
echo ' >>> keyring.set_password("personal_gmail", "password" ,"[password]")'
echo ' >>> quit()'
#echo 'offlineimap: create google credentials following instructions on:'
#echo ' https://hobo.house/2017/07/17/using-offlineimap-with-the-gmail-imap-api/'
#echo 'offlineimap: store credentials in Gnome Keyring using python:'
#echo ' python'
#echo ' >>> import keyring'
#echo ' >>> keyring.set_password("offlineimap", "personal_client_id" ,"[client_id]")'
#echo ' >>> keyring.set_password("offlineimap", "personal_client_secret", "[client_secret]")'
#echo ' >>> keyring.set_password("offlineimap", "personal_refresh_token", "[refresh_token]")'
#echo ' >>> quit()'
echo 'offlineimap: first execution of offlineimap:'
echo ' offlineimap -o'
echo 'msmtp: store credentials in Gnome Keyring using python:'
echo ' secret-tool store --label=msmtp host smtp.gmail.com service smtp user [email protected]'