-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharchRiceSystem.fish
executable file
·572 lines (512 loc) · 19.4 KB
/
archRiceSystem.fish
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
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
#! /bin/env fish
mkdir ~/Downloads
mkdir ~/.config ~/.local/sources
touch ~/.vimrc.local
touch ~/.bashrc.local
touch ~/.config/Xresources.local
# IS STEAMDECK (includes running in distrobox)
set HOSTNAME (uname --nodename)
if string match 'steamdeck*' $HOSTNAME
set is_steam true
else
set is_steam false
end
# IS STEAMDECK METAL
if test (uname --nodename) = steamdeck
set is_steam_host true
else
set is_steam_host false
end
if $is_steam
printf "Host is steamdeck\n"
else
printf "Host is not steamdeck\n"
end
# on steamdeck: first make writeable
if $is_steam_host
if test (read -P "Did you manually set 'passwd'?" -n 1) = y
# make writeable
sudo steamos-readonly disable
# enable ssh access
sudo systemctl enable --now sshd
# disable wifi powersave for lagfree ssh
sudo iw dev wlan0 set power_save off
# fix permission problems for X11 sockets for distrobox
sudo cp ~/scripts/fix_tmp_x11.sh /etc/profile.d/
else
exit
end
end #/steamdeck
if test (read -P "Init keys ( and full upgrade on NON steamdeck)?" -n 1) = y
# init & refresh keys
if not $is_steam_host
sudo env bash ~/archlinux/init-pacman-keys.sh # also does full system upgrades
end
if $is_steam_host
echo "Installing holo-keyring"
sudo pacman-key --init
sudo pacman-key --populate archlinux
sudo pacman-key --populate holo
sudo pacman -Sy --noconfirm holo-keyring
sudo pacman -S --noconfirm tmux fish neovim git
sudo pacman -Syu --noconfirm
end
# STEAMDECK: fix broken headers
if $is_steam_host
echo "Steamdeck: fixing broken headers of buildtools"
# no --needed, doesn't updated headers
sudo pacman -S --noconfirm gcc glibc lib32-glibc linux-headers linux-api-headers cmake
# FIX ALL THE BROKEN HEADERS
if test (read -P "Re-install all packages with missing headers?" -n 1) = y
# installs packages with missing files
cat ~/.local/sources/steam-missing.txt | sudo pacman -S --noconfirm -
end
end
end # / full upgrade
# install AUR helper:
if not command -sq pikaur
if test (read -P "Install pikaur" -n 1) = y
cd ~/archlinux # change PWD for ./common.sh import
# need build tools first
sudo env bash ~/archlinux/install-buildtools.sh
env bash ~/archlinux/install-aur-and-mirror-helpers.sh
cd -
echo $PWD
end
end
if $is_steam_host
if test (read -P "Install steamos-btrfs" -n 1) = y
set t "$(mktemp -d)"
curl -sSL https://gitlab.com/popsulfr/steamos-btrfs/-/archive/main/steamos-btrfs-main.tar.gz | tar -xzf - -C "$t" --strip-components=1
"$t/install.sh"
env rm -rf "$t"
end
end
if test (read -P "Install advcpmv" -n 1) = y
set t "$(mktemp -d)"
curl https://raw.githubusercontent.com/jarun/advcpmv/master/install.sh --create-dirs -o $t/advcpmv/install.sh; and begin
cd $t/advcpmv; and sh install.sh; and mv $t/advcpmv/advcp $HOME/.local/bin/; and mv $t/advcpmv/advmv $HOME/.local/bin/
end
env rm -rf "$t"
end
# FIRST TRY SCRIPT, MAY FAIL BECAUSE GIT SUBMODULES NOT CHECKED OUT
if test (read -P "Install CLI essentials" -n 1) = y
cd ~/archlinux # change PWD for ./common.sh import
if not $is_steam_host
sudo env bash ~/archlinux/install-steamdeck-essentials.sh
else
sudo env bash ~/archlinux/install-cli-essentials.sh
end
cd -
echo $PWD
end
# ESSENTIALS SYSTEM
if test (read -P "Manually install CLI essentials (fish, tmux, ...)" -n 1) = y
pikaur -S --needed --noconfirm \
fish \
tmux fpp \
# fish uses "hostname" in many scripts
inetutils \
#fails because of scdoc depenendy:
neovim-remote \
direnv \
babashka-bin \
ripgrep nnn jaapi-advcpmv \
# modern cli
bash-completion fzy fzf fd duf dust exa bottom bat procs tldr \
python3 python-pip python-poetry \
github-cli \
nordvpn-bin \
# fish z
zoxide
# ESSENTIALS w/ STEAM special cases
# eg. neovim-git htop mosh urlview
if $is_steam
# sshuttle
pikaur -S --noconfirm sshuttle --overwrite "/usr/lib/python3.*" && sudo pacman -S python
# NVIM
pikaur -S --noconfirm neovim-git xsel
nvim --version # print current version
if test (read -P "Manually install NEOVIM-GIT (version >= 7 needed)?" -n 1) = y
# pikaur -S --needed neovim-git
cd ~/.local/sources
pikaur -G neovim-git
cd neovim-git
makepkg --syncdeps --install --clean
cd
end
# URLVIEW
pikaur -S urlview --noconfirm --overwrite "/etc/urlview/*"
# HTOP
if test (read -P "Manually install htop?" -n 1) = y
# need at least this version for current ~/.htop
if not test "htop 3.2.1" = (htop --version)
pikaur -S --noconfirm --needed ncurses libnl libcap && pikaur -S htop-git
# manually (fallback)
htop --version
if test (read -P "Manually install HTOP?" -n 1) = y
git clone https://github.com/htop-dev/htop ~/.local/sources/htop
cd ~/.local/sources/htop
./autogen.sh && ./configure \
--prefix=/usr \
--sysconfdir=/etc \
--enable-unicode \
--enable-openvz \
--enable-vserver
sudo make install
cd ~
end
end
end
# NVIMPAGER
if not command nvimpager
if test (read -P "Manually install NVIMPAGER?" -n 1) = y
cd ~/Downloads
git clone https://git.sr.ht/~sircmpwn/scdoc
cd scdoc
make
sudo make install
cd ~/Downloads
git clone https://github.com/lucc/nvimpager
cd nvimpager/
make PREFIX=$HOME/.local/bin install
cd ~
rm -rf ~/Downloads/nvimpager ~/Downloads/scdoc
end
end
else # not steam should just work
pikaur -S \
neovim-git nvimpager-git \
urlview \
sshuttle
# keep empty line for "end"
end
# keep empty line
end # / if cli essentials
if test (read -P "Install pip wheel pynvim autopep8 flake8?" -n 1) = y
pip3 install --user wheel pynvim
pip3 install --user autopep8 # might fail
pip3 install --user flake8 # might fail
end
if test (read -P "Setup fishlogin?" -n 1) = y
# FISH DEFAULT SHELL
# 1. Copy this file to /usr/local/bin/fishlogin
sudo ln -s ~/.local/bin/fishlogin /usr/local/bin/fishlogin
# 2. Make it executable:
sudo chmod +x /usr/local/bin/fishlogin
# 3. Add it to /etc/shells
echo /usr/local/bin/fishlogin | sudo tee -a /etc/shells
# 4. print Instructions
printf "4. Switch your login shell:\n
chsh -s /usr/local/bin/fishlogin $USER\n
# source: https://superuser.com/a/1046884\n"
end
if test (read -P "Install fisher + theme + plugins?" -n 1) = y
# FISHER
fish -c 'curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher'
# fzf
fish -c 'fisher install PatrickF1/fzf.fish'
# ssh-agent
# fish -c 'fisher install danhper/fish-ssh-agent'
# zoxide: fish helper
# use:
# z alias cd
# zi => interactive
fish -c 'fisher install jethrokuan/z'
# replay: take bash commands and use return value
# e.g.: replay "source /usr/share/nvm.sh --no-use && nvm use latest" # installs and uses latest nvm
fish -c 'fisher install jorgebucaran/replay.fish'
# bass: makes it easy to use utilities written for Bash in fish shell.
# e.g.: bass export X=3
fish -c 'fisher install edc/bass'
# fish -c 'fisher install andreiborisov/sponge'
# fish -c 'fisher install gazorby/fish-abbreviation-tips'
# omf
curl https://raw.githubusercontent.com/oh-my-fish/oh-my-fish/master/bin/install | NONINTERACTIVE=true fish
# omf theme
fish -c 'omf install yimmy'
# MANUAL: install OH-MY-FISH
if test (read -P "Manually install OMF?" -n 1) = y
mkdir -p ~/.local/sources
cd ~/.local/sources
git clone -c core.autocrlf=false https://github.com/oh-my-fish/oh-my-fish
cd oh-my-fish
bin/install --offline --noninteractive
cd
end
end
# NPM / YARN / NODE / NVM
if test (read -P "Setup NPM / YARN / NODE / NVM installations?" -n 1) = y
pikaur -S --noconfirm nvm
# install ~/.nvm
bash --norc /usr/share/nvm/init-nvm.sh
cd ~
mkdir -p ~/.local/share/nvm
fish -c 'fisher install jorgebucaran/nvm.fish'
nvm install lts
nvm use lts
npm install -G yarn
end
# CLOJURE (steamdeck)
if test (read -P "Install CLOJURE?" -n 1) = y
cd ~/.local/sources
# build clojure
pikaur -G clojure && cd clojure/repos/community-any && makepkg --noconfirm --syncdeps --clean --force && sudo pacman -U --noconfirm clojure-*.pkg.tar.zst --overwrite "*" && \
# leiningen
gpg --receive-keys 040193357D0606ED && sudo pacman -S --noconfirm readline && pikaur -S --noconfirm leiningen rlwrap
cd ~
end
if test (read -P "Install GUI essentials (kitty, signal, steam)" -n 1) = y
# ESSENTIALS GUI & DESKTOP
# 1. create some space on steamdeck
if $is_steam
# delete unneeded docs/fonts
pikaur -R \
qt5-examples qt5-doc
pikaur -R \
noto-fonts-cjk
# MOVE steam
if test (read -P "Move /usr/lib/steam?" -n 1) = y
sudo rsync -avzh --remove-source-files --progress /usr/lib/steam ~/.local/lib/ && sudo rmdir /usr/lib/steam/steam_launcher/ && sudo rmdir /usr/lib/steam/ && sudo ln -s /home/deck/.local/lib/steam/ /usr/lib/steam
end
# MOVE signal-desktop
if test (read -P "Move /usr/lib/signal-desktop?" -n 1) = y
sudo rsync -avzh --remove-source-files --progress /usr/lib/signal-desktop ~/.local/lib/ && sudo rm -rf /usr/lib/signal-desktop/ && sudo ln -s /home/deck/.local/lib/signal-desktop/ /usr/lib/signal-desktop
end
# MOVE python3.10
if test (read -P "Move /usr/lib/python3.10?" -n 1) = y
sudo rsync -avzh --remove-source-files --progress /usr/lib/python3.10 ~/.local/lib/ && sudo rm -rf /usr/lib/python3.10/ && sudo ln -s /home/deck/.local/lib/python3.10/ /usr/lib/python3.10
end
# MOVE insync
if test (read -P "Move /usr/lib/insync?" -n 1) = y
sudo rsync -avzh --remove-source-files --progress /usr/lib/insync ~/.local/lib/ && sudo rm -rf /usr/lib/insync/ && sudo ln -s /home/deck/.local/lib/insync/ /usr/lib/insync
end
# MOVE jvm
if test (read -P "Move /usr/lib/jvm?" -n 1) = y
sudo rsync -avzh --remove-source-files --progress /usr/lib/jvm ~/.local/lib/ && sudo rm -rf /usr/lib/jvm/ && sudo ln -s /home/deck/.local/lib/jvm/ /usr/lib/jvm
end
end
# 2. install GUI apps
pikaur -S --needed --noconfirm \
filelight \
--overwrite /etc/xdg/filelightrc \
kdeconnect \
--overwrite "/etc/xdg/autostart/org.kde.kdeconnect.daemon.desktop" \
google-chrome kdialog \
--overwrite "/opt/google/chrome/*" \
# xclip is for kitty \
kitty xclip \
yakuake \
# 1password:
1password-cli \
1password-beta \
--overwrite "/opt/1Password/*" \
# vscode
# (needed for sync auth)
gnome-keyring libsecret libgnome-keyring \
--overwrite "/etc/xdg/autostart/gnome-keyring-*" \
visual-studio-code-bin \
--overwrite "/opt/visual-studio-code/*" \
# unify for logitech setpoint
ltunify \
# FONTS
powerline-fonts ttf-inconsolata ttf-joypixels nerd-fonts-hack \
# MAYBE NOT SO ESSENTIAL...
zathura \
signal-desktop \
cpupower-gui cpupower \
--overwrite "/etc/cpupower_gui*" \
insync
if not $is_steam
pikaur -S --needed --noconfirm \
noto-fonts
pikaur -S --needed --noconfirm \
kwin-bismuth-bin \
appimagelauncher-git
else
# APPIMAGELAUNCHER
if test (read -P "Manually install APPIMAGELAUNCHER?" -n 1) = y
cd ~/.local/sources/
pikaur -G appimagelauncher-git
cd appimagelauncher-git
sudo pacman -S libxpm lib32-glibc make cmake glib2 cairo librsvg zlib sysprof
makepkg --noconfirm --syncdeps --install --clean
cd ~
end
# CMDG
if test (read -P "Manually install CMDG?" -n 1) = y
git clone https://github.com/JoeSchr/cmdg.git ~/.local/sources/cmdg
cd ~/.local/sources/cmdg
pikaur -S go --noconfirm
go build ./cmd/cmdg
sudo cp cmdg /usr/local/bin
# press Ctrl-A u to open urls in mail
pikaur -S --noconfirm urlview lynx \
--overwrite "/etc/lynx.lss"
pikaur -R go
cd ~
end
# 1PASSWORD
if test (read -P "Manually install 1PASSWORD?" -n 1) = y
cd ~/.local/sources/
curl -sS https://downloads.1password.com/linux/keys/1password.asc | gpg --import
git clone https://aur.archlinux.org/1password.git
cd 1password && makepkg -si
cd ~
end
end
end # GUI essentials
if test (read -P "Install ta-lib" -n 1) = y
# TA-LIB
cd ~/Downloads \
&& wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz \
&& tar xvzf ta-lib-0.4.0-src.tar.gz \
&& cd ta-lib \
&& sed -i.bak "s|0.00000001|0.000000000000000001 |g" src/ta_func/ta_utility.h \
&& ./configure --prefix=/usr/local \
&& make \
&& sudo make install \ && cd .. \
&& mv ta-lib/ ~/.local/sources/ta-lib
end
# MANUALLY powerline fonts
if test (read -P "Manually install POWERLINE-FONTS?" -n 1) = y
cd ~/Downloads
git clone https://github.com/powerline/fonts.git --depth=1
cd fonts
./install.sh
cd ..
rm -rf fonts
cd ~/Downloads
end
if not $is_steam
if test (read -P "Install docker/podman" -n 1) = y
# DOCKER/PODMAN
pikaur -S --noconfirm podman catatonit crun
# needed for cgroups
# see: https://wiki.archlinux.org/index.php/Podman
sudo touch /etc/sub{u,g}id
sudo usermod --add-subuids 165536-231072 --add-subgids 165536-231072 (whoami)
# add dockerhub
echo "[registries.search]
registries = ['docker.io']" | sudo tee -a /etc/containers/registries.conf
# DOCKER-COMPOSE
sudo curl -L https://github.com/docker/compose/releases/download/1.27.4/docker-compose-(uname -s)-(uname -m) -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
# OPEN SHIFT
# Minishift & OC Cli
pikaur -Sy minishift origin-client
# ODO Cli
sudo curl -L https://mirror.openshift.com/pub/openshift-v4/clients/odo/latest/odo-linux-amd64 -o /usr/local/bin/odo
sudo chmod +x /usr/local/bin/odo
# openshift crc
# install `crc` first from here:
# https://access.redhat.com/documentation/en-us/red_hat_codeready_containers/1.20/html/getting_started_guide/using-codeready-containers_gsg
# https://wiki.archlinux.org/index.php/OpenShift#openshift_v4
# # CRC SETUP
# crc setup
# crc start
end
# bluetooth a2dp
# pikaur -Sy pulseaudio-bt-auto-enable-a2dp pulseaudio-bluetooth
# equalizer
# pikaur -Sy pulseeffects
# NVIDIA INTEL HYBRID STUFF
# sudo mhwd -i pci video-hybrid-intel-nvidia-450xx-prime
# pikaur -S cuda vulkan-mesa-layers vulkan-intel lib32-vulkan-intel lib32-amdvlk lib32-nvidia-utils lib32-vulkan-mesa-layers
# sudo mhwd -r pci video-nvidia-455xx
# sudo pikaur -S lib32-opencl-nvidia-455xx opencl-nvidia
# sudo pikaur -S nvidia-dkms-beta vulkan-mesa-layers lib32-vulkan-intel lib32-nvidia-utils-beta lib32-vulkan-mesa-layers
if test (read -P "Install qemu/libwirt" -n 1) = y
pikaur -S libvirt qemu qemu-arch-extra
sudo pacman -Syu ebtables dnsmasq
sudo systemctl restart libvirtd
end
# MANUAL/LOCAL BUILDS
# CUSTOM KERNEL
if test (read -P "Install xenomod" -n 1) = y
## xenomod
gpg --receive-keys 38DBBDC86092693E
pikaur -S linux-manjaro-xanmod linux-manjaro-xanmod-headers
sudo ln -s /usr/src/linux-manjaro-xanmod /usr/src/linux
end
if test (read -P "Install nvidia-beta driver?" -n 1) = y
# install beta, because of DKMS
pikaur -Sy nvidia-beta-dkms xorg-server-devel lib32-nvidia-utils-beta nvidia-settings-beta opencl-nvidia-beta
sudo groupadd plugdev
sudo usermod -aG plugdev $USER
end
end
# chrome-remote-desktop
if test (read -P "Install chrome-remote-desktop?" -n 1) = y
cd ~/Downloads
pikaur -S chrome-remote-desktop --noconfirm
if type -q chrome-remote-desktop-patch
chrome-remote-desktop-patch
else
cp /opt/google/chrome-remote-desktop/chrome-remote-desktop .
patch -i chrome-remote-desktop--use_existing_session.patch chrome-remote-desktop
sudo cp ./chrome-remote-desktop /opt/google/chrome-remote-desktop/chrome-remote-desktop
end
end
# TWEAKS
if not $is_steam
if test (read -P "Fix ntfs-3g disk access? on mount as user?" -n 1) = y
# fix ntfs-3g disk access on mount as user
sudo usermod -a -G disk (whoami)
end
if test (read -P "Install system76 scheduler?" -n 1) = y
# System76 scheduler
pikaur -S system76-scheduler-git --noconfirm
sudo systemctl enable --now com.system76.Scheduler.service
end
end
if test (read -P "Increase number of file watchers?" -n 1) = y
# increase number of file watcher
echo fs.inotify.max_user_watches=1048576 | sudo tee -a /etc/sysctl.d/50-max_user_watches.conf && sudo touch /etc/sysctl.conf && sudo sysctl -p
end
# fix .ssh
if test (read -P "Fix .ssh/* permissions" -n 1) = y
chmod 600 "~/.ssh/*"
end
if test (read -P "Fix moonlander rules?" -n 1) = y
# moonlander
sudo ln -s ~/.local/share/50-zsa.rules /etc/udev/rules.d/50-zsa.rules
end
if test (read -P "Fix groups for nordvpn, 1password, docker?" -n 1) = y
# nordvpn
sudo groupadd -r nordvpn
sudo systemctl enable --now nordvpnd.service
sudo gpasswd -a (whoami) nordvpn
# 1password
sudo groupadd onepassword-cli
sudo chown root:onepassword-cli (which op) && sudo chmod g+s (which op)
# DOCKER (REFRESH GROUP)
# needs to be at end, because it sources .bashrc again
# DOCKER
sudo groupadd docker
sudo usermod -aG docker (whoami)
sudo systemctl enable docker
sudo systemctl start docker
sudo chown (id -u):(id -g) /var/run/docker.sock
newgrp docker
end
# DELETE UNNEEDED PACKAGES
if test (read -P "Remove all unneeded packages?" -n 1) = y
sudo pacman -Rs (pacman -Qtdq)
end
#
# LAST RESORT KEY DB RESET
# # update mirror-list
# pacman-mirrors -g
# # update keydatabases
# sudo rm -R /etc/pacman.d/gnupg
# sudo rm -R /root/.gnupg
# sudo dirmngr </dev/null
# sudo pacman-key --init
# sudo pacman-key --populate
# sudo pacman -Sy gnupg archlinux-keyring manjaro-keyring
# sudo pacman-key --refresh-keys
# sudo systemctl restart pacman-init
# update databases
# sudo pacman -Fy
# sudo pacman -Syy