-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpostinstall
executable file
·342 lines (307 loc) · 15.1 KB
/
postinstall
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
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
#!/usr/bin/env bash
## By Davoud Arsalani
## https://github.com/davoudarsalani/scripts
## https://github.com/davoudarsalani/scripts/blob/master/postinstall
## https://raw.githubusercontent.com/davoudarsalani/scripts/master/postinstall
## https://davoudarsalani.ir
source "$HOME"/main/scripts/gb
source "$HOME"/main/scripts/gb-color
title="${0##*/}"
heading "$title"
clr='blue'
main_items=( 'apps' 'install sublime' 'add AUR repositories' 'install from AUR' 'fix "error while loading shared libraries: libalpm.so.10"' 'see graphics in arch' 'add host RSA key to your known hosts' 'turn screensaver off and disable DPMS' 'generate xorg.conf' 'git save credentials' 'disable grub countdown' 'firefox settings' 'prevent python from creating __pycache__' 'surfingkeys' 'disable goldendict "full text search"' 'install jcal' 'docker' 'other' )
main_item="$(pipe_to_fzf "${main_items[@]}")" && wrap_fzf_choice "$main_item" || exit 37
case "$main_item" in
apps ) ## {{{
apps=(
'audacious' 'vlc' 'gpicview' 'xreader' 'gparted' 'gnome-disk-utility' 'gnome-calculator' 'firefox' 'gedit' 'lsof' 'keepass'
'uget' 'gimp' 'ufw' 'acpi' 'rofi' 'dmenu' 'bluez' 'bluez-utils' 'blueman' 'bluez-tools' 'lxappearance' 'libreoffice-still' 'xclip'
'openssh' 'ffmpeg' 'xdotool' 'tmux' 'picom' 'fzf' 'networkmanager' 'network-manager-applet' 'feh'
'pulseaudio-alsa' 'jq' 'youtube-dl' 'curl' 'wget' 'aria2' 'tor' 'torsocks' 'git' 'vsftpd' 'txt2man'
'autoconf-archive' 'highlight' 'mediainfo' 'xf86-video-intel' 'intel-ucode[+ grub update]' 'ripgrep' 'pulseaudio' 'chromium'
'xfce4-terminal' 'imagemagick' 'libva-intel-driver' 'nvidia-lts' 'nvidia-utils' 'nvidia-settings' 'hddtemp' 'ntfs-3g'
'rsync' 'xprintidle [OR xssstate]' 'openssl' 'simplescreenrecorder' 'ctags'
'kvantumqt5 [not found]'
## install from source
'jcal (install from source)'
)
maybe_apps=(
'mpv' 'networkmanageropenvpn' 'openvpn' 'sqlitebrowser' 'w3m' 'docker' 'kdenlive' 'pulseaudio-bluetooth[for headset]' 'qutebrowser'
'unzip' 'zip' 'unrar' 'wmctrl' 'netstatnat' 'handbrake' 'handbrakecli' 'fribidi' 'ranger' 'bc' 'kdeconnect' 'kdeclitools' 'traceroute'
'bandwhich' 'pavucontrol' 'alsa-utils' 'dnsmasq' 'irssi' 'gnomescreenshot' 'axel[git version preferrable]' 'kid3'
)
aur_apps=(
'yay (git clone https://aur.archlinux.org/yay.git && cd yay && makepkg -sic)'
'rofi-greenclip' 'obfs4proxy' 'bluez-hcitool' 'qt5-styleplugins' 'lf' 'uget-integrator-firefox' 'goldendict-git'
'optimus-manager-git [+ enable optimus-manager.service]'
)
aur_maybe_apps=( ## not sure if necessary
'optimus-manager-qt' 'kpcli' 'cava' 'x2x'
)
mint_apps=(
'audacious' 'vlc' 'goldendict' 'uget' 'ffmpeg' 'tmux' 'fzf' 'jq' 'tor' 'torsocks' 'obfs4proxy' 'git' 'highlight' 'mediainfo' 'vim' 'x2x'
'ripgrep' 'xprintidle[OR' 'xssstate]' 'chromium' 'xfce4-terminal' 'youtube-dl' 'sqlitebrowser' 'remmina' 'remmina-plugin-rdp' 'sublime-text [+adding gpg key]'
## install from source (or use install-jdate script)
'jcal'
)
mint_binary_apps=(
'lf' ## copy binary file to /usr/bin/
)
mint_maybe_apps=( ## not sure if necessary
## bluetooth
'bluezutils' 'blueztools'
## intel driver
'xf86videointel' 'intel-ucode[+ grub update]'
## nvidia
'nvidialts' 'nvidiautils' 'nvidiasettings'
'ctags' 'libfribidi-bin' 'libfribidi0'
)
mint_specific_apps=(
'libtool' 'm4' 'automake' 'autoconf' 'openssh-server'
## for jcal
'automake' 'build-essential' 'libjalali-dev' 'libtool'
## for waveform (https://github.com/andrewrk/waveform)
'libgroove-dev' 'libpng-dev' 'zlib [!!]'
)
blue 'Apps'
printf '%s\n' "${apps[@]}" | sort | column
blue 'Apps (maybe)'
printf '%s\n' "${maybe_apps[@]}" | sort | column
blue 'AUR'
printf '%s\n' "${aur_apps[@]}" | sort | column
blue 'AUR (maybe)'
printf '%s\n' "${aur_maybe_apps[@]}" | sort | column
printf '\n'
blue 'Mint'
printf '%s\n' "${mint_apps[@]}" | sort | column
blue 'Mint (binary)'
printf '%s\n' "${mint_binary_apps[@]}" | sort | column
blue 'Mint (maybe)'
printf '%s\n' "${mint_maybe_apps[@]}" | sort | column
blue 'Mint (specific)'
printf '%s\n' "${mint_specific_apps[@]}" | sort | column
;;
## }}}
'install sublime' ) ## {{{
printf '%s\n' \
"$("$clr" 'add gpg key')
cd /tmp && curl -O https://download.sublimetext.com/sublimehq-pub.gpg && sudo pacman-key --add sublimehq-pub.gpg && sudo pacman-key --lsign-key 8A8F901A && rm sublimehq-pub.gpg
$("$clr" 'add these lines to /etc/pacman.conf')
[sublime-text]
Server = https://download.sublimetext.com/arch/stable/x86_64
$("$clr" 'then run (needs shecan)')
sudo pacman -Syy && sudo pacman -S sublime-text"
;;
## }}}
'add AUR repositories' ) ## {{{
printf '%s\n' \
"$("$clr" 'add these lines to /etc/pacman.conf')
[archlinuxfr]
SigLevel = Never
Server = http://repo.archlinux.fr/$arch
$("$clr" 'then run')
sudo pacman -Sy"
;;
## }}}
'install from AUR' ) ## {{{
printf '%s\n' \
"$(action_now 'method 1: snapshot')
$("$clr" 'download snapshot from AUR page (the dl link is sth like: https://aur.archlinux.org/cgit/aur.git/snapshot/APPNAME.tar.gz)')
$("$clr" 'extract the tar.gz file and navigate to the folder containing the PKGBUILD file')
$("$clr" 'then [the flags were -Acs earlier and I changed them to these (to be the same as Option 2) for an easier install]')
makepkg -sic
$("$clr" 'now the package is built')
$("$clr" 'then')'
sudo pacman -U FILE.xz
$("$clr" '-----------------------')
$(action_now 'method 2: clone (https://www.youtube.com/watch?v=lPTgCajmoLo)')
$("$clr" 'go to AUR page and clone the git address provided')
git clone https://aur.archlinux.org/APPNAME.git
$("$clr" 'cd to the downloaded directory')
$("$clr" 'run')
makepkg -sic
$("$clr" 'then')
sudo pacman -U FILE.xz"
;;
## }}}
'fix "error while loading shared libraries: libalpm.so.10"' ) ## {{{
printf '%s\n' \
"$("$clr" 'navigate to the folder and run')
sudo pacman -U package-query-1.9-3-x86_64.pkg.tar.xz"
;;
## }}}
'see graphics in arch' ) ## {{{
printf 'lspci -k | grep -A 2 -E "(VGA|3D)"\n' ;;
## }}}
'add host RSA key to your known hosts' ) ## {{{
printf '%s\n' \
"$("$clr" '(https://askubuntu.com/questions/108217/ssh-host-key-verification-failed)')
ssh-keyscan HOST_IP | tee -a ~/.ssh/known_hosts
$("$clr" 'ceate ssh key')
ssh-keygen"
;;
## }}}
'turn screensaver off and disable DPMS' ) ## {{{
printf '%s\n' \
"$("$clr" '(https://askubuntu.com/questions/216783/ubuntu-12-10-turn-screen-off-when-inactive-for-never-still-turns-off)')
xset s 0 0 $("$clr" '## OR xset s off')
$("$clr" 'disable DPMS')
xset -dpms
$("$clr" 'check the results: (the sections "Screen Saver:" and "DPMS (Energy Star)")')
xset -q"
;;
## }}}
'generate xorg.conf' ) ## {{{
printf '%s\n' \
"$("$clr" '(https://wiki.archlinux.org/index.php/Xorg#Configuration)')
sudo Xorg :0 -configure $("$clr" '## or use a different display, e.g. :2')
$("$clr" 'this should create a xorg.conf.new file in /root/. copy that to /etc/X11/ or /etc/')"
;;
## }}}
'git save credentials' ) ## {{{
printf '%s\n' \
"$("$clr" '(https://stackoverflow.com/questions/35942754/how-to-save-username-and-password-in-git/45327254)')
git config --global credential.helper store
$("$clr" 'the next time git asks for your credentials, it will store them forever')
git config --global user.name 'NAME LAST_NAME'
git config --global user.email 'EMAIL'"
;;
## }}}
'disable grub countdown' ) ## {{{
printf '%s\n' \
"$("$clr" 'in /etc/default/grub, set the GRUB_TIMEOUT to 0 and then run')
sudo update-grub
$("$clr" 'if you get the error "update-grub: command not found" (https://askubuntu.com/questions/418666/update-grub-command-not-found)')
$("$clr" 'paste these lines into /usr/sbin/update-grub')
#!/bin/sh
set -e
exec grub-mkconfig -o /boot/grub/grub.cfg \"\$@\"
$("$clr" 'then')
sudo chown root:root /usr/sbin/update-grub
sudo chmod 755 /usr/sbin/update-grub
$("$clr" 'now you can run')
sudo update-grub"
;;
## }}}
'firefox settings' ) ## {{{
printf '%s\n' \
"$("$clr" 'keep firefox open after closing the last tab')
about:config > browser.tabs.closeWindowWithLastTab
$("$clr" 'double click to change the value to False')
$("$clr" 'stop ALT key from showing menu')
about:config > ui.key.menuAccessKeyFocuses
$("$clr" 'double click to change the value to False. You can now use ALT+F instead')
$("$clr" 'prevent WebRTC leak')
about:config > media.peerconnection.enabled
$("$clr" 'double click to change the value to False. to verify, visit https://hide.me/en/webrtc-leak-test')
$("$clr" 'prevent websites from auto refreshing')
about:config > accessibility.blockautorefresh
$("$clr" 'double click to change the value to True.')
$("$clr" 'use customized css in ~/.mozilla/firefox/*.default-release/chrome directory')
about:config > toolkit.legacyUserProfileCustomizations.stylesheets ## previously: legacy
$("$clr" 'double click to change the value to True')"
;;
## }}}
'prevent python from creating __pycache__' ) ## {{{
printf '%s\n' \
"$("$clr" '(https://stackoverflow.com/questions/39149313/hiding-pycache-on-linux)')
$("$clr" 'add PYTHONDONTWRITEBYTECODE=1 to /etc/environment')"
;;
## }}}
'surfingkeys' ) ## {{{
printf "map('f', 'af');\n" ;;
## }}}
'disable goldendict "full text search"' ) ## {{{
printf "$("$clr" 'disable "full text search" to prevent cpu overuse')\n" ;;
## }}}
'install jcal' ) ## {{{
printf '%s\n' "$("$clr" 'Have a look at install-jcal script')"
;;
## }}}
docker ) ## {{{
printf '%s\n' \
"sudo systemctl enable docker $("$clr" 'enable service')
sudo gpasswd -a $USER docker $("$clr" "add $USER to docker group to run docker without sudo")
echo PASSWORD | docker login --username davoudarsalani --password-stdin
$("$clr" 'create a container')
docker run -t -d --name CNT IMG:TG
$("$clr" '-p 8080:80 (8080 for host, 80 for container)')
$("$clr" '-v ~/main/downloads/src:/tmp/src/ (add :ro after src to make it readonly)')
$("$clr" '-e MY_ENV_VAR=\"SOME_VALUE\"')
$("$clr" 'run image (automatically removes container when it exits) ## NOTE no -d. --name CNT not needed')
docker run --rm -t IMG:TG [COMMAND]
docker run --rm -it IMG:TG bash
docker ps -a $("$clr" 'list of containers')
docker image ls -a $("$clr" 'list of images')
docker exec -t CNT [COMMAND] $("$clr" 'run container')
docker exec -it CNT bash $("$clr" 'enter container')
docker start/stop CNT $("$clr" 'start/stop container')
docker rm CNT $("$clr" 'rm container')
docker rmi -f IMG $("$clr" '<--,-- rm image')
docker image rm -f IMG $("$clr" "<--'")
docker rm -f \$(docker ps -aq) $("$clr" 'rm all containers ## NOTE do NOT quote $()')
$("$clr" 'build')
docker build --tag IMG:TG .
$("$clr" '-f FILE')
$("$clr" '--no-cache=true')
$("$clr" '--build-arg VAR=VALUE')
docker system df --verbose
docker system prune -f
docker tag IMG:TG davoudarsalani/RPS:TG $("$clr" 'tag for push')"
;;
## }}}
other ) ## {{{
printf '%s\n' \
"$("$clr" '- when clock goes out of sync') sudo timedatectl set-ntp true
$("$clr" '- if no internet after rebooting at the end of a fresh install') systemctl start dhcpcd && dhcpcd
$("$clr" '- if kpcli stops working after an update, reinstall perl-crypt-rijndael')
$("$clr" '- check swapiness') cat /proc/sys/vm/swappiness
$("$clr" '- pulseaudio statrtup command') start-pulseaudio-x11
$("$clr" '- download everything') wget -prl0 WEBSITE $("$clr" '(p means download everything, r means recursive, l0 means infinite levels deep)')
$("$clr" '- create openvpn connection') connection import type openvpn file NAME.ovpn
$("$clr" '- tmux service problematic autorun file (https://bbs.archlinux.org/viewtopic.php?id=196024)') ~/.config/systemd/user/tmux.service
$("$clr" '- see if on AC or not (1 means on AC, and 0 means on battery)') cat /sys/class/power_supply/ACAD/online
$("$clr" '- add resolution to screen') xrandr --addmode SCREEN_NAME 1366x768 $("$clr" '(SCREEN_NAME e.g. DP1)')
$("$clr" '- set screen resolution') xrandr -s 1366x768
$("$clr" '- split file') split -d -b SIZE_IN_BYTES FILE [OUTPUT]
$("$clr" '- join parts') cat PART_1 PART_2 ... PART_N > OUTPUT $("$clr" 'OR') cat PART_* > OUTPUT
$("$clr" '- reboot modem') telnet MODEM_IP
$("$clr" ' enter username and password and then') reboot
$("$clr" '- hide txt file in jpg file')
$("$clr" ' embed') steghide embed -cf JPG_FILE -ef TXT_FILE
$("$clr" ' extract') steghide extract -sf JPG_FILE
$("$clr" ' get info on both files without extracting') teghide info JPG_FILE
$("$clr" '- launch Cisco Anyconnect after installation')
$("$clr" ' fedora (https://ask.fedoraproject.org/en/question/99266/vpn-cisco-anyconnect-fedora-25-fail/)') sudo dnf install pangox-compat
$("$clr" ' mint (https://askubuntu.com/questions/864695/cant-install-pangox-compat-with-apt-get)') sudo apt-get install libpangox-1.0-0
$("$clr" '- make immutable') sudo chattr +i ITEM $("$clr" '<--,-- add -RV if ITEM is s directory')
$("$clr" ' revert') sudo chattr -i ITEM $("$clr" "<--'")
$("$clr" ' see attribute') lsattr ITEM
$("$clr" '- switch to nvidia using optimus-manager if you do not use a display manager')
$("$clr" ' (https://github.com/Askannz/optimus-manager/wiki/FAQ,-common-issues,-troubleshooting)')
$("$clr" ' NOTE: optimus-manager.service should be running')
$("$clr" ' WARNING: Tried once and logged in to get a black screen')
$("$clr" ' after X server is started') prime-offload
$("$clr" ' then') optimus-manager --switch nvidia
$("$clr" ' after X server has stopped (i.e. machine logges out into tty)') sudo prime-switch
$("$clr" ' then') startx ~/.xinitrc
$("$clr" '- fix grub in windows (https://itsfoss.com/no-grub-windows-linux/)') bcdedit /set {bootmgr} path \EFI\ubuntu\grubx64.efi
$("$clr" ' then restart')
$("$clr" ' if the above entry didn’t change anything, you can reverse it') bcdedit /deletevalue {bootmgr} path \EFI\ubuntu\grubx64.efi
$("$clr" '- dd') sudo dd if=****.iso of=/dev/sd* status=progress bs=4M && sync
$("$clr" '- shred')
$("$clr" ' shred file') shred -vzu -n 5 FILE
$("$clr" ' -v') stands for verbose.
$("$clr" ' -z') replace the final pass with zeros to hide shredding.
$("$clr" ' -u') remove the file after shredding.
$("$clr" ' -n') number of passes (default is 3).
$("$clr" ' shred disk/partition') shred -vfz -n 5 PATH
$("$clr" ' -v') stands for verbose.
$("$clr" ' -f') force the write permissions if missing.
$("$clr" ' -z') write zeros in the final pass.
$("$clr" ' -n') number of passes (default is 3).
$("$clr" '- mint: in case of getting returned 126 error when sourcing conf file in tmux (https://github.com/tmux-plugins/tpm/issues/73)') chmod -R ug+x ~/.tmux-plugins/
" | less -R
;;
## }}}
esac