forked from helmuthdu/aui
-
Notifications
You must be signed in to change notification settings - Fork 1
/
lilo
executable file
·3050 lines (3039 loc) · 103 KB
/
lilo
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
#!/bin/bash
#-------------------------------------------------------------------------------
#Created by helmuthdu mailto: helmuthdu[at]gmail[dot]com
#Contribution: flexiondotorg
#-------------------------------------------------------------------------------
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
#-------------------------------------------------------------------------------
# Run this script after your first boot with archlinux (as root)
if [[ -f `pwd`/sharedfuncs ]]; then
source sharedfuncs
else
echo "missing file: sharedfuncs"
exit 1
fi
#ARCHLINUX U INSTALL {{{
#WELCOME {{{
welcome(){
clear
echo -e "${Bold}Welcome to the Archlinux U Install script by helmuthdu${White}"
print_line
echo "Requirements:"
echo "-> Archlinux installation"
echo "-> Run script as root user"
echo "-> Working internet connection"
print_line
echo "Script can be cancelled at any time with CTRL+C"
print_line
echo "http://www.github.com/helmuthdu/aui"
print_line
echo -e "\nBackups:"
print_line
# backup old configs
[[ ! -f /etc/pacman.conf.aui ]] && cp -v /etc/pacman.conf /etc/pacman.conf.aui || echo "/etc/pacman.conf.aui";
[[ -f /etc/ssh/sshd_config.aui ]] && echo "/etc/ssh/sshd_conf.aui";
[[ -f /etc/sudoers.aui ]] && echo "/etc/sudoers.aui";
pause_function
echo ""
}
#}}}
#LOCALE SELECTOR {{{
language_selector(){
#AUTOMATICALLY DETECTS THE SYSTEM LOCALE {{{
#automatically detects the system language based on your locale
LOCALE=`locale | grep LANG | sed 's/LANG=//' | cut -c1-5`
#KDE #{{{
if [[ $LOCALE == pt_BR || $LOCALE == en_GB || $LOCALE == zh_CN ]]; then
LOCALE_KDE=`echo $LOCALE | tr '[:upper:]' '[:lower:]'`
else
LOCALE_KDE=`echo $LOCALE | cut -d\_ -f1`
fi
#}}}
#FIREFOX #{{{
if [[ $LOCALE == pt_BR || $LOCALE == pt_PT || $LOCALE == en_GB || $LOCALE == en_US || $LOCALE == es_AR || $LOCALE == es_CL || $LOCALE == es_ES || $LOCALE == zh_CN ]]; then
LOCALE_FF=`echo $LOCALE | tr '[:upper:]' '[:lower:]' | sed 's/_/-/'`
else
LOCALE_FF=`echo $LOCALE | cut -d\_ -f1`
fi
#}}}
#THUNDERBIRD #{{{
if [[ $LOCALE == pt_BR || $LOCALE == pt_PT || $LOCALE == en_US || $LOCALE == en_GB || $LOCALE == es_AR || $LOCALE == es_ES || $LOCALE == zh_CN ]]; then
LOCALE_TB=`echo $LOCALE | tr '[:upper:]' '[:lower:]' | sed 's/_/-/'`
elif [[ $LOCALE == es_CL ]]; then
LOCALE_TB="es-es"
else
LOCALE_TB=`echo $LOCALE | cut -d\_ -f1`
fi
#}}}
#HUNSPELL #{{{
if [[ $LOCALE == pt_BR ]]; then
LOCALE_HS=`echo $LOCALE | tr '[:upper:]' '[:lower:]' | sed 's/_/-/'`
elif [[ $LOCALE == pt_PT ]]; then
LOCALE_HS="pt_pt"
else
LOCALE_HS=`echo $LOCALE | cut -d\_ -f1`
fi
#}}}
#ASPELL #{{{
LOCALE_AS=`echo $LOCALE | cut -d\_ -f1`
#}}}
#LIBREOFFICE #{{{
if [[ $LOCALE == pt_BR || $LOCALE == en_GB || $LOCALE == en_US || $LOCALE == zh_CN ]]; then
LOCALE_LO=`echo $LOCALE | sed 's/_/-/'`
else
LOCALE_LO=`echo $LOCALE | cut -d\_ -f1`
fi
#}}}
#}}}
print_title "LOCALE - https://wiki.archlinux.org/index.php/Locale"
print_info "Locales are used in Linux to define which language the user uses. As the locales define the character sets being used as well, setting up the correct locale is especially important if the language contains non-ASCII characters."
read -p "Default system language: \"$LOCALE\" [Y/n]: " OPTION
case "$OPTION" in
"n")
while [[ $OPTION != y ]]; do
setlocale
read_input_text "Confirm locale ($LOCALE)"
done
sed -i '/'${LOCALE}'/s/^#//' /etc/locale.gen
locale-gen
localectl set-locale LANG=${LOCALE_UTF8}
#KDE #{{{
if [[ $LOCALE == pt_BR || $LOCALE == en_GB || $LOCALE == zh_CN ]]; then
LOCALE_KDE=`echo $LOCALE | tr '[:upper:]' '[:lower:]'`
else
LOCALE_KDE=`echo $LOCALE | cut -d\_ -f1`
fi
#}}}
#FIREFOX #{{{
if [[ $LOCALE == pt_BR || $LOCALE == pt_PT || $LOCALE == en_GB || $LOCALE == en_US || $LOCALE == es_AR || $LOCALE == es_CL || $LOCALE == es_ES || $LOCALE == zh_CN ]]; then
LOCALE_FF=`echo $LOCALE | tr '[:upper:]' '[:lower:]' | sed 's/_/-/'`
else
LOCALE_FF=`echo $LOCALE | cut -d\_ -f1`
fi
#}}}
#THUNDERBIRD #{{{
if [[ $LOCALE == pt_BR || $LOCALE == pt_PT || $LOCALE == en_US || $LOCALE == en_GB || $LOCALE == es_AR || $LOCALE == es_ES || $LOCALE == zh_CN ]]; then
LOCALE_TB=`echo $LOCALE | tr '[:upper:]' '[:lower:]' | sed 's/_/-/'`
elif [[ $LOCALE == es_CL ]]; then
LOCALE_TB="es-es"
else
LOCALE_TB=`echo $LOCALE | cut -d\_ -f1`
fi
#}}}
#HUNSPELL #{{{
if [[ $LOCALE == pt_BR ]]; then
LOCALE_HS=`echo $LOCALE | tr '[:upper:]' '[:lower:]' | sed 's/_/-/'`
elif [[ $LOCALE == pt_PT ]]; then
LOCALE_HS="pt_pt"
else
LOCALE_HS=`echo $LOCALE | cut -d\_ -f1`
fi
#}}}
#ASPELL #{{{
LOCALE_AS=`echo $LOCALE | cut -d\_ -f1`
#}}}
#LIBREOFFICE #{{{
if [[ $LOCALE == pt_BR || $LOCALE == en_GB || $LOCALE == en_US || $LOCALE == zh_CN ]]; then
LOCALE_LO=`echo $LOCALE | sed 's/_/-/'`
else
LOCALE_LO=`echo $LOCALE | cut -d\_ -f1`
fi
#}}}
;;
*)
;;
esac
}
#}}}
#SELECT/CREATE USER {{{
select_user(){
#CREATE NEW USER {{{
create_new_user(){
read -p "Username: " username
username=`echo $username | tr '[:upper:]' '[:lower:]'`
useradd -m -g users -G wheel -s /bin/bash ${username}
chfn ${username}
passwd ${username}
while [[ $? -ne 0 ]]; do
passwd ${username}
done
pause_function
configure_user_account
}
#}}}
#CONFIGURE USER ACCOUNT {{{
configure_user_account(){
#BASHRC {{{
print_title "BASHRC - https://wiki.archlinux.org/index.php/Bashrc"
bashrc_list=("Get helmuthdu .bashrc from github" "Vanilla .bashrc" "Get personal .bashrc from github");
PS3="$prompt1"
echo -e "Choose your .bashrc\n"
select OPT in "${bashrc_list[@]}"; do
case "$REPLY" in
1)
package_install "git"
package_install "colordiff"
git clone https://github.com/helmuthdu/dotfiles
cp dotfiles/.bashrc dotfiles/.dircolors dotfiles/.dircolors_256 dotfiles/.nanorc dotfiles/.yaourtrc ~/
cp dotfiles/.bashrc dotfiles/.dircolors dotfiles/.dircolors_256 dotfiles/.nanorc dotfiles/.yaourtrc /home/${username}/
rm -fr dotfiles
;;
2)
cp /etc/skel/.bashrc /home/${username}
;;
3)
package_install "git"
read -p "Enter your github username [ex: helmuthdu]: " GITHUB_USER
read -p "Enter your github repository [ex: aui]: " GITHUB_REPO
git clone https://github.com/$GITHUB_USER/$GITHUB_REPO
cp -R $GITHUB_REPO/.* /home/${username}/
rm -fr $GITHUB_REPO
;;
*)
invalid_option
;;
esac
[[ -n $OPT ]] && break
done
#}}}
#EDITOR {{{
print_title "DEFAULT EDITOR"
editors_list=("emacs" "nano" "vi" "vim" "neovim" "zile");
PS3="$prompt1"
echo -e "Select editor\n"
select EDITOR in "${editors_list[@]}"; do
if contains_element "$EDITOR" "${editors_list[@]}"; then
if [[ $EDITOR == vim || $EDITOR == neovim ]]; then
[[ $EDITOR == vim ]] && (! is_package_installed "gvim" && package_install "vim ctags") || package_install "neovim python2-neovim python-neovim"
#VIMRC {{{
if [[ ! -f /home/${username}/.vimrc ]]; then
vimrc_list=("Get helmuthdu .vimrc from github" "Vanilla .vimrc" "Get personal .vimrc from github");
PS3="$prompt1"
echo -e "Choose your .vimrc\n"
select OPT in "${vimrc_list[@]}"; do
case "$REPLY" in
1)
package_install "git"
git clone https://github.com/helmuthdu/vim /home/${username}/.vim
ln -sf /home/${username}/.vim/vimrc /home/${username}/.vimrc
cp -R vim /home/${username}/.vim/fonts /home/${username}/.fonts
GRUVBOX_NEEDED=1
;;
3)
package_install "git"
read -p "Enter your github username [ex: helmuthdu]: " GITHUB_USER
read -p "Enter your github repository [ex: vim]: " GITHUB_REPO
git clone https://github.com/$GITHUB_USER/$GITHUB_REPO
cp -R $GITHUB_REPO/.vim /home/${username}/
if [[ -f $GITHUB_REPO/vimrc ]]; then
ln -sf /home/${username}/.vim/vimrc /home/${username}/.vimrc
else
ln -sf /home/${username}/.vim/.vimrc /home/${username}/.vimrc
fi
rm -fr $GITHUB_REPO
;;
2)
echo "Nothing to do..."
;;
*)
invalid_option
;;
esac
[[ -n $OPT ]] && break
done
fi
if [[ $EDITOR == neovim && ! -f /home/${username}/.config/nvim ]]; then
mkdir ~/.config
ln -s ~/.vim ~/.config/nvim
ln -s ~/.vimrc ~/.config/nvim/init.vim
fi
#}}}
else
package_install "$EDITOR"
fi
break
else
invalid_option
fi
done
#}}}
chown -R ${username}:users /home/${username}
}
#}}}
print_title "SELECT/CREATE USER - https://wiki.archlinux.org/index.php/Users_and_Groups"
users_list=(`cat /etc/passwd | grep "/home" | cut -d: -f1`);
PS3="$prompt1"
echo "Avaliable Users:"
if [[ $(( ${#users_list[@]} )) -gt 0 ]]; then
print_warning "WARNING: THE SELECTED USER MUST HAVE SUDO PRIVILEGES"
else
echo ""
fi
select OPT in "${users_list[@]}" "Create new user"; do
if [[ $OPT == "Create new user" ]]; then
create_new_user
elif contains_element "$OPT" "${users_list[@]}"; then
username=$OPT
else
invalid_option
fi
[[ -n $OPT ]] && break
done
[[ ! -f /home/${username}/.bashrc ]] && configure_user_account;
if [[ -n "$http_proxy" ]]; then
echo "proxy = $http_proxy" > /home/${username}/.curlrc
chown ${username}:users /home/${username}/.curlrc
fi
}
#}}}
#CONFIGURE SUDO {{{
configure_sudo(){
if ! is_package_installed "sudo" ; then
print_title "SUDO - https://wiki.archlinux.org/index.php/Sudo"
package_install "sudo"
fi
#CONFIGURE SUDOERS {{{
if [[ ! -f /etc/sudoers.aui ]]; then
cp -v /etc/sudoers /etc/sudoers.aui
## Uncomment to allow members of group wheel to execute any command
sed -i '/%wheel ALL=(ALL) ALL/s/^#//' /etc/sudoers
## Same thing without a password (not secure)
#sed -i '/%wheel ALL=(ALL) NOPASSWD: ALL/s/^#//' /etc/sudoers
#This config is especially helpful for those using terminal multiplexers like screen, tmux, or ratpoison, and those using sudo from scripts/cronjobs:
echo "" >> /etc/sudoers
echo 'Defaults !requiretty, !tty_tickets, !umask' >> /etc/sudoers
echo 'Defaults visiblepw, path_info, insults, lecture=always' >> /etc/sudoers
echo 'Defaults loglinelen=0, logfile =/var/log/sudo.log, log_year, log_host, syslog=auth' >> /etc/sudoers
echo 'Defaults passwd_tries=3, passwd_timeout=1' >> /etc/sudoers
echo 'Defaults env_reset, always_set_home, set_home, set_logname' >> /etc/sudoers
echo 'Defaults !env_editor, editor="/usr/bin/vim:/usr/bin/vi:/usr/bin/nano"' >> /etc/sudoers
echo 'Defaults timestamp_timeout=15' >> /etc/sudoers
echo 'Defaults passprompt="[sudo] password for %u: "' >> /etc/sudoers
echo 'Defaults lecture=never' >> /etc/sudoers
fi
#}}}
}
#}}}
#AUR HELPER {{{
choose_aurhelper(){
print_title "AUR HELPER - https://wiki.archlinux.org/index.php/AUR_Helpers"
print_info "AUR Helpers are written to make using the Arch User Repository more comfortable."
print_warning "\tNone of these tools are officially supported by Arch devs."
aurhelper=("yaourt" "apacman" "pacaur")
PS3="$prompt1"
echo -e "Choose your default AUR helper to install\n"
select OPT in "${aurhelper[@]}"; do
case "$REPLY" in
1)
print_title "YAOURT - https://wiki.archlinux.org/index.php/Yaourt"
print_info "Yaourt (Yet AnOther User Repository Tool) is a community-contributed wrapper for pacman which adds seamless access to the AUR, allowing and automating package compilation and installation from your choice of the thousands of PKGBUILDs in the AUR, in addition to the many thousands of available Arch Linux binary packages."
if ! is_package_installed "yaourt" ; then
package_install "base-devel yajl namcap"
pacman -D --asdeps yajl namcap
aui_download_packages "package-query yaourt"
pacman -D --asdeps package-query
if ! is_package_installed "yaourt" ; then
echo "Yaourt not installed. EXIT now"
pause_function
exit 0
fi
fi
AUR_PKG_MANAGER="yaourt --tmp /var/tmp/"
;;
2)
if ! is_package_installed "apacman" ; then
package_install "base-devel git jshon"
pacman -D --asdeps jshon
aui_download_packages "apacman"
if ! is_package_installed "apacman" ; then
echo "Apacman not installed. EXIT now"
pause_function
exit 0
fi
fi
AUR_PKG_MANAGER="apacman"
;;
3)
if ! is_package_installed "pacaur" ; then
package_install "base-devel yajl expac"
pacman -D --asdeps yajl expac
add_key_user "hkp://pgp.mit.edu 1EB2638FF56C0C53"
aui_download_packages "cower pacaur"
pacman -D --asdeps cower
if ! is_package_installed "pacaur" ; then
echo "Pacaur not installed. EXIT now"
pause_function
exit 0
fi
fi
AUR_PKG_MANAGER="pacaur"
;;
*)
invalid_option
;;
esac
[[ -n $OPT ]] && break
done
pause_function
}
#}}}
#AUTOMODE {{{
automatic_mode(){
print_title "AUTOMODE"
print_info "Create a custom install with all options pre-selected.\nUse this option with care."
print_danger "\tUse this mode only if you already know all the option.\n\tYou won't be able to select anything later."
read_input_text "Enable Automatic Mode"
if [[ $OPTION == y ]]; then
$EDITOR ${AUI_DIR}/lilo.automode
source ${AUI_DIR}/lilo.automode
echo -e "The installation will start now."
pause_function
AUTOMATIC_MODE=1
fi
}
#}}}
#CUSTOM REPOSITORIES {{{
add_custom_repositories(){
print_title "CUSTOM REPOSITORIES - https://wiki.archlinux.org/index.php/Unofficial_User_Repositories"
read_input_text "Add custom repositories" $CUSTOMREPO
if [[ $OPTION == y ]]; then
while true
do
print_title "CUSTOM REPOSITORIES - https://wiki.archlinux.org/index.php/Unofficial_User_Repositories"
echo " 1) \"Add new repository\""
echo ""
echo " d) DONE"
echo ""
read -p "$prompt1" OPTION
case $OPTION in
1)
read -p "Repository Name [ex: custom]: " repository_name
read -p "Repository Address [ex: file:///media/backup/Archlinux]: " repository_addr
add_repository "${repository_name}" "${repository_addr}" "Never"
pause_function
;;
"d")
break
;;
*)
invalid_option
;;
esac
done
fi
}
#}}}
#BASIC SETUP {{{
install_basic_setup(){
print_title "BASH TOOLS - https://wiki.archlinux.org/index.php/Bash"
package_install "bc rsync mlocate bash-completion pkgstats arch-wiki-lite"
pause_function
print_title "(UN)COMPRESS TOOLS - https://wiki.archlinux.org/index.php/P7zip"
package_install "zip unzip unrar p7zip lzop cpio"
pause_function
print_title "AVAHI - https://wiki.archlinux.org/index.php/Avahi"
print_info "Avahi is a free Zero Configuration Networking (Zeroconf) implementation, including a system for multicast DNS/DNS-SD discovery. It allows programs to publish and discovers services and hosts running on a local network with no specific configuration."
package_install "avahi nss-mdns"
is_package_installed "avahi" && system_ctl enable avahi-daemon
pause_function
print_title "ALSA - https://wiki.archlinux.org/index.php/Alsa"
print_info "The Advanced Linux Sound Architecture (ALSA) is a Linux kernel component intended to replace the original Open Sound System (OSSv3) for providing device drivers for sound cards."
package_install "alsa-utils alsa-plugins"
pause_function
print_title "PULSEAUDIO - https://wiki.archlinux.org/index.php/Pulseaudio"
print_info "PulseAudio is the default sound server that serves as a proxy to sound applications using existing kernel sound components like ALSA or OSS"
package_install "pulseaudio pulseaudio-alsa"
pause_function
print_title "NTFS/FAT/exFAT/F2FS - https://wiki.archlinux.org/index.php/File_Systems"
print_info "A file system (or filesystem) is a means to organize data expected to be retained after a program terminates by providing procedures to store, retrieve and update data, as well as manage the available space on the device(s) which contain it. A file system organizes data in an efficient manner and is tuned to the specific characteristics of the device."
package_install "ntfs-3g dosfstools exfat-utils f2fs-tools fuse fuse-exfat autofs mtpfs"
pause_function
}
#}}}
#SSH {{{
install_ssh(){
print_title "SSH - https://wiki.archlinux.org/index.php/Ssh"
print_info "Secure Shell (SSH) is a network protocol that allows data to be exchanged over a secure channel between two computers."
read_input_text "Install ssh" $SSH
if [[ $OPTION == y ]]; then
package_install "openssh"
system_ctl enable sshd
[[ ! -f /etc/ssh/sshd_config.aui ]] && cp -v /etc/ssh/sshd_config /etc/ssh/sshd_config.aui;
#CONFIGURE SSHD_CONF #{{{
sed -i '/Port 22/s/^#//' /etc/ssh/sshd_config
sed -i '/Protocol 2/s/^#//' /etc/ssh/sshd_config
sed -i '/HostKey \/etc\/ssh\/ssh_host_rsa_key/s/^#//' /etc/ssh/sshd_config
sed -i '/HostKey \/etc\/ssh\/ssh_host_dsa_key/s/^#//' /etc/ssh/sshd_config
sed -i '/HostKey \/etc\/ssh\/ssh_host_ecdsa_key/s/^#//' /etc/ssh/sshd_config
sed -i '/KeyRegenerationInterval/s/^#//' /etc/ssh/sshd_config
sed -i '/ServerKeyBits/s/^#//' /etc/ssh/sshd_config
sed -i '/SyslogFacility/s/^#//' /etc/ssh/sshd_config
sed -i '/LogLevel/s/^#//' /etc/ssh/sshd_config
sed -i '/LoginGraceTime/s/^#//' /etc/ssh/sshd_config
sed -i '/PermitRootLogin/s/^#//' /etc/ssh/sshd_config
sed -i '/HostbasedAuthentication no/s/^#//' /etc/ssh/sshd_config
sed -i '/StrictModes/s/^#//' /etc/ssh/sshd_config
sed -i '/RSAAuthentication/s/^#//' /etc/ssh/sshd_config
sed -i '/PubkeyAuthentication/s/^#//' /etc/ssh/sshd_config
sed -i '/IgnoreRhosts/s/^#//' /etc/ssh/sshd_config
sed -i '/PermitEmptyPasswords/s/^#//' /etc/ssh/sshd_config
sed -i '/AllowTcpForwarding/s/^#//' /etc/ssh/sshd_config
sed -i '/AllowTcpForwarding no/d' /etc/ssh/sshd_config
sed -i '/X11Forwarding/s/^#//' /etc/ssh/sshd_config
sed -i '/X11Forwarding/s/no/yes/' /etc/ssh/sshd_config
sed -i -e '/\tX11Forwarding yes/d' /etc/ssh/sshd_config
sed -i '/X11DisplayOffset/s/^#//' /etc/ssh/sshd_config
sed -i '/X11UseLocalhost/s/^#//' /etc/ssh/sshd_config
sed -i '/PrintMotd/s/^#//' /etc/ssh/sshd_config
sed -i '/PrintMotd/s/yes/no/' /etc/ssh/sshd_config
sed -i '/PrintLastLog/s/^#//' /etc/ssh/sshd_config
sed -i '/TCPKeepAlive/s/^#//' /etc/ssh/sshd_config
sed -i '/the setting of/s/^/#/' /etc/ssh/sshd_config
sed -i '/RhostsRSAAuthentication and HostbasedAuthentication/s/^/#/' /etc/ssh/sshd_config
#}}}
pause_function
fi
}
#}}}
#NFS {{{
install_nfs(){
print_title "NFS - https://wiki.archlinux.org/index.php/Nfs"
print_info "NFS allowing a user on a client computer to access files over a network in a manner similar to how local storage is accessed."
read_input_text "Install nfs" $NFS
if [[ $OPTION == y ]]; then
package_install "nfs-utils"
system_ctl enable rpcbind
system_ctl enable nfs-client.target
system_ctl enable remote-fs.target
pause_function
fi
}
#}}}
#ZSH {{{
install_zsh(){
print_title "ZSH - https://wiki.archlinux.org/index.php/Zsh"
print_info "Zsh is a powerful shell that operates as both an interactive shell and as a scripting language interpreter. "
read_input_text "Install zsh" $ZSH
if [[ $OPTION == y ]]; then
package_install "zsh"
read_input_text "Install oh-my-zsh" $OH_MY_ZSH
if [[ $OPTION == y ]]; then
if [[ -f /home/${username}/.zshrc ]]; then
read_input_text "Replace current .zshrc file"
if [[ $OPTION == y ]]; then
run_as_user "mv /home/${username}/.zshrc /home/${username}/.zshrc.bkp"
run_as_user "sh -c \"$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)\""
run_as_user "$EDITOR /home/${username}/.zshrc"
fi
else
run_as_user "sh -c \"$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)\""
run_as_user "$EDITOR /home/${username}/.zshrc"
fi
fi
pause_function
fi
}
#}}}
#SAMBA {{{
install_samba(){
print_title "SAMBA - https://wiki.archlinux.org/index.php/Samba"
print_info "Samba is a re-implementation of the SMB/CIFS networking protocol, it facilitates file and printer sharing among Linux and Windows systems as an alternative to NFS."
read_input_text "Install Samba" $SAMBA
if [[ $OPTION == y ]]; then
package_install "samba smbnetfs"
[[ ! -f /etc/samba/smb.conf ]] && cp /etc/samba/smb.conf.default /etc/samba/smb.conf
local CONFIG_SAMBA=`cat /etc/samba/smb.conf | grep usershare`
if [[ -z $CONFIG_SAMBA ]]; then
# configure usershare
export USERSHARES_DIR="/var/lib/samba/usershare"
export USERSHARES_GROUP="sambashare"
mkdir -p ${USERSHARES_DIR}
groupadd ${USERSHARES_GROUP}
chown root:${USERSHARES_GROUP} ${USERSHARES_DIR}
chmod 1770 ${USERSHARES_DIR}
sed -i -e '/\[global\]/a\\n usershare path = /var/lib/samba/usershare\n usershare max shares = 100\n usershare allow guests = yes\n usershare owner only = False' /etc/samba/smb.conf
sed -i -e '/\[global\]/a\\n socket options = IPTOS_LOWDELAY TCP_NODELAY SO_KEEPALIVE\n write cache size = 2097152\n use sendfile = yes\n' /etc/samba/smb.conf
usermod -a -G ${USERSHARES_GROUP} ${username}
sed -i '/user_allow_other/s/^#//' /etc/fuse.conf
modprobe fuse
fi
echo "Enter your new samba account password:"
pdbedit -a -u ${username}
while [[ $? -ne 0 ]]; do
pdbedit -a -u ${username}
done
# enable services
system_ctl enable smbd
system_ctl enable nmbd
pause_function
fi
}
#}}}
#READAHEAD {{{
enable_readahead(){
print_title "Readahead - https://wiki.archlinux.org/index.php/Improve_Boot_Performance"
print_info "Systemd comes with its own readahead implementation, this should in principle improve boot time. However, depending on your kernel version and the type of your hard drive, your mileage may vary (i.e. it might be slower)."
read_input_text "Enable Readahead" $READAHEAD
if [[ $OPTION == y ]]; then
system_ctl enable systemd-readahead-collect
system_ctl enable systemd-readahead-replay
pause_function
fi
}
#}}}
#ZRAM {{{
install_zram (){
print_title "ZRAM - https://wiki.archlinux.org/index.php/Maximizing_Performance"
print_info "Zram creates a device in RAM and compresses it. If you use for swap means that part of the RAM can hold much more information but uses more CPU. Still, it is much quicker than swapping to a hard drive. If a system often falls back to swap, this could improve responsiveness. Zram is in mainline staging (therefore its not stable yet, use with caution)."
read_input_text "Install Zram" $ZRAM
if [[ $OPTION == y ]]; then
aur_package_install "zramswap"
system_ctl enable zramswap
pause_function
fi
}
#}}}
#TLP {{{
install_tlp(){
print_title "TLP - https://wiki.archlinux.org/index.php/Tlp"
print_info "TLP is an advanced power management tool for Linux. It is a pure command line tool with automated background tasks and does not contain a GUI."
read_input_text "Install TLP" $TLP
if [[ $OPTION == y ]]; then
package_install "tlp"
system_ctl enable tlp
system_ctl enable tlp-sleep
system_ctl disable systemd-rfkill
tlp start
pause_function
fi
}
#}}}
#XORG {{{
install_xorg(){
print_title "XORG - https://wiki.archlinux.org/index.php/Xorg"
print_info "Xorg is the public, open-source implementation of the X window system version 11."
echo "Installing X-Server (req. for Desktopenvironment, GPU Drivers, Keyboardlayout,...)"
package_install "xorg-server xorg-apps xorg-server-xwayland xorg-xinit xorg-xkill xorg-xinput xf86-input-libinput"
package_install "mesa"
modprobe uinput
pause_function
}
#}}}
#FONT CONFIGURATION {{{
font_config(){
print_title "FONTS CONFIGURATION - https://wiki.archlinux.org/index.php/Font_Configuration"
print_info "Fontconfig is a library designed to provide a list of available fonts to applications, and also for configuration for how fonts get rendered."
read_input_text "Install Fontconfig" $FONTCONFIG
if [[ $OPTION == y ]]; then
pacman -S --asdeps --needed cairo fontconfig freetype2
pause_function
fi
}
#}}}
#VIDEO CARDS {{{
create_ramdisk_environment(){
if [ "$(ls /boot | grep hardened -c)" -gt "0" ]; then
mkinitcpio -p linux-hardened
elif [ "$(ls /boot | grep lts -c)" -gt "0" ]; then
mkinitcpio -p linux-lts
else
mkinitcpio -p linux
fi
}
install_video_cards(){
package_install "dmidecode"
print_title "VIDEO CARD"
check_vga
#Virtualbox {{{
if [[ ${VIDEO_DRIVER} == virtualbox ]]; then
if [ "$(ls /boot | grep hardened -c)" -gt "0" ] || [ "$(ls /boot | grep lts -c)" -gt "0" ]; then
package_install "virtualbox-guest-dkms virtualbox-guest-utils mesa-libgl"
else
package_install "virtualbox-guest-modules-arch virtualbox-guest-utils mesa-libgl"
fi
add_module "vboxguest vboxsf vboxvideo" "virtualbox-guest"
add_user_to_group ${username} vboxsf
system_ctl disable ntpd
system_ctl enable vboxservice
create_ramdisk_environment
#}}}
#VMware {{{
elif [[ ${VIDEO_DRIVER} == vmware ]]; then
package_install "xf86-video-vmware xf86-input-vmmouse"
if [ "$(ls /boot | grep hardened -c)" -gt "0" ] || [ "$(ls /boot | grep lts -c)" -gt "0" ]; then
aur_package_install "open-vm-tools-dkms"
else
package_install "open-vm-tools"
fi
cat /proc/version > /etc/arch-release
system_ctl disable ntpd
system_ctl enable vmtoolsd
create_ramdisk_environment
#}}}
#Bumblebee {{{
elif [[ ${VIDEO_DRIVER} == bumblebee ]]; then
XF86_DRIVERS=$(pacman -Qe | grep xf86-video | awk '{print $1}')
[[ -n $XF86_DRIVERS ]] && pacman -Rcsn $XF86_DRIVERS
pacman -S --needed xf86-video-intel bumblebee nvidia
[[ ${ARCHI} == x86_64 ]] && pacman -S --needed lib32-virtualgl lib32-nvidia-utils
replace_line '*options nouveau modeset=1' '#options nouveau modeset=1' /etc/modprobe.d/modprobe.conf
replace_line '*MODULES="nouveau"' '#MODULES="nouveau"' /etc/mkinitcpio.conf
create_ramdisk_environment
add_user_to_group ${username} bumblebee
#}}}
#NVIDIA {{{
elif [[ ${VIDEO_DRIVER} == nvidia ]]; then
XF86_DRIVERS=$(pacman -Qe | grep xf86-video | awk '{print $1}')
[[ -n $XF86_DRIVERS ]] && pacman -Rcsn $XF86_DRIVERS
if [ "$(ls /boot | grep hardened -c)" -gt "0" ] || [ "$(ls /boot | grep lts -c)" -gt "0" ]; then
package_install "nvidia-dkms nvidia-utils libglvnd"
echo "Do not forget to make a mkinitcpio every time you updated the nvidia driver!"
else
package_install "nvidia nvidia-utils libglvnd"
fi
[[ ${ARCHI} == x86_64 ]] && pacman -S --needed lib32-nvidia-utils
replace_line '*options nouveau modeset=1' '#options nouveau modeset=1' /etc/modprobe.d/modprobe.conf
replace_line '*MODULES="nouveau"' '#MODULES="nouveau"' /etc/mkinitcpio.conf
create_ramdisk_environment
nvidia-xconfig --add-argb-glx-visuals --allow-glx-with-composite --composite -no-logo --render-accel -o /etc/X11/xorg.conf.d/20-nvidia.conf;
#}}}
#Nouveau [NVIDIA] {{{
elif [[ ${VIDEO_DRIVER} == nouveau ]]; then
is_package_installed "nvidia" && pacman -Rdds --noconfirm nvidia{,-utils}
[[ ${ARCHI} == x86_64 ]] && is_package_installed "lib32-nvidia-utils" && pacman -Rdds --noconfirm lib32-nvidia-utils
[[ -f /etc/X11/xorg.conf.d/20-nvidia.conf ]] && rm /etc/X11/xorg.conf.d/20-nvidia.conf
package_install "xf86-video-${VIDEO_DRIVER} mesa-libgl libvdpau-va-gl"
replace_line '#*options nouveau modeset=1' 'options nouveau modeset=1' /etc/modprobe.d/modprobe.conf
replace_line '#*MODULES="nouveau"' 'MODULES="nouveau"' /etc/mkinitcpio.conf
create_ramdisk_environment
#}}}
#ATI {{{
elif [[ ${VIDEO_DRIVER} == ati ]]; then
is_package_installed "catalyst-total" && pacman -Rdds --noconfirm catalyst-total
[[ -f /etc/X11/xorg.conf.d/20-radeon.conf ]] && rm /etc/X11/xorg.conf.d/20-radeon.conf
[[ -f /etc/modules-load.d/catalyst.conf ]] && rm /etc/modules-load.d/catalyst.conf
[[ -f /etc/X11/xorg.conf ]] && rm /etc/X11/xorg.conf
if [ "$(ls /boot | grep hardened -c)" -gt "0" ] || [ "$(ls /boot | grep lts -c)" -gt "0" ]; then
aur_package_install "catalyst-total"
else
package_install "xf86-video-${VIDEO_DRIVER} mesa-libgl mesa-vdpau libvdpau-va-gl"
add_module "radeon" "ati"
fi
create_ramdisk_environment
#}}}
#Intel {{{
elif [[ ${VIDEO_DRIVER} == intel ]]; then
package_install "xf86-video-${VIDEO_DRIVER} mesa-libgl libvdpau-va-gl"
#}}}
#Vesa {{{
else
package_install "xf86-video-${VIDEO_DRIVER} mesa-libgl libvdpau-va-gl"
fi
#}}}
if [[ ${ARCHI} == x86_64 ]]; then
is_package_installed "mesa-libgl" && package_install "lib32-mesa-libgl"
is_package_installed "mesa-vdpau" && package_install "lib32-mesa-vdpau"
fi
if is_package_installed "libvdpau-va-gl"; then
add_line "export VDPAU_DRIVER=va_gl" "/etc/profile"
fi
pause_function
}
#}}}
#CUPS {{{
install_cups(){
print_title "CUPS - https://wiki.archlinux.org/index.php/Cups"
print_info "CUPS is the standards-based, open source printing system developed by Apple Inc. for Mac OS X and other UNIX-like operating systems."
read_input_text "Install CUPS (aka Common Unix Printing System)" $CUPS
if [[ $OPTION == y ]]; then
package_install "cups cups-filters ghostscript gsfonts"
package_install "gutenprint foomatic-db foomatic-db-engine foomatic-db-nonfree foomatic-filters foomatic-db-ppds foomatic-db-nonfree-ppds hplip splix cups-pdf foomatic-db-gutenprint-ppds"
system_ctl enable org.cups.cupsd.service
pause_function
fi
}
#}}}
#ADDITIONAL FIRMWARE {{{
install_additional_firmwares(){
print_title "INSTALL ADDITIONAL FIRMWARES"
read_input_text "Install additional firmwares [Audio,Bluetooth,Scanner,Wireless]" $FIRMWARE
if [[ $OPTION == y ]]; then
while true
do
print_title "INSTALL ADDITIONAL FIRMWARES"
echo " 1) $(menu_item "aic94xx-firmware") $AUR"
echo " 2) $(menu_item "alsa-firmware")"
echo " 3) $(menu_item "b43-firmware") $AUR"
echo " 4) $(menu_item "b43-firmware-legacy") $AUR"
echo " 5) $(menu_item "bfa-firmware") $AUR"
echo " 6) $(menu_item "bluez-firmware") [Broadcom BCM203x/STLC2300 Bluetooth]"
echo " 7) $(menu_item "broadcom-wl") $AUR"
echo " 8) $(menu_item "ipw2100-fw")"
echo " 9) $(menu_item "ipw2200-fw")"
echo "10) $(menu_item "libffado") [Fireware Audio Devices]"
echo "11) $(menu_item "libmtp") [Android Devices]"
echo "12) $(menu_item "libraw1394") [IEEE1394 Driver]"
echo ""
echo " d) DONE"
echo ""
FIRMWARE_OPTIONS+=" d"
read_input_options "$FIRMWARE_OPTIONS"
for OPT in ${OPTIONS[@]}; do
case "$OPT" in
1)
aur_package_install "aic94xx-firmware"
;;
2)
package_install "alsa-firmware"
;;
3)
aur_package_install "b43-firmware"
;;
4)
aur_package_install "b43-firmware-legacy"
;;
5)
aur_package_install "bfa-firmware"
;;
6)
package_install "bluez-firmware"
;;
7)
aur_package_install "broadcom-wl"
;;
8)
package_install "ipw2100-fw"
;;
9)
package_install "ipw2200-fw"
;;
10)
package_install "libffado"
;;
11)
package_install "libmtp"
aur_package_install "android-udev"
;;
12)
package_install "libraw1394"
;;
"d")
break
;;
*)
invalid_option
;;
esac
done
source sharedfuncs_elihw
create_ramdisk_environment
done
fi
}
#}}}
#DESKTOP ENVIRONMENT {{{
install_desktop_environment(){
install_icon_theme() { #{{{
while true
do
print_title "GNOME ICONS"
echo " 1) $(menu_item "numix-icon-theme-git") $AUR"
echo " 2) $(menu_item "arc-icon-theme-git") $AUR"
echo ""
echo " b) BACK"
echo ""
ICONS_THEMES+=" b"
read_input_options "$ICONS_THEMES"
for OPT in ${OPTIONS[@]}; do
case "$OPT" in
1)
aur_package_install "numix-icon-theme-git numix-circle-icon-theme-git"
;;
2)
aur_package_install "arc-icon-theme-git moka-icon-theme-git"
;;
"b")
break
;;
*)
invalid_option
;;
esac
done
source sharedfuncs_elihw
done
} #}}}
install_gtk_theme() { #{{{
while true
do
print_title "GTK2/GTK3 THEMES"
echo " 1) $(menu_item "gtk-theme-arc-git" "Arc Themes")"
echo ""
echo " b) BACK"
echo ""
GTK_THEMES+=" b"
read_input_options "$GTK_THEMES"
for OPT in ${OPTIONS[@]}; do
case "$OPT" in
1)
aur_package_install "gtk-theme-arc-git "
;;
"b")
break
;;
*)
invalid_option
;;
esac
done
source sharedfuncs_elihw
done
} #}}}
install_display_manager() { #{{{
while true
do
print_title "DISPLAY MANAGER - https://wiki.archlinux.org/index.php/Display_Manager"
print_info "A display manager, or login manager, is a graphical interface screen that is displayed at the end of the boot process in place of the default shell."
echo " 1) $(menu_item "entrance-git" "Entrance") $AUR"
echo " 2) $(menu_item "gdm" "GDM")"
echo " 3) $(menu_item "lightdm" "LightDM")"
echo " 4) $(menu_item "sddm" "SDDM")"
echo " 5) $(menu_item "slim" "Slim")"
echo ""
echo " b) BACK|SKIP"
echo ""
DISPLAY_MANAGER+=" b"
read_input_options "$DISPLAY_MANAGER"
for OPT in ${OPTIONS[@]}; do
case "$OPT" in
1)
aur_package_install "entrance-git"
system_ctl enable entrance
;;
2)
package_install "gdm"
system_ctl enable gdm
;;
3)
if [[ ${KDE} -eq 1 ]]; then
package_install "lightdm lightdm-kde-greeter"
else
package_install "lightdm lightdm-gtk-greeter"
fi
system_ctl enable lightdm
;;
4)
package_install "sddm sddm-kcm"
system_ctl enable sddm
sddm --example-config > /etc/sddm.conf
sed -i 's/Current=/Current=breeze/' /etc/sddm.conf
sed -i 's/CursorTheme=/CursorTheme=breeze_cursors/' /etc/sddm.conf
sed -i 's/Numlock=none/Numlock=on/' /etc/sddm.conf
;;
5)
package_install "slim"
system_ctl enable slim
;;
"b")
break
;;
*)
invalid_option
;;
esac
done
source sharedfuncs_elihw
done
} #}}}
install_themes() { #{{{
while true
do
print_title "$1 THEMES"
echo " 1) $(menu_item "numix-circle-icon-theme-git" "Icons Themes") $AUR"
echo " 2) $(menu_item "gtk-theme-arc-git " "GTK Themes") $AUR"
echo ""
echo " d) DONE"
echo ""
THEMES_OPTIONS+=" d"
read_input_options "$THEMES_OPTIONS"
for OPT in ${OPTIONS[@]}; do
case "$OPT" in
1)
install_icon_theme
OPT=1
;;
2)
install_gtk_theme
OPT=2
;;
"d")
break
;;
*)
invalid_option
;;
esac
done
source sharedfuncs_elihw
done
} #}}}
install_misc_apps() { #{{{
while true
do
print_title "$1 ESSENTIAL APPS"
echo " 1) $(menu_item "entrance-git gdm lightdm sddm" "Display Manager") $AUR"
echo " 2) $(menu_item "dmenu")"
echo " 3) $(menu_item "viewnior")"