-
Notifications
You must be signed in to change notification settings - Fork 3
/
bootstrap.sh
executable file
·2390 lines (2359 loc) · 104 KB
/
bootstrap.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
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
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env bash
#=========================================================================
# Author: Gaetan (gaetan@ictpourtous.com) - Twitter: @astsu777
# Creation: Sun Mar 2020 19:49:21
# Last modified: Thu 25 Jul 2024 17:10:09
# Version: 2.0
#
# Description: this script automates the setup of my personal computers
#=========================================================================
#=======================
# VARIABLES
#=======================
# Dotfiles location
dfloc="$HOME/.dotfiles"
dfrepo="https://github.com/astsu777/dotfiles.git"
# Custom scripts location
scriptsloc="$HOME/.local/bin"
resourcesloc="$HOME/.local/share"
# Git repositories location
gitrepoloc="$HOME/.sources/repos"
# Direct download location
ddloc="/usr/local/bin"
# Software sources location
# sourcesloc="$HOME/.sources"
# Wallpapers
wallpapers="https://github.com/astsu777/wallpapers.git"
wallpapersloc="$HOME/.local/share/wallpapers"
# Software lists
homebrew="https://raw.githubusercontent.com/Homebrew/install/master/install.sh"
aurhelper="https://aur.archlinux.org/yay.git"
applist="https://raw.githubusercontent.com/astsu777/bootstrap/master/apps.csv"
# Font lists
symbols_nerd="https://raw.githubusercontent.com/ryanoasis/nerd-fonts/master/src/glyphs/Symbols-2048-em%20Nerd%20Font%20Complete.ttf"
mononoki_regular="https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/Mononoki/Regular/complete/mononoki-Regular%20Nerd%20Font%20Complete.ttf"
mononoki_bold="https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/Mononoki/Bold/complete/mononoki%20Bold%20Nerd%20Font%20Complete.ttf"
mononoki_italic="https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/Mononoki/Italic/complete/mononoki%20Italic%20Nerd%20Font%20Complete.ttf"
fontawesome_brands="https://raw.githubusercontent.com/FortAwesome/Font-Awesome/master/otfs/Font%20Awesome%205%20Brands-Regular-400.otf"
fontawesome_regular="https://raw.githubusercontent.com/FortAwesome/Font-Awesome/master/otfs/Font%20Awesome%205%20Free-Regular-400.otf"
fontawesome_solid="https://raw.githubusercontent.com/FortAwesome/Font-Awesome/master/otfs/Font%20Awesome%205%20Free-Solid-900.otf"
powerline_fonts="https://github.com/powerline/fonts"
# Clipmenu location
clipmenurepo="https://github.com/cdown/clipmenu"
# Custom WM/DE location
dwmrepo="https://github.com/astsu777/dwm.git"
dwmloc="/opt/dwm"
dmenurepo="https://github.com/astsu777/dmenu.git"
dmenuloc="/opt/dmenu"
sentrepo="https://github.com/astsu777/sent.git"
sentloc="/opt/sent"
strepo="https://github.com/astsu777/st.git"
stloc="/opt/st"
slockrepo="https://github.com/astsu777/slock.git"
slockloc="/opt/slock"
surfrepo="https://github.com/astsu777/surf.git"
surfloc="/opt/surf"
adwaitaqtrepo="https://github.com/FedoraQt/adwaita-qt.git"
# Logging
date="$(date +%Y-%m-%d-%H%M%S)"
logfile="$HOME/bootstrap_log_$date.txt"
#=======================
# FUNCTIONS
#=======================
# Log to/out of the console
logc(){ tee -a "$logfile" ;}
lognoc(){ tee -a "$logfile" > /dev/null 2>&1 ;}
# Get sudo permission
getsudo(){
if [[ "$EUID" != 0 ]]; then
sudo -v
while true; do sudo -n true; sleep 5; kill -0 "$$" || exit; done 2>/dev/null &
fi
}
# Determine init system in Linux
if [[ "$OSTYPE" == "linux-gnu" ]]; then
if type systemctl >> /dev/null 2>&1; then
initSystem="systemd"
enableSvc(){ sudo systemctl enable "$1" ;}
startSvc(){ sudo systemctl start "$1" ;}
elif type rc-update >> /dev/null 2>&1; then
initSystem="openrc"
grepopenrcpkg(){ openrcpkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[O][^,]*," | sed '/^W/d' | sed 's/^.*,//g' > "$openrcpkg" ;}
grepworkopenrcpkg(){ openrcworkpkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[O][^,]*," | grep "^W" | sed 's/^.*,//g' > "$openrcworkpkg" ;}
enableSvc(){ sudo rc-update add "$1" ;}
startSvc(){ sudo rc-service "$1" start ;}
elif type sv >> /dev/null 2>&1; then
initSystem="runit"
greprunitpkg(){ runitpkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[P][^,]*," | sed '/^W/d' | sed 's/^.*,//g' > "$runitpkg" ;}
grepworkrunitpkg(){ runitworkpkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[P][^,]*," | grep "^W" | sed 's/^.*,//g' > "$runitworkpkg" ;}
enableSvc(){ sudo ln -s /etc/sv/"$1" /var/service/ ;}
startSvc(){ sudo sv start "$1" ;}
elif type s6-rc-bundle-update >> /dev/null 2>&1; then
initSystem="s6"
greps6pkg(){ s6pkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[M][^,]*," | sed '/^W/d' | sed 's/^.*,//g' > "$s6pkg" ;}
grepworks6pkg(){ s6workpkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[M][^,]*," | grep "^W" | sed 's/^.*,//g' > "$s6workpkg" ;}
enableSvc(){ sudo s6-rc-bundle-update -c /etc/s6/rc/compiled add default "$1" ;}
startSvc(){ sudo s6-rc -u change "$1" ;}
elif type 66-enable >> /dev/null 2>&1; then
initSystem="suite66"
greps6pkg(){ suite66pkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[N][^,]*," | sed '/^W/d' | sed 's/^.*,//g' > "$suite66pkg" ;}
grepworks6pkg(){ suite66workpkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[N][^,]*," | grep "^W" | sed 's/^.*,//g' > "$suite66workpkg" ;}
enableSvc(){ sudo 66-enable -t default "$1" ;}
startSvc(){ sudo 66-start -t default "$1" ;}
fi
fi
# List packages to install
grepaurpkg(){ aurpkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[8][^,]*," | sed '/^W/d' | sed 's/^.*,//g' > "$aurpkg" ;}
grepsnappkg(){ snappkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[U][^,]*," | sed '/^W/d' | sed 's/^.*,//g' > "$snappkg" ;}
grepguipkg(){ guipkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[3][^,]*," | sed '/^W/d' | sed 's/^.*,//g' > "$guipkg" ;}
grepworkaurpkg(){ workaurpkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[8][^,]*," | grep "^W" | sed 's/^.*,//g' > "$workaurpkg" ;}
grepworksnappkg(){ worksnappkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[U][^,]*," | sed 's/^.*,//g' > "$worksnappkg" ;}
grepworkguipkg(){ workguipkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[3][^,]*," | grep "^W" | sed 's/^.*,//g' > "$workguipkg" ;}
grepgitrepo(){ if type git > /dev/null 2>&1; then repo=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[0][^,]*," | sed '/^W/d' | sed 's/^.*,//g' | awk '{print $1}' > "$repo"; fi ;}
grepworkgitrepo(){ if type git > /dev/null 2>&1; then workrepo=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[0][^,]*," | grep "^W" | sed 's/^.*,//g' | awk '{print $1}' > "$workrepo" ; fi ;}
grepdirectdl(){ ddl=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[1][^,]*," | sed '/^W/d' | sed 's/^.*,//g' | awk '{print $1}' > "$ddl" ;}
grepworkdirectdl(){ workddl=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[1][^,]*," | grep "^W" | sed 's/^.*,//g' | awk '{print $1}' > "$workddl" ;}
grepsrvpkg(){
curl -fsSLO "$applist" 2>&1 | lognoc
srvpkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[S][^,]*," | sed 's/^.*,//g' > "$srvpkg"
}
grepxpkg(){ archxpkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[X][^,]*," | sed '/^W/d' | sed 's/^.*,//g' > "$archxpkg" ;}
grepvoidxpkg(){ voidxpkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[Y][^,]*," | sed '/^W/d' | sed 's/^.*,//g' > "$voidxpkg" ;}
# Package managers
if type brew > /dev/null 2>&1; then
setupcustomrepos(){ echo > /dev/null 2>&1;}
greppkg(){ pkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[2][^,]*," | sed '/^W/d' | sed 's/^.*,//g' > "$pkg" ;}
grepworkpkg(){ workpkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[2][^,]*," | grep "^W" | sed 's/^.*,//g' > "$workpkg" ;}
update(){ brew update 2>&1 | lognoc ;}
install(){ brew install "$@" 2>&1 | lognoc ;}
uninstall(){ brew uninstall "$@" 2>&1 | lognoc ;}
installgui(){ brew install --cask "$@" 2>&1 | lognoc ;}
# installvirtualbox(){ update 2>&1 | lognoc && install virtualbox virtualbox-extension-pack 2>&1 | lognoc ;}
installkvm(){ update 2>&1 | lognoc && install utm 2>&1 | lognoc ;}
elif type apt-get snap > /dev/null 2>&1; then
export DEBIAN_FRONTEND=noninteractive
setupcustomrepos(){ echo > /dev/null 2>&1 ;}
greppkg(){ pkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[6][^,]*," | sed '/^W/d' | sed 's/^.*,//g' > "$pkg" ;}
grepworkpkg(){
workpkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[6][^,]*," | grep "^W" | sed 's/^.*,//g' > "$workpkg"
echo "wireshark-common wireshark-common/install-setuid boolean true" | sudo debconf-set-selections
export DEBIAN_FRONTEND=noninteractive
}
update(){
if [[ "$EUID" == 0 ]]; then
apt-get update 2>&1 | lognoc
else
sudo apt-get update 2>&1 | lognoc
fi
}
updatesnap(){
if [[ "$EUID" == 0 ]]; then
snap refresh 2>&1 | lognoc
else
sudo snap refresh 2>&1 | lognoc
fi
}
install(){
if [[ "$EUID" == 0 ]]; then
apt-get install -y "$@" 2>&1 | lognoc
else
sudo apt-get install -y "$@" 2>&1 | lognoc
fi
}
installsnap(){
if [[ "$EUID" == 0 ]]; then
snap install "$@" 2>&1 | lognoc
else
sudo snap install "$@" 2>&1 | lognoc
fi
}
uninstall(){
if [[ "$EUID" == 0 ]]; then
apt-get remove -y --purge "$@" 2>&1 | lognoc
else
sudo apt-get remove -y --purge "$@" 2>&1 | lognoc
fi
}
uninstallsnap(){
if [[ "$EUID" == 0 ]]; then
snap remove --purge "$@" 2>&1 | lognoc
else
sudo snap remove --purge "$@" 2>&1 | lognoc
fi
}
# installvirtualbox(){
# update 2>&1 | lognoc && install virtualbox linux-headers 2>&1 | lognoc
# version=$(VBoxManage -v | sed 's/r[0-9a-b]*//') && wget "https://download.virtualbox.org/virtualbox/${version}/Oracle_VM_VirtualBox_Extension_Pack-${version}.vbox-extpack"
# yes | VBoxManage extpack install --replace Oracle_VM_VirtualBox_Extension_Pack-"${version}".vbox-extpack && rm -f Oracle_VM_VirtualBox_Extension_Pack-"${version}".vbox-extpack
# }
installkvm(){
update 2>&1 | lognoc && install ovmf ebtables iptables qemu-kvm dmidecode libvirt-clients libvirt-daemon-system bridge-utils virtinst libvirt-daemon virt-manager 2>&1 | lognoc
updatesnap 2>&1 | lognoc && installsnap --beta swtpm-mvo 2>&1 | lognoc
if [[ "$initSystem" == "openrc" ]]; then install libvirt-openrc 2>&1 | lognoc; fi
if [[ "$initSystem" == "runit" ]]; then install libvirt-runit 2>&1 | lognoc; fi
if [[ "$initSystem" == "s6" ]]; then install libvirt-s6 2>&1 | lognoc; fi
if [[ "$initSystem" == "suite66" ]]; then install libvirt-suite66 2>&1 | lognoc; fi
enableSvc libvirtd 2>&1 | lognoc && startSvc libvirtd 2>&1 | lognoc
sudo usermod -a -G libvirt "$(whoami)" 2>&1 | lognoc && sudo usermod -a -G libvirt-qemu "$(whoami)" 2>&1 | lognoc
}
elif type apt snap > /dev/null 2>&1; then
setupcustomrepos(){ echo > /dev/null 2>&1 ;}
greppkg(){ pkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[6][^,]*," | sed '/^W/d' | sed 's/^.*,//g' > "$pkg" ;}
grepworkpkg(){
workpkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[6][^,]*," | grep "^W" | sed 's/^.*,//g' > "$workpkg"
echo "wireshark-common wireshark-common/install-setuid boolean true" | sudo debconf-set-selections
export DEBIAN_FRONTEND=noninteractive
}
update(){
if [[ "$EUID" == 0 ]]; then
apt update 2>&1 | lognoc
else
sudo apt update 2>&1 | lognoc
fi
}
updatesnap(){
if [[ "$EUID" == 0 ]]; then
snap refresh 2>&1 | lognoc
else
sudo snap refresh 2>&1 | lognoc
fi
}
install(){
if [[ "$EUID" == 0 ]]; then
apt install -y "$@" 2>&1 | lognoc
else
sudo apt install -y "$@" 2>&1 | lognoc
fi
}
installsnap(){
if [[ "$EUID" == 0 ]]; then
snap install "$@" 2>&1 | lognoc
else
sudo snap install "$@" 2>&1 | lognoc
fi
}
uninstall(){
if [[ "$EUID" == 0 ]]; then
apt remove -y --purge "$@" 2>&1 | lognoc
else
sudo apt remove -y --purge "$@" 2>&1 | lognoc
fi
}
uninstallsnap(){
if [[ "$EUID" == 0 ]]; then
snap remove --purge "$@" 2>&1 | lognoc
else
sudo snap remove --purge "$@" 2>&1 | lognoc
fi
}
# installvirtualbox(){
# update 2>&1 | lognoc && install virtualbox linux-headers 2>&1 | lognoc
# version=$(VBoxManage -v | sed 's/r[0-9a-b]*//') && wget "https://download.virtualbox.org/virtualbox/${version}/Oracle_VM_VirtualBox_Extension_Pack-${version}.vbox-extpack"
# yes | VBoxManage extpack install --replace Oracle_VM_VirtualBox_Extension_Pack-"${version}".vbox-extpack && rm -f Oracle_VM_VirtualBox_Extension_Pack-"${version}".vbox-extpack
# }
installkvm(){
update 2>&1 | lognoc && install ovmf ebtables iptables qemu-kvm dmidecode libvirt-clients libvirt-daemon-system bridge-utils virtinst libvirt-daemon virt-manager 2>&1 | lognoc
updatesnap 2>&1 | lognoc && installsnap --beta swtpm-mvo 2>&1 | lognoc
if [[ "$initSystem" == "openrc" ]]; then install libvirt-openrc 2>&1 | lognoc; fi
if [[ "$initSystem" == "runit" ]]; then install libvirt-runit 2>&1 | lognoc; fi
if [[ "$initSystem" == "s6" ]]; then install libvirt-s6 2>&1 | lognoc; fi
if [[ "$initSystem" == "suite66" ]]; then install libvirt-suite66 2>&1 | lognoc; fi
enableSvc libvirtd 2>&1 | lognoc && startSvc libvirtd 2>&1 | lognoc
sudo usermod -a -G libvirt "$(whoami)" 2>&1 | lognoc && sudo usermod -a -G libvirt-qemu "$(whoami)" 2>&1 | lognoc
}
elif type apt-get > /dev/null 2>&1; then
export DEBIAN_FRONTEND=noninteractive
setupcustomrepos(){ echo > /dev/null 2>&1 ;}
greppkg(){ pkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[6][^,]*," | sed '/^W/d' | sed 's/^.*,//g' > "$pkg" ;}
grepworkpkg(){
workpkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[6][^,]*," | grep "^W" | sed 's/^.*,//g' > "$workpkg"
echo "wireshark-common wireshark-common/install-setuid boolean true" | sudo debconf-set-selections
export DEBIAN_FRONTEND=noninteractive
}
update(){
if [[ "$EUID" == 0 ]]; then
apt-get update 2>&1 | lognoc
else
sudo apt-get update 2>&1 | lognoc
fi
}
install(){
if [[ "$EUID" == 0 ]]; then
apt-get install -y "$@" 2>&1 | lognoc
else
sudo apt-get install -y "$@" 2>&1 | lognoc
fi
}
uninstall(){
if [[ "$EUID" == 0 ]]; then
apt-get remove -y --purge "$@" 2>&1 | lognoc
else
sudo apt-get remove -y --purge "$@" 2>&1 | lognoc
fi
}
# installvirtualbox(){
# update 2>&1 | lognoc && install virtualbox linux-headers 2>&1 | lognoc
# version=$(VBoxManage -v | sed 's/r[0-9a-b]*//') && wget "https://download.virtualbox.org/virtualbox/${version}/Oracle_VM_VirtualBox_Extension_Pack-${version}.vbox-extpack"
# yes | VBoxManage extpack install --replace Oracle_VM_VirtualBox_Extension_Pack-"${version}".vbox-extpack && rm -f Oracle_VM_VirtualBox_Extension_Pack-"${version}".vbox-extpack
# }
installkvm(){
update 2>&1 | lognoc && install ovmf ebtables iptables qemu-kvm dmidecode libvirt-clients libvirt-daemon-system bridge-utils virtinst libvirt-daemon virt-manager 2>&1 | lognoc
if [[ "$initSystem" == "openrc" ]]; then install libvirt-openrc 2>&1 | lognoc; fi
if [[ "$initSystem" == "runit" ]]; then install libvirt-runit 2>&1 | lognoc; fi
if [[ "$initSystem" == "s6" ]]; then install libvirt-s6 2>&1 | lognoc; fi
if [[ "$initSystem" == "suite66" ]]; then install libvirt-suite66 2>&1 | lognoc; fi
enableSvc libvirtd 2>&1 | lognoc && startSvc libvirtd 2>&1 | lognoc
sudo usermod -a -G libvirt "$(whoami)" 2>&1 | lognoc && sudo usermod -a -G libvirt-qemu "$(whoami)" 2>&1 | lognoc
}
elif type apt > /dev/null 2>&1; then
setupcustomrepos(){ echo > /dev/null 2>&1 ;}
greppkg(){ pkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[6][^,]*," | sed '/^W/d' | sed 's/^.*,//g' > "$pkg" ;}
grepworkpkg(){
workpkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[6][^,]*," | grep "^W" | sed 's/^.*,//g' > "$workpkg"
echo "wireshark-common wireshark-common/install-setuid boolean true" | sudo debconf-set-selections
export DEBIAN_FRONTEND=noninteractive
}
update(){
if [[ "$EUID" == 0 ]]; then
apt update 2>&1 | lognoc
else
sudo apt update 2>&1 | lognoc
fi
}
install(){
if [[ "$EUID" == 0 ]]; then
apt install -y "$@" 2>&1 | lognoc
else
sudo apt install -y "$@" 2>&1 | lognoc
fi
}
uninstall(){
if [[ "$EUID" == 0 ]]; then
apt remove -y --purge "$@" 2>&1 | lognoc
else
sudo apt remove -y --purge "$@" 2>&1 | lognoc
fi
}
# installvirtualbox(){
# update 2>&1 | lognoc && install virtualbox linux-headers 2>&1 | lognoc
# version=$(VBoxManage -v | sed 's/r[0-9a-b]*//') && wget "https://download.virtualbox.org/virtualbox/${version}/Oracle_VM_VirtualBox_Extension_Pack-${version}.vbox-extpack"
# yes | VBoxManage extpack install --replace Oracle_VM_VirtualBox_Extension_Pack-"${version}".vbox-extpack && rm -f Oracle_VM_VirtualBox_Extension_Pack-"${version}".vbox-extpack
# }
installkvm(){
update 2>&1 | lognoc && install ovmf ebtables iptables qemu-kvm dmidecode libvirt-clients libvirt-daemon-system bridge-utils virtinst libvirt-daemon virt-manager 2>&1 | lognoc
if [[ "$initSystem" == "openrc" ]]; then install libvirt-openrc 2>&1 | lognoc; fi
if [[ "$initSystem" == "runit" ]]; then install libvirt-runit 2>&1 | lognoc; fi
if [[ "$initSystem" == "s6" ]]; then install libvirt-s6 2>&1 | lognoc; fi
if [[ "$initSystem" == "suite66" ]]; then install libvirt-suite66 2>&1 | lognoc; fi
enableSvc libvirtd 2>&1 | lognoc && startSvc libvirtd 2>&1 | lognoc
sudo usermod -a -G libvirt "$(whoami)" 2>&1 | lognoc && sudo usermod -a -G libvirt-qemu "$(whoami)" 2>&1 | lognoc
}
elif type yum > /dev/null 2>&1; then
setupcustomrepos(){
# Fedora
if [[ -f /etc/fedora-release ]]; then
# RPM Fusion
install "https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm" 2>&1 | lognoc
install "https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm" 2>&1 | lognoc
# RPM Sphere
install rpmsphere-release 2>&1 | lognoc
else
echo > /dev/null 2>&1
fi
}
greppkg(){ pkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[7][^,]*," | sed '/^W/d' | sed 's/^.*,//g' > "$pkg" ;}
grepworkpkg(){ workpkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[7][^,]*," | grep "^W" | sed 's/^.*,//g' > "$workpkg" ;}
update(){
if [[ "$EUID" == 0 ]]; then
yum update -y 2>&1 | lognoc
else
sudo yum update -y 2>&1 | lognoc
fi
}
install(){
if [[ "$EUID" == 0 ]]; then
yum install -y "$@" 2>&1 | lognoc
else
sudo yum install -y "$@" 2>&1 | lognoc
fi
}
uninstall(){
if [[ "$EUID" == 0 ]]; then
yum remove -y "$@" 2>&1 | lognoc
else
sudo yum remove -y "$@" 2>&1 | lognoc
fi
}
# installvirtualbox(){
# update 2>&1 | lognoc && install VirtualBox linux-headers 2>&1 | lognoc
# version=$(VBoxManage -v | sed 's/r[0-9a-b]*//') && wget "https://download.virtualbox.org/virtualbox/${version}/Oracle_VM_VirtualBox_Extension_Pack-${version}.vbox-extpack"
# yes | VBoxManage extpack install --replace Oracle_VM_VirtualBox_Extension_Pack-"${version}".vbox-extpack && rm -f Oracle_VM_VirtualBox_Extension_Pack-"${version}".vbox-extpack
# }
installkvm(){
update 2>&1 | lognoc && install edk2-ovmf swtpm dmidecode qemu-kvm libvirt libvirt-python libguestfs-tools virt-install ebtables iptables 2>&1 | lognoc
if [[ "$initSystem" == "openrc" ]]; then install libvirt-openrc 2>&1 | lognoc; fi
if [[ "$initSystem" == "runit" ]]; then install libvirt-runit 2>&1 | lognoc; fi
if [[ "$initSystem" == "s6" ]]; then install libvirt-s6 2>&1 | lognoc; fi
if [[ "$initSystem" == "suite66" ]]; then install libvirt-suite66 2>&1 | lognoc; fi
enableSvc libvirtd 2>&1 | lognoc && startSvc libvirtd 2>&1 | lognoc
}
elif type dnf > /dev/null 2>&1; then
setupcustomrepos(){
# Fedora
if [[ -f /etc/fedora-release ]]; then
# RPM Fusion
install "https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm" 2>&1 | lognoc
install "https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm" 2>&1 | lognoc
# RPM Sphere
install rpmsphere-release 2>&1 | lognoc
else
echo > /dev/null 2>&1
fi
}
greppkg(){ pkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[7][^,]*," | sed '/^W/d' | sed 's/^.*,//g' > "$pkg" ;}
grepworkpkg(){ workpkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[7][^,]*," | grep "^W" | sed 's/^.*,//g' > "$workpkg" ;}
update(){
if [[ "$EUID" == 0 ]]; then
dnf update -y 2>&1 | lognoc
else
sudo dnf update -y 2>&1 | lognoc
fi
}
install(){
if [[ "$EUID" == 0 ]]; then
dnf install -y "$@" 2>&1 | lognoc
else
sudo dnf install -y "$@" 2>&1 | lognoc
fi
}
uninstall(){
if [[ "$EUID" == 0 ]]; then
dnf remove -y "$@" 2>&1 | lognoc
else
sudo dnf remove -y "$@" 2>&1 | lognoc
fi
}
# installvirtualbox(){
# update 2>&1 | lognoc && install VirtualBox linux-headers 2>&1 | lognoc
# version=$(VBoxManage -v | sed 's/r[0-9a-b]*//') && wget "https://download.virtualbox.org/virtualbox/${version}/Oracle_VM_VirtualBox_Extension_Pack-${version}.vbox-extpack"
# yes | VBoxManage extpack install --replace Oracle_VM_VirtualBox_Extension_Pack-"${version}".vbox-extpack && rm -f Oracle_VM_VirtualBox_Extension_Pack-"${version}".vbox-extpack
# }
installkvm(){
update 2>&1 | lognoc && install edk2-ovmf swtpm dmidecode qemu-kvm libvirt libvirt-python libguestfs-tools virt-install ebtables iptables 2>&1 | lognoc
if [[ "$initSystem" == "openrc" ]]; then install libvirt-openrc 2>&1 | lognoc; fi
if [[ "$initSystem" == "runit" ]]; then install libvirt-runit 2>&1 | lognoc; fi
if [[ "$initSystem" == "s6" ]]; then install libvirt-s6 2>&1 | lognoc; fi
if [[ "$initSystem" == "suite66" ]]; then install libvirt-suite66 2>&1 | lognoc; fi
enableSvc libvirtd 2>&1 | lognoc && startSvc libvirtd 2>&1 | lognoc
}
elif type pacman yay > /dev/null 2>&1; then
setupcustomrepos(){
# Arch Linux/Artix
if [[ -f /etc/arch-release ]] || [[ -f /etc/artix-release ]]; then
echo > /dev/null 2>&1
# Artix
elif [[ -f /etc/artix-release ]]; then
# Arch Linux repos for Artix
sudo pacman -S --needed --noconfirm artix-archlinux-support 2>&1 | lognoc
sudo pacman-key --populate archlinux 2>&1 | lognoc
if ! grep '^Include = \/etc\/pacman\.d\/mirrorlist-arch' /etc/pacman.conf > /dev/null 2>&1; then
sudo tee -a /etc/pacman.conf <<-'EOF' >/dev/null
# ARCHLINUX REPOS
[extra]
Include = /etc/pacman.d/mirrorlist-arch
[community]
Include = /etc/pacman.d/mirrorlist-arch
#[multilib]
#Include = /etc/pacman.d/mirrorlist-arch
EOF
fi
else
echo > /dev/null 2>&1
fi
}
greppkg(){ pkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[5][^,]*," | sed '/^W/d' | sed 's/^.*,//g' > "$pkg" ;}
grepworkpkg(){ workpkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[5][^,]*," | grep "^W" | sed 's/^.*,//g' > "$workpkg" ;}
update(){
if [[ "$EUID" == 0 ]]; then
pacman -Syu --noconfirm 2>&1 | lognoc
else
sudo pacman -Syu --noconfirm 2>&1 | lognoc
fi
}
install(){
if [[ "$EUID" == 0 ]]; then
pacman -S "$@" --needed --noconfirm --ask 4 2>&1 | lognoc
else
sudo pacman -S "$@" --needed --noconfirm --ask 4 2>&1 | lognoc
fi
}
uninstall(){
if [[ "$EUID" == 0 ]]; then
pacman -Rcs "$@" --noconfirm 2>&1 | lognoc
else
sudo pacman -Rcs "$@" --noconfirm 2>&1 | lognoc
fi
}
installaur(){ yes | yay --cleanafter --nodiffmenu --noprovides --removemake --noconfirm --needed -S "$@" 2>&1 | lognoc ;}
installaurconfirm(){ yes | yay --cleanafter --nodiffmenu --noprovides --removemake --needed -S "$@" 2>&1 | lognoc ;}
uninstallaur(){ yes | yay --cleanafter --nodiffmenu --noprovides --removemake --noconfirm --needed -Rcs "$@" 2>&1 | lognoc ;}
# installvirtualbox(){
# update 2>&1 | lognoc && install virtualbox linux-headers 2>&1 | lognoc
# installaur virtualbox-ext-oracle 2>&1 | lognoc
# }
installkvm(){
update 2>&1 | lognoc && install edk2-ovmf swtpm qemu dmidecode virt-manager virt-viewer dnsmasq vde2 bridge-utils openbsd-netcat iptables-nft libguestfs firewalld 2>&1 | lognoc
sudo sed -i 's/^#unix_sock_group = "libvirt"/unix_sock_group = "libvirt"/' /etc/libvirt/libvirtd.conf 2>&1 | lognoc
sudo sed -i 's/^#unix_sock_rw_perms = "0770"/unix_sock_rw_perms = "0770"/' /etc/libvirt/libvirtd.conf 2>&1 | lognoc
sudo usermod -a -G libvirt "$(whoami)" 2>&1 | lognoc
if [[ "$initSystem" == "openrc" ]]; then install libvirt-openrc 2>&1 | lognoc; fi
if [[ "$initSystem" == "runit" ]]; then install libvirt-runit 2>&1 | lognoc; fi
if [[ "$initSystem" == "s6" ]]; then install libvirt-s6 2>&1 | lognoc; fi
if [[ "$initSystem" == "suite66" ]]; then install libvirt-suite66 2>&1 | lognoc; fi
enableSvc libvirtd 2>&1 | lognoc && startSvc libvirtd 2>&1 | lognoc
}
elif type pacman > /dev/null 2>&1; then
setupcustomrepos(){
# Arch Linux/Artix
if [[ -f /etc/arch-release ]] || [[ -f /etc/artix-release ]]; then
echo > /dev/null 2>&1
# Artix
elif [[ -f /etc/artix-release ]]; then
# Arch Linux repos for Artix
sudo pacman -S --needed --noconfirm artix-archlinux-support 2>&1 | lognoc
sudo pacman-key --populate archlinux 2>&1 | lognoc
if ! grep '^Include = \/etc\/pacman\.d\/mirrorlist-arch' /etc/pacman.conf > /dev/null 2>&1; then
sudo tee -a /etc/pacman.conf <<-'EOF' >/dev/null
# ARCHLINUX REPOS
[extra]
Include = /etc/pacman.d/mirrorlist-arch
[community]
Include = /etc/pacman.d/mirrorlist-arch
#[multilib]
#Include = /etc/pacman.d/mirrorlist-arch
EOF
fi
else
echo > /dev/null 2>&1
fi
}
greppkg(){ pkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[5][^,]*," | sed '/^W/d' | sed 's/^.*,//g' > "$pkg" ;}
grepworkpkg(){ workpkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[5][^,]*," | grep "^W" | sed 's/^.*,//g' > "$workpkg" ;}
update(){
if [[ "$EUID" == 0 ]]; then
pacman -Syu --noconfirm 2>&1 | lognoc
else
sudo pacman -Syu --noconfirm 2>&1 | lognoc
fi
}
install(){
if [[ "$EUID" == 0 ]]; then
pacman -S "$@" --needed --noconfirm --ask 4 2>&1 | lognoc
else
sudo pacman -S "$@" --needed --noconfirm --ask 4 2>&1 | lognoc
fi
}
uninstall(){
if [[ "$EUID" == 0 ]]; then
pacman -Rcs "$@" --noconfirm 2>&1 | lognoc
else
sudo pacman -Rcs "$@" --noconfirm 2>&1 | lognoc
fi
}
# installvirtualbox(){
# update 2>&1 | lognoc && install virtualbox linux-headers 2>&1 | lognoc
# version=$(VBoxManage -v | sed 's/r[0-9a-b]*//') && wget "https://download.virtualbox.org/virtualbox/${version}/Oracle_VM_VirtualBox_Extension_Pack-${version}.vbox-extpack"
# yes | VBoxManage extpack install --replace Oracle_VM_VirtualBox_Extension_Pack-"${version}".vbox-extpack && rm -f Oracle_VM_VirtualBox_Extension_Pack-"${version}".vbox-extpack
# }
installkvm(){
update 2>&1 | lognoc && install edk2-ovmf swtpm qemu dmidecode virt-manager virt-viewer dnsmasq vde2 bridge-utils openbsd-netcat iptables-nft libguestfs firewalld 2>&1 | lognoc
sudo sed -i 's/^#unix_sock_group = "libvirt"/unix_sock_group = "libvirt"/' /etc/libvirt/libvirtd.conf 2>&1 | lognoc
sudo sed -i 's/^#unix_sock_rw_perms = "0770"/unix_sock_rw_perms = "0770"/' /etc/libvirt/libvirtd.conf 2>&1 | lognoc
sudo usermod -a -G libvirt "$(whoami)" 2>&1 | lognoc
if [[ "$initSystem" == "openrc" ]]; then install libvirt-openrc 2>&1 | lognoc; fi
if [[ "$initSystem" == "runit" ]]; then install libvirt-runit 2>&1 | lognoc; fi
if [[ "$initSystem" == "s6" ]]; then install libvirt-s6 2>&1 | lognoc; fi
if [[ "$initSystem" == "suite66" ]]; then install libvirt-suite66 2>&1 | lognoc; fi
enableSvc libvirtd 2>&1 | lognoc && startSvc libvirtd 2>&1 | lognoc
}
elif type xbps-install > /dev/null 2>&1; then
setupcustomrepos(){ echo > /dev/null 2>&1 ;}
greppkg(){ pkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[9][^,]*," | sed '/^W/d' | sed 's/^.*,//g' > "$pkg" ;}
grepworkpkg(){ workpkg=$(mktemp) && sed '/^#/d' "$HOME"/apps.csv | grep "[9][^,]*," | grep "^W" | sed 's/^.*,//g' > "$workpkg" ;}
update(){
if [[ "$EUID" == 0 ]]; then
xbps-install -Syu 2>&1 | lognoc
else
sudo xbps-install -Syu 2>&1 | lognoc
fi
}
install(){
if [[ "$EUID" == 0 ]]; then
xbps-install -Sy "$@" 2>&1 | lognoc
else
sudo xbps-install -Sy "$@" 2>&1 | lognoc
fi
}
uninstall(){
if [[ "$EUID" == 0 ]]; then
xbps-remove -Roy "$@" 2>&1 | lognoc
else
sudo xbps-remove -Roy "$@" 2>&1 | lognoc
fi
}
# installvirtualbox(){
# update 2>&1 | lognoc && install virtualbox-ose linux-headers 2>&1 | lognoc
# version=$(VBoxManage -v | sed 's/r[0-9a-b]*//') && wget "https://download.virtualbox.org/virtualbox/${version}/Oracle_VM_VirtualBox_Extension_Pack-${version}.vbox-extpack"
# yes | VBoxManage extpack install --replace Oracle_VM_VirtualBox_Extension_Pack-"${version}".vbox-extpack && rm -f Oracle_VM_VirtualBox_Extension_Pack-"${version}".vbox-extpack
# }
installkvm(){
update 2>&1 | lognoc && install swtpm qemu dmidecode virt-manager virt-viewer dnsmasq vde2 bridge-utils openbsd-netcat iptables-nft libguestfs firewalld 2>&1 | lognoc
sudo sed -i 's/^#unix_sock_group = "libvirt"/unix_sock_group = "libvirt"/' /etc/libvirt/libvirtd.conf 2>&1 | lognoc
sudo sed -i 's/^#unix_sock_rw_perms = "0770"/unix_sock_rw_perms = "0770"/' /etc/libvirt/libvirtd.conf 2>&1 | lognoc
sudo usermod -a -G libvirt "$(whoami)" 2>&1 | lognoc
if [[ "$initSystem" == "openrc" ]]; then install libvirt-openrc 2>&1 | lognoc; fi
if [[ "$initSystem" == "runit" ]]; then install libvirt-runit 2>&1 | lognoc; fi
if [[ "$initSystem" == "s6" ]]; then install libvirt-s6 2>&1 | lognoc; fi
if [[ "$initSystem" == "suite66" ]]; then install libvirt-suite66 2>&1 | lognoc; fi
enableSvc libvirtd 2>&1 | lognoc && startSvc libvirtd 2>&1 | lognoc
}
fi
# Install packages
installsrvpkg(){ update 2>&1 | lognoc && while IFS= read -r line; do install "$line" 2>&1 | lognoc; done < "$srvpkg" ;}
installxcodecli(){
TOUCH=$(which touch)
echo -e "Searching online for the Command Line Tools" 2>&1 | logc
# This temporary file prompts the 'softwareupdate' utility to list the Command Line Tools
clt_placeholder="/tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress"
sudo "$TOUCH" "$clt_placeholder" 2>&1 | logc
clt_label_command="/usr/sbin/softwareupdate -l |
grep -B 1 -E 'Command Line Tools' |
awk -F'*' '/^ *\\*/ {print \$2}' |
sed -e 's/^ *Label: //' -e 's/^ *//' |
sort -V |
tail -n1"
clt_label="$(printf "%s" "${1/"$'\n'"/}" "$(/bin/bash -c "$clt_label_command")")"
if [[ -n "$clt_label" ]]; then
echo -e "Installing $clt_label"
sudo "/usr/sbin/softwareupdate" "-i" "$clt_label" 2>&1 | logc
sudo "/bin/rm" "-f" "$clt_placeholder" 2>&1 | logc
sudo "/usr/bin/xcode-select" "--switch" "/Library/Developer/CommandLineTools" 2>&1 | logc
fi
}
installhomebrew(){
/bin/bash -c "$(curl -fsSL "$homebrew")" 2>&1 | logc
brew doctor 2>&1 | lognoc
brew update 2>&1 | lognoc
}
installsudo(){
update 2>&1 | lognoc && install sudo 2>&1 | lognoc
if ! grep '^\%wheel ALL=(ALL) ALL' /etc/sudoers > /dev/null 2>&1 && ! grep '^\%sudo ALL=(ALL) ALL' /etc/sudoers; then
if grep '^\@includedir /etc/sudoers.d' /etc/sudoers > /dev/null 2>&1; then
if [[ ! -d /etc/sudoers.d ]]; then mkdir -pv /etc/sudoers.d 2>&1 | lognoc; fi
touch /etc/sudoers.d/99-wheel && echo "%wheel ALL=(ALL) ALL" > /etc/sudoers.d/99-wheel
else
sed -i 's/^#\ \%wheel ALL=(ALL) ALL/\%wheel ALL=(ALL) ALL/' /etc/sudoers
fi
fi
}
installpkg(){ update 2>&1 | lognoc && while IFS= read -r line; do install "$line" 2>&1 | lognoc; done < "$pkg" ;}
installguipkg(){ update 2>&1 | lognoc && while IFS= read -r line; do installgui "$line" 2>&1 | lognoc; done < "$guipkg" ;}
installworkpkg(){ update 2>&1 | lognoc && while IFS= read -r line; do install "$line" 2>&1 | lognoc; done < "$workpkg" ;}
installworkguipkg(){ update 2>&1 | lognoc && while IFS= read -r line; do install "$line" 2>&1 | lognoc; done < "$workguipkg" ;}
installaurhelper(){
sudo pacman -Sy 2>&1 | lognoc
sudo pacman -S git base-devel --needed --noconfirm 2>&1 | lognoc
git clone --depth 1 "$aurhelper" "$HOME"/yay 2>&1 | lognoc
cd "$HOME"/yay && makepkg -si --noconfirm --needed 2>&1 | lognoc
cd "$HOME" || exit
rm -Rf "$HOME"/yay
}
installaurpkg(){ while IFS= read -r line; do installaur "$line" 2>&1 | lognoc; done < "$aurpkg" ;}
installsnappkg(){ while IFS= read -r line; do installsnap "$line" 2>&1 | lognoc; done < "$snappkg" ;}
installworkaurpkg(){ while IFS= read -r line; do installaur "$line" 2>&1 | lognoc; done < "$workaurpkg" ;}
installworksnappkg(){ while IFS= read -r line; do installsnap "$line" 2>&1 | lognoc; done < "$worksnappkg" ;}
installxpkg(){ update 2>&1 | lognoc && while IFS= read -r line; do install "$line" 2>&1 | lognoc; done < "$archxpkg" ;}
installvoidxpkg(){ update 2>&1 | lognoc && enableSvc dbus 2>&1 | lognoc && while IFS= read -r line; do install "$line" 2>&1 | lognoc; done < "$voidxpkg" ;}
installjetbrainsmono(){ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/JetBrains/JetBrainsMono/master/install_manual.sh)" ;}
installgitrepo(){ if [[ ! -d "$gitrepoloc" ]]; then mkdir -pv "$gitrepoloc" > /dev/null 2>&1; fi && if type git > /dev/null 2>&1; then < "$repo" xargs -n1 -I url git -C "$gitrepoloc" clone --depth 1 url 2>&1 | lognoc; fi ;}
installworkgitrepo(){ if [[ ! -d "$gitrepoloc" ]]; then mkdir -pv "$gitrepoloc" > /dev/null 2>&1; fi && if type git > /dev/null 2>&1; then < "$workrepo" xargs -n1 -I url git -C "$gitrepoloc" clone --depth 1 url 2>&1 | lognoc; fi ;}
installdirectdl(){
cd "$ddloc" || exit
< "$ddl" xargs -I xxx sudo curl -skLO xxx 2>&1 | lognoc
sudo chmod +x ./* 2>&1 | lognoc
cd "$HOME" || exit
}
installworkdirectdl(){
cd "$ddloc" || exit
< "$workddl" xargs -I xxx sudo curl -skLO xxx 2>&1 | lognoc
sudo chmod +x ./* 2>&1 | lognoc
cd "$HOME" || exit
}
if [[ "$initSystem" == "openrc" ]]; then
installopenrcpkg(){ update 2>&1 | lognoc && while IFS= read -r line; do install "$line" 2>&1 | lognoc; done < "$openrcpkg" ;}
installopenrcworkpkg(){ update 2>&1 | lognoc && while IFS= read -r line; do install "$line" 2>&1 | lognoc; done < "$openrcworkpkg" ;}
elif [[ "$initSystem" == "runit" ]]; then
installrunitpkg(){ update 2>&1 | lognoc && while IFS= read -r line; do install "$line" 2>&1 | lognoc; done < "$runitpkg" ;}
installrunitworkpkg(){ update 2>&1 | lognoc && while IFS= read -r line; do install "$line" 2>&1 | lognoc; done < "$runitworkpkg" ;}
elif [[ "$initSystem" == "s6" ]]; then
installrunitpkg(){ update 2>&1 | lognoc && while IFS= read -r line; do install "$line" 2>&1 | lognoc; done < "$s6pkg" ;}
installrunitworkpkg(){ update 2>&1 | lognoc && while IFS= read -r line; do install "$line" 2>&1 | lognoc; done < "$s6workpkg" ;}
elif [[ "$initSystem" == "suite66" ]]; then
installrunitpkg(){ update 2>&1 | lognoc && while IFS= read -r line; do install "$line" 2>&1 | lognoc; done < "$suite66pkg" ;}
installrunitworkpkg(){ update 2>&1 | lognoc && while IFS= read -r line; do install "$line" 2>&1 | lognoc; done < "$suite66workpkg" ;}
fi
installzsh(){
install zsh 2>&1 | lognoc
if [[ "$OSTYPE" == "darwin"* ]]; then
chmod g-w "$(brew --prefix)/share" 2>&1 | lognoc
chmod g-w "$(brew --prefix)/share/zsh" 2>&1 | lognoc
chmod g-w "$(brew --prefix)/share/zsh/sites-functions" 2>&1 | lognoc
else
getsudo
update 2>&1 | lognoc && install zsh 2>&1 | lognoc
fi
git clone --depth 1 https://github.com/zplug/zplug "$HOME"/.config/zsh/zplug 2>&1 | lognoc
}
installvideodriver(){
case "$(lspci -v | grep -A1 -e VGA -e 3D)" in
*NVIDIA*) install xf86-video-nouveau 2>&1 | lognoc ;;
*AMD*) install xf86-video-amdgpu 2>&1 | lognoc ;;
*Intel*) install xf86-video-intel intel-media-driver 2>&1 | lognoc ;;
*) install xf86-video-fbdev 2>&1 | lognoc ;;
esac
}
installperldeps(){
perlx=$(find "$gitrepoloc" -maxdepth 3 -perm -111 -type f -name '*.pl')
# Nikto
if [[ "$perlx" =~ nikto.pl ]]; then
if ! perl -MNet::SSLeay -e 1 > /dev/null 2>&1; then
if type apt-get > /dev/null 2>&1; then
update 2>&1 | lognoc && install libnet-ssleay-perl 2>&1 | lognoc
elif type cpanm > /dev/null 2>&1; then
sudo cpanm Net::SSLeay 2>&1 | lognoc
fi
fi
fi
}
installpythondeps(){
pythonx=$(find "$gitrepoloc" -maxdepth 3 -perm -111 -type f -name '*.py')
if type pip > /dev/null 2>&1 && ! type virtualenv > /dev/null 2>&1; then
# Virtual Environment
pip install virtualenv 2>&1 | lognoc
elif type pip3 > /dev/null 2>&1 && ! type virtualenv > /dev/null 2>&1; then
pip3 install virtualenv 2>&1 | lognoc
fi
if type pip > /dev/null 2>&1 && [[ "$pythonx" =~ vxapi.py ]]; then
# VxAPI
pip install requests colorama 2>&1 | lognoc
elif type pip3 > /dev/null 2>&1 && [[ "$pythonx" =~ vxapi.py ]]; then
pip3 install requests colorama 2>&1 | lognoc
fi
}
setupkeyring(){
if ! grep '^auth[ \t]*optional[ \t]*pam_gnome_keyring.so$' /etc/pam.d/login > /dev/null 2>&1; then
sudo awk -i inplace 'FNR==NR{ if (/auth/) p=NR; next} 1; FNR==p{ print "auth optional pam_gnome_keyring.so" }' /etc/pam.d/login /etc/pam.d/login 2>&1 | lognoc
fi
if ! grep '^session[ \t]*optional[ \t]*pam_gnome_keyring.so auto_start$' /etc/pam.d/login > /dev/null 2>&1; then
sudo awk -i inplace 'FNR==NR{ if (/session/) p=NR; next} 1; FNR==p{ print "session optional pam_gnome_keyring.so auto_start" }' /etc/pam.d/login /etc/pam.d/login 2>&1 | lognoc
fi
}
installxinitrc(){
if [[ -f "$HOME"/.xinitrc ]]; then
if [[ ! -d "$dfloc" ]]; then git clone --depth 1 "$dfrepo" "$dfloc" 2>&1 | lognoc ; else git -C "$dfloc" pull 2>&1 | lognoc ; fi
mv "$HOME"/.xinitrc "$HOME"/.xinitrc.orig > /dev/null 2>&1
ln -sf "$dfloc"/config/X11/xinitrc "$HOME"/.xinitrc 2>&1 | lognoc
else
if [[ ! -d "$dfloc" ]]; then git clone --depth 1 "$dfrepo" "$dfloc" 2>&1 | lognoc ; else git -C "$dfloc" pull 2>&1 | lognoc ; fi
ln -sf "$dfloc"/config/X11/xinitrc "$HOME"/.xinitrc 2>&1 | lognoc
fi
}
installgreeter(){
install lightdm lightdm-slick-greeter 2>&1 | lognoc
if [[ "$initSystem" == "openrc" ]]; then install lightdm-openrc 2>&1 | lognoc; fi
if [[ "$initSystem" == "runit" ]]; then install lightdm-runit 2>&1 | lognoc; fi
if [[ "$initSystem" == "s6" ]]; then install lightdm-s6 2>&1 | lognoc; fi
if [[ "$initSystem" == "suite66" ]]; then install lightdm-suite66 2>&1 | lognoc; fi
if [[ -f "$HOME"/.xprofile ]]; then
if [[ ! -d "$dfloc" ]]; then git clone --depth 1 "$dfrepo" "$dfloc" 2>&1 | lognoc ; else git -C "$dfloc" pull 2>&1 | lognoc ; fi
mv "$HOME"/.xprofile "$HOME"/.xprofile.orig > /dev/null 2>&1
ln -sf "$dfloc"/config/X11/xprofile "$HOME"/.xprofile 2>&1 | lognoc
else
if [[ ! -d "$dfloc" ]]; then git clone --depth 1 "$dfrepo" "$dfloc" 2>&1 | lognoc ; else git -C "$dfloc" pull 2>&1 | lognoc ; fi
ln -sf "$dfloc"/config/X11/xprofile "$HOME"/.xprofile 2>&1 | lognoc
fi
sudo cp -f "$dfloc"/config/X11/lightdm/* /etc/lightdm/ 2>&1 | lognoc
if [[ -f "$HOME"/.xprofile ]]; then enableSvc lightdm 2>&1 | lognoc ; fi
}
installdwm(){
if [[ -d "$dwmloc" ]]; then sudo rm -Rf "$dwmloc" > /dev/null 2>&1 ; fi
sudo git clone --depth 1 "$dwmrepo" "$dwmloc" > /dev/null 2>&1
sudo make -C "$dwmloc" clean install > /dev/null 2>&1
if [[ ! -d /usr/share/xsessions ]]; then sudo mkdir -pv /usr/share/xsessions > /dev/null 2>&1 ; fi
if [[ -d /usr/share/xbps.d ]]; then
sudo cp -rf "$dwmloc"/statusbar-txt/* /usr/local/sbin/ > /dev/null 2>&1
else
sudo cp -rf "$dwmloc"/statusbar/* /usr/local/sbin/ > /dev/null 2>&1
fi
sudo cp -f "$dwmloc"/dwm.desktop /usr/share/xsessions/ > /dev/null 2>&1
}
installdmenu(){
if [[ -d "$dmenuloc" ]]; then sudo rm -Rf "$dmenuloc" > /dev/null 2>&1 ; fi
sudo git clone --depth 1 "$dmenurepo" "$dmenuloc" > /dev/null 2>&1
sudo make -C "$dmenuloc" clean install > /dev/null 2>&1
}
installsent(){
if [[ -d "$sentloc" ]]; then sudo rm -Rf "$sentloc" > /dev/null 2>&1; fi
sudo git clone --depth 1 "$sentrepo" "$sentloc" > /dev/null 2>&1
sudo make -C "$sentloc" clean install > /dev/null 2>&1
}
installst(){
if [[ -d "$stloc" ]]; then sudo rm -Rf "$stloc" > /dev/null 2>&1; fi
sudo git clone --depth 1 "$strepo" "$stloc" > /dev/null 2>&1
sudo make -C "$stloc" clean install > /dev/null 2>&1
sudo cp -f "$stloc"/st-* /usr/local/sbin/ > /dev/null 2>&1
sudo cp -f "$stloc"/st.desktop /usr/share/applications/ > /dev/null 2>&1
}
installslock(){
if [[ -d "$slockloc" ]]; then sudo rm -Rf "$slockloc" > /dev/null 2>&1; fi
sudo git clone --depth 1 "$slockrepo" "$slockloc" > /dev/null 2>&1
sudo make -C "$slockloc" clean install > /dev/null 2>&1
}
installsurf(){
if [[ -d "$surfloc" ]]; then sudo rm -Rf "$surfloc" > /dev/null 2>&1; fi
sudo git clone --depth 1 "$surfrepo" "$surfloc" > /dev/null 2>&1
if [[ ! -d "$HOME"/.config/surf/styles ]]; then mkdir -pv "$HOME"/.config/surf/styles > /dev/null 2>&1; fi
cp "$surfloc"/script.js "$HOME"/.config/surf/ > /dev/null 2>&1
cp -R "$surfloc"/styles/*.css "$HOME"/.config/surf/styles/ > /dev/null 2>&1
sudo make -C "$surfloc" clean install > /dev/null 2>&1
}
installbspwm(){
update 2>&1 | lognoc
if [[ -d /usr/share/xbps.d ]]; then install bspwm sxhkd polybar 2>&1 | lognoc ; fi
install bspwm sxhkd 2>&1 | lognoc
if ! pacman -Q polybar >/dev/null 2>&1; then yes "" | installaur polybar 2>&1 | lognoc ; fi
if [[ ! -d "$dfloc" ]]; then git clone --depth 1 "$dfrepo" "$dfloc" > /dev/null 2>&1 ; fi
if [[ ! -d "$HOME"/.config/bspwm ]]; then mkdir -pv "$HOME"/.config/bspwm > /dev/null 2>&1 ; fi
if [[ ! -d "$HOME"/.config/sxhkd ]]; then mkdir -pv "$HOME"/.config/sxhkd > /dev/null 2>&1 ; fi
ln -sf "$dfloc"/config/bspwm/* "$HOME"/.config/bspwm/ > /dev/null 2>&1
ln -sf "$dfloc"/config/sxhkd/* "$HOME"/.config/sxhkd/ > /dev/null 2>&1
}
installi3(){
update 2>&1 | lognoc
if [[ -d /usr/share/xbps.d ]]; then install i3-gaps polybar 2>&1 | lognoc ; fi
install i3-gaps 2>&1 | lognoc
if ! pacman -Q polybar >/dev/null 2>&1; then yes "" | installaur polybar 2>&1 | lognoc ; fi
if [[ ! -d "$dfloc" ]]; then git clone --depth 1 "$dfrepo" "$dfloc" > /dev/null 2>&1 ; fi
if [[ ! -d "$HOME"/.config/i3 ]]; then mkdir -pv "$HOME"/.config/i3 > /dev/null 2>&1 ; fi
ln -sf "$dfloc"/config/i3/* "$HOME"/.config/i3/ > /dev/null 2>&1
}
installopenbox(){
update 2>&1 | lognoc
install openbox menumaker tint2 2>&1 | lognoc
yes "" | installaur arc-dark-osx-openbox-theme-git 2>&1 | lognoc
if [[ ! -d "$dfloc" ]]; then git clone --depth 1 "$dfrepo" "$dfloc" > /dev/null 2>&1 ; fi
if [[ ! -d "$HOME"/.config/tint2 ]]; then mkdir -pv "$HOME"/.config/tint2 > /dev/null 2>&1 ; fi
ln -sf "$dfloc"/config/tint2/tint2rc "$HOME"/.config/tint2/ > /dev/null 2>&1
ln -sf "$dfloc"/config/openbox "$HOME"/.config/ > /dev/null 2>&1
}
installspectrwm(){
update 2>&1 | lognoc
if [[ -f /etc/arch-release ]] || [[ -f /etc/artix-release ]]; then
installaur spectrwm 2>&1 | lognoc
else
install spectrwm 2>&1 | lognoc
fi
if [[ ! -d "$dfloc" ]]; then git clone --depth 1 "$dfrepo" "$dfloc" > /dev/null 2>&1 ; fi
if [[ ! -d "$HOME"/.config/spectrwm ]]; then mkdir -pv "$HOME"/.config/spectrwm > /dev/null 2>&1 ; fi
ln -sf "$dfloc"/config/spectrwm/* "$HOME"/.config/spectrwm/ > /dev/null 2>&1
}
installxfce(){
update 2>&1 | lognoc
install xfce4 2>&1 | lognoc
yes "" | installaur pamac-aur 2>&1 | lognoc
uninstall dunst 2>&1 | lognoc
if [[ ! -d "$dfloc" ]]; then git clone --depth 1 "$dfrepo" "$dfloc" > /dev/null 2>&1 ; fi
ln -sf "$dfloc"/config/xfce4 "$HOME"/.config/ 2>&1 | lognoc
while read -p "Do you want to install the XFCE goodies/applications? (Y/n) " -n 1 -r; do
echo -e 2>&1 | logc
if [[ "$REPLY" =~ ^[Yy]$ ]]; then
echo -e "Installing XFCE goodies..." 2>&1 | logc
if [[ -d /usr/share/xbps.d ]]; then install xfce4-plugins 2>&1 | lognoc ; fi
install xfce4-goodies 2>&1 | lognoc
echo -e "XFCE goodies installed" 2>&1 | logc
break
elif [[ "$REPLY" =~ ^[Nn]$ ]]; then
echo -e 2>&1 | logc
break
fi
break
done
}
installkdeplasma(){
update 2>&1 | lognoc
if [[ -d /usr/share/xbps.d ]]; then install kde5 2>&1 | lognoc ; fi
install plasma sddm sddm-kcm packagekit-qt5 2>&1 | lognoc
yes "" | installaur pamac-aur 2>&1 | lognoc
uninstall dunst 2>&1 | lognoc
if [[ "$initSystem" == "openrc" ]]; then install sddm-openrc 2>&1 | lognoc; fi
if [[ "$initSystem" == "runit" ]]; then install sddm-runit 2>&1 | lognoc; fi
if [[ "$initSystem" == "s6" ]]; then install sddm-s6 2>&1 | lognoc; fi
if [[ "$initSystem" == "suite66" ]]; then install sddm-suite66 2>&1 | lognoc; fi
installdmenu && installst && installsurf
enableSvc sddm -f 2>&1 | lognoc
while read -p "Do you want to install the KDE applications? (Y/n) " -n 1 -r; do
echo -e 2>&1 | logc
if [[ "$REPLY" =~ ^[Yy]$ ]]; then
echo -e "Installing KDE applications..." 2>&1 | logc
if [[ -d /usr/share/xbps.d ]]; then install kde5-baseapps 2>&1 | lognoc ; fi
install kde-applications 2>&1 | lognoc
echo -e "KDE applications installed" 2>&1 | logc
break
elif [[ "$REPLY" =~ ^[Nn]$ ]]; then
break
fi
break
done
}
installfonts(){
install fontconfig 2>&1 | lognoc
mkdir -pv "$HOME"/fonts 2>&1 | lognoc
if type wget > /dev/null 2>&1; then
wget -c --content-disposition -P "$HOME"/fonts/ "$symbols_nerd" 2>&1 | lognoc
wget -c --content-disposition -P "$HOME"/fonts/ "$mononoki_regular" 2>&1 | lognoc
wget -c --content-disposition -P "$HOME"/fonts/ "$mononoki_bold" 2>&1 | lognoc
wget -c --content-disposition -P "$HOME"/fonts/ "$mononoki_italic" 2>&1 | lognoc
wget -c --content-disposition -P "$HOME"/fonts/ "$fontawesome_brands" 2>&1 | lognoc
wget -c --content-disposition -P "$HOME"/fonts/ "$fontawesome_regular" 2>&1 | lognoc
wget -c --content-disposition -P "$HOME"/fonts/ "$fontawesome_solid" 2>&1 | lognoc
elif type curl > /dev/null 2>&1; then
cd "$HOME"/fonts || exit
curl -fSLO "$symbols_nerd" 2>&1 | lognoc
curl -fSLO "$mononoki_regular" 2>&1 | lognoc
curl -fSLO "$mononoki_bold" 2>&1 | lognoc
curl -fSLO "$mononoki_italic" 2>&1 | lognoc
curl -fSLO "$fontawesome_brands" 2>&1 | lognoc
curl -fSLO "$fontawesome_regular" 2>&1 | lognoc
curl -fSLO "$fontawesome_solid" 2>&1 | lognoc
for i in *; do mv "$i" "$(echo "$i" | sed 's/%20/ /g')"; done
fi
if [[ "$OSTYPE" == "darwin"* ]]; then
mv "$HOME"/fonts/*.ttf "$HOME"/Library/Fonts/ 2>&1 | lognoc
mv "$HOME"/fonts/*.otf "$HOME"/Library/Fonts/ 2>&1 | lognoc
elif [[ "$OSTYPE" == "linux-gnu" ]]; then
if [[ ! -d /usr/share/fonts/TTF ]]; then
sudo mkdir -pv /usr/share/fonts/TTF 2>&1 | lognoc
fi
if type fc-cache > /dev/null 2>&1; then
sudo mv -n "$HOME"/fonts/*.ttf /usr/share/fonts/TTF/ | lognoc
sudo mv -n "$HOME"/fonts/*.otf /usr/share/fonts/TTF/ | lognoc
fc-cache -f -v 2>&1 | lognoc
else
echo -e "Please install a font configuration handler such as 'fontconfig'!" 2>&1 | logc
exit 1
fi
fi
git clone --depth 1 "$powerline_fonts" "$HOME"/fonts_powerline 2>&1 | lognoc && "$HOME"/fonts_powerline/install.sh 2>&1 | lognoc
cd "$HOME" || exit
rm -Rf "$HOME"/fonts* > /dev/null 2>&1
}
# System configuration
getwallpapers(){
if [[ ! -d "$HOME/.local/share" ]]; then mkdir -pv "$HOME"/.local/share 2>&1 | lognoc; fi
git clone --depth 1 "$wallpapers" "$wallpapersloc" 2>&1 | lognoc
}
gethostname(){
if { [[ -z "$SSH_CLIENT" ]] || [[ -z "$SSH_TTY" ]] ;} && [[ "$OSTYPE" == "darwin"* ]]; then
computername=$(scutil --get ComputerName)
elif { [[ -z "$SSH_CLIENT" ]] || [[ -z "$SSH_TTY" ]] ;} && [[ "$OSTYPE" == "linux-gnu" ]]; then
computername=$(cat /etc/hostname)
fi
}
getdotfiles(){
git clone --depth 1 "$dfrepo" "$dfloc" 2>&1 | lognoc
git -C "$dfloc" submodule foreach --recursive git checkout master 2>&1 | lognoc