-
Notifications
You must be signed in to change notification settings - Fork 0
/
aui
executable file
·4117 lines (4104 loc) · 139 KB
/
aui
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 ULTIMATE INSTALL {{{
#WELCOME {{{
welcome(){
clear
echo -e "${Bold}Welcome to the Archlinux Ultimate 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:]'`
elif [[ $LOCALE == en_US ]]; then
LOCALE_KDE="en_gb"
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:]'`
elif [[ $LOCALE == en_US ]]; then
LOCALE_KDE="en_gb"
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: " USER_NAME
useradd -m -g users -G wheel -s /bin/bash ${USER_NAME}
chfn ${USER_NAME}
passwd ${USER_NAME}
pause_function
configure_user_account
}
#}}}
#CONFIGURE USER ACCOUNT {{{
configure_user_account(){
#BASHRC {{{
print_title "BASHRC - https://wiki.archlinux.org/index.php/Bashrc"
bashrc_list=("Default" "Vanilla" "Get from github");
PS3="$prompt1"
echo -e "Choose your .bashrc\n"
select OPT in "${bashrc_list[@]}"; do
case "$REPLY" in
1)
package_install "git"
git clone https://github.com/helmuthdu/dotfiles
cp dotfiles/.bashrc dotfiles/.dircolors dotfiles/.dircolors_256 dotfiles/.nanorc ~/
cp dotfiles/.bashrc dotfiles/.dircolors dotfiles/.dircolors_256 dotfiles/.nanorc /home/${USER_NAME}/
rm -fr dotfiles
;;
2)
cp /etc/skel/.bashrc /home/${USER_NAME}
;;
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/${USER_NAME}/
rm -fr $GITHUB_REPO
;;
*)
invalid_option
;;
esac
[[ -n $OPT ]] && break
done
#}}}
#EDITOR {{{
print_title "DEFAULT EDITOR"
editors_list=("emacs" "joe" "nano" "vi" "vim" "zile");
PS3="$prompt1"
echo -e "Select editor\n"
select EDITOR in "${editors_list[@]}"; do
if contains_element "$EDITOR" "${editors_list[@]}"; then
if [[ $EDITOR == joe ]]; then
! is_package_installed "joe" && aui_download_packages "joe"
elif [[ $EDITOR == vim ]]; then
! is_package_installed "gvim" && package_install "vim ctags"
#VIMRC {{{
if [[ ! -f /home/${USER_NAME}/.vimrc ]]; then
vimrc_list=("Default" "Vanilla" "Get 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
mv vim /home/${USER_NAME}/.vim
ln -sf /home/${USER_NAME}/.vim/vimrc /home/${USER_NAME}/.vimrc
cp -R vim /home/${USER_NAME}/.vim/fonts /home/${USER_NAME}/.fonts
;;
2)
;;
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/${USER_NAME}/
if [[ -f $GITHUB_REPO/vimrc ]]; then
ln -sf /home/${USER_NAME}/.vim/vimrc /home/${USER_NAME}/.vimrc
else
ln -sf /home/${USER_NAME}/.vim/.vimrc /home/${USER_NAME}/.vimrc
fi
rm -fr $GITHUB_REPO
;;
*)
invalid_option
;;
esac
[[ -n $OPT ]] && break
done
fi
#}}}
else
package_install "$EDITOR"
fi
else
invalid_option
fi
[[ -n $OPT ]] && break
done
#}}}
chown -R ${USER_NAME}:users /home/${USER_NAME}
}
#}}}
print_title "SELECT/CREATE USER ACCOUNT - 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
USER_NAME=$OPT
else
invalid_option
fi
[[ -n $OPT ]] && break
done
[[ ! -f /home/${USER_NAME}/.bashrc ]] && configure_user_account;
}
#}}}
#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=300' >> /etc/sudoers
echo 'Defaults passprompt="[sudo] password for %u: "' >> /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" "Packer" "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"
;;
2)
if ! is_package_installed "packer" ; then
package_install "base-devel git jshon"
pacman -D --asdeps jshon
aui_download_packages "packer"
if ! is_package_installed "packer" ; then
echo "Packer not installed. EXIT now"
pause_function
exit 0
fi
fi
AUR_PKG_MANAGER="packer"
;;
3)
if ! is_package_installed "pacaur" ; then
package_install "base-devel yajl expac"
pacman -D --asdeps yajl expac
#fix pod2man path
ln -s /usr/bin/core_perl/pod2man /usr/bin/
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
}
#}}}
#POWERPILL {{{
install_powerpill (){
print_title "POWERPILL - https://wiki.archlinux.org/index.php/Powerpill"
print_info "Powerpill is a Pacman wrapper that uses parallel and segmented downloading to try to speed up downloads for Pacman."
read_input_text "Install Powerpill"
if [[ $OPTION == y ]]; then
aur_package_install "powerpill"
CONFIG_POWERPILL=`cat /etc/powerpill/powerpill.json | grep country`
if [[ -z $CONFIG_POWERPILL ]]; then
local countries_name=("Australia" "Belarus" "Belgium" "Brazil" "Bulgaria" "Canada" "Chile" "China" "Colombia" "Czech Republic" "Denmark" "Estonia" "Finland" "France" "Germany" "Greece" "Hungary" "India" "Ireland" "Israel" "Italy" "Japan" "Kazakhstan" "Korea" "Latvia" "Luxembourg" "Macedonia" "Netherlands" "New Caledonia" "New Zealand" "Norway" "Poland" "Portugal" "Romania" "Russian" "Serbia" "Singapore" "Slovakia" "South Africa" "Spain" "Sri Lanka" "Sweden" "Switzerland" "Taiwan" "Turkey" "Ukraine" "United Kingdom" "United States" "Uzbekistan" "Viet Nam")
country_list(){
#`reflector --list-countries | sed 's/[0-9]//g' | sed 's/^/"/g' | sed 's/,.*//g' | sed 's/ *$//g' | sed 's/$/"/g' | sed -e :a -e '$!N; s/\n/ /; ta'`
PS3="$prompt1"
echo "Select your country:"
select country in "${countries_name[@]}"; do
if contains_element "$country" "${countries_name[@]}"; then
break
else
invalid_option
fi
done
}
OPTION=n
while [[ $OPTION != y ]]; do
country_list
read_input_text "Confirm country: $country"
done
sed -i -e '/"http"/a\ "--country",\n "'${country}'",' /etc/powerpill/powerpill.json
fi
fi
is_package_installed "powerpill" && PKG_MANAGER="powerpill"
}
#}}}
#AUTOMATIC MODE {{{
automatic_mode(){
print_title "AUTOMATIC MODE"
print_info "Create a custom install with all options pre-selected.\nUse this option with care."
print_warning "\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}/aui_automode
source ${AUI_DIR}/aui_automode
echo -e "The installation will start now."
pause_function
AUTOMATIC_MODE=1
fi
}
#}}}
#CUSTOM REPOSITORIES {{{
add_custom_repositories(){
# ENABLE MULTILIB REPOSITORY {{{
# this option will avoid any problem with packages install
if [[ $ARCHI == x86_64 ]]; then
local MULTILIB=`grep -n "\[multilib\]" /etc/pacman.conf | cut -f1 -d:`
if [[ -z $MULTILIB ]]; then
echo -e "\n[multilib]\nInclude = /etc/pacman.d/mirrorlist" >> /etc/pacman.conf
echo -e '\nMultilib repository added into pacman.conf file'
else
sed -i "${MULTILIB}s/^#//" /etc/pacman.conf
local MULTILIB=$(( $MULTILIB + 1 ))
sed -i "${MULTILIB}s/^#//" /etc/pacman.conf
fi
fi
#}}}
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]: " REPONAME
read -p "Repository Address [ex: file:///media/backup/Archlinux]: " REPOADDRESS
echo -e '\n['"$REPONAME"']\nServer = '"$REPOADDRESS"/'$arch' >> /etc/pacman.conf
echo -e '\nCustom repository added into pacman.conf file'
pause_function
;;
"d")
break
;;
*)
invalid_option
;;
esac
done
fi
system_update
}
#}}}
#BASIC SETUP {{{
install_basic_setup(){
print_title "BASH TOOLS - https://wiki.archlinux.org/index.php/Bash"
package_install "bc rsync mlocate bash-completion pkgstats"
print_title "NTPd - https://wiki.archlinux.org/index.php/NTPd"
package_install "ntp"
is_package_installed "ntp" && timedatectl set-ntp true
pause_function
print_title "(UN)COMPRESS TOOLS - https://wiki.archlinux.org/index.php/P7zip"
package_install "zip unzip unrar p7zip"
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 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
is_package_installed "avahi" && system_ctl enable avahi-dnsconfd
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"
[[ ${ARCHI} == x86_64 ]] && package_install "lib32-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"
[[ ${ARCHI} == x86_64 ]] && package_install "lib32-libpulse"
local CONFIG_PULSEAUDIO=`cat /etc/pulse/default.pa | grep module-switch-on-connect`
[[ -z $CONFIG_PULSEAUDIO ]] && echo -e "# automatically switch to newly-connected devices\nload-module module-switch-on-connect" >> /etc/pulse/default.pa
pause_function
print_title "NTFS/FAT/exFAT - 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 fuse fuse-exfat"
is_package_installed "fuse" && add_module "fuse"
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"
aur_package_install "rssh"
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/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 rpc-idmapd
system_ctl enable rpc-mountd
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/usershares"
export USERSHARES_GROUP="sambashare"
mkdir -p ${USERSHARES_DIR}
groupadd ${USERSHARES_GROUP}
chown root:${USERSHARES_GROUP} ${USERSHARES_DIR}
chmod 01770 ${USERSHARES_DIR}
sed -i -e '/\[global\]/a\\n usershare path = /var/lib/samba/usershares\n usershare max shares = 100\n usershare allow guests = yes\n usershare owner only = False' /etc/samba/smb.conf
usermod -a -G ${USERSHARES_GROUP} ${USER_NAME}
sed -i '/user_allow_other/s/^#//' /etc/fuse.conf
modprobe fuse
fi
# enable services
system_ctl enable smbd
system_ctl enable nmbd
# automatic mounting
system_ctl enable smbnetfs
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
aur_package_install "tlp"
tlp start
system_ctl enable tlp
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-server-utils xorg-xinit"
package_install "xf86-input-synaptics xf86-input-mouse xf86-input-keyboard"
package_install "mesa"
package_install "gamin"
KEYMAP=$(localectl status | grep Keymap | awk '{print $3}')
localectl set-keymap ${KEYMAP}
pause_function
}
#}}}
#FONT CONFIGURATION {{{
font_config(){
while true
do
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."
echo " 1) Default"
echo " 2) Infinality"
echo " 3) Ubuntu"
echo ""
read_input $FONTCONFIG
case "$OPTION" in
1)
is_package_installed "freetype2-infinality" && pacman -Rdds freetype2-infinality fontconfig-infinality
is_package_installed "freetype2-ubuntu" && pacman -Rdds freetype2-ubuntu fontconfig-ubuntu cairo-ubuntu
$PKG_MANAGER -S --asdeps --needed cairo fontconfig freetype2 libxft
#enable global fonts configs
cd /etc/fonts/conf.d
[[ ! -f /etc/fonts/conf.d/10-sub-pixel-rgb.conf ]] && ln -sv ../conf.avail/10-sub-pixel-rgb.conf
[[ ! -f /etc/fonts/conf.d/10-autohint.conf ]] && ln -sv ../conf.avail/10-autohint.conf
[[ ! -f /etc/fonts/conf.d/11-lcdfilter-default.conf ]] && ln -sv ../conf.avail/11-lcdfilter-default.conf
[[ ! -f /etc/fonts/conf.d/70-no-bitmaps.conf ]] && ln -s ../conf.avail/70-no-bitmaps.conf
cd $AUI_DIR
break
;;
2)
is_package_installed "freetype2" && pacman -Rdds --noconfirm freetype2
aur_package_install "freetype2-infinality fontconfig-infinality"
/etc/profile.d/infinality-settings.sh
infctl setstyle
break
;;
3)
is_package_installed "freetype2" && pacman -Rdds --noconfirm freetype2 fontconfig cairo libxft
aur_package_install "freetype2-ubuntu fontconfig-ubuntu cairo-ubuntu"
break
;;
*)
invalid_option
;;
esac
done
pause_function
}
#}}}
#VIDEO CARDS {{{
install_video_cards(){
package_install "dmidecode"
prnt_title "VIDEO CARD"
check_vga
#Virtualbox {{{
if [[ ${VIDEO_DRIVER} == virtualbox ]]; then
package_install "virtualbox-guest-utils"
add_module "vboxguest vboxsf vboxvideo" "virtualbox-guest"
add_user_to_group ${USER_NAME} vboxsf
system_ctl disable ntpd
system_ctl enable vbo
VBoxClient-all
#}}}
#NVIDIA {{{
elif [[ ${VIDEO_DRIVER} == nvidia ]]; then
XF86_DRIVERS=$(pacman -Qe | grep xf86-video | awk '{print $1}')
[[ -n $XF86_DRIVERS ]] && pacman -Rcsn $XF86_DRIVERS
is_package_installed "nouveau-dri" && pacman -Rdds --noconfirm nouveau-dri
$PKG_MANAGER -S --needed nvidia{,-utils}
package_install "pangox-compat" #fix nvidia-settings
package_install "libva-vdpau-driver"
if [[ ${ARCHI} == x86_64 ]]; then
is_package_installed "lib32-nouveau-dri" && pacman -Rdds --noconfirm lib32-nouveau-dri
$PKG_MANAGER -S --needed "lib32-nvidia-utils"
fi
replaceinfile '*options nouveau modeset=1' '#options nouveau modeset=1' /etc/modprobe.d/modprobe.conf
replaceinfile '*MODULES="nouveau"' '#MODULES="nouveau"' /etc/mkinitcpio.conf
mkinitcpio -p linux
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}
[[ -f /etc/X11/xorg.conf.d/20-nvidia.conf ]] && rm /etc/X11/xorg.conf.d/20-nvidia.conf
$PKG_MANAGER -S --asdeps mesa-libgl
package_install "xf86-video-${VIDEO_DRIVER} ${VIDEO_DRIVER}-dri"
if [[ ${ARCHI} == x86_64 ]]; then
is_package_installed "lib32-nvidia-utils" && pacman -Rdds --noconfirm lib32-nvidia-utils
$PKG_MANAGER -S --needed "lib32-${VIDEO_DRIVER}-dri"
fi
replaceinfile '#*options nouveau modeset=1' 'options nouveau modeset=1' /etc/modprobe.d/modprobe.conf
replaceinfile '#*MODULES="nouveau"' 'MODULES="nouveau"' /etc/mkinitcpio.conf
mkinitcpio -p linux
#}}}
#Catalyst [ATI] {{{
elif [[ ${VIDEO_DRIVER} == catalyst ]]; then
XF86_DRIVERS=$(pacman -Qe | grep xf86-video | awk '{print $1}')
[[ -n $XF86_DRIVERS ]] && pacman -Rcsn $XF86_DRIVERS
is_package_installed "ati-dri" && pacman package_remove "ati-dri"
[[ -f /etc/modules-load.d/ati.conf ]] && rm /etc/modules-load.d/ati.conf
package_install "linux-headers"
$PKG_MANAGER -S --needed catalyst-dkms
if [[ ${ARCHI} == x86_64 ]]; then
is_package_installed "lib32-ati-dri" && pacman -Rdds --noconfirm lib32-ati-dri
$PKG_MANAGER -S --needed "lib32-catalyst-utils"
fi
aticonfig --initial --output=/etc/X11/xorg.conf.d/20-radeon.conf
add_module "fglrx" "ati"
#}}}
#ATI {{{
elif [[ ${VIDEO_DRIVER} == ati ]]; then
is_package_installed "catalyst-dkms" && pacman -Rdds --noconfirm catalyst{-dkms,-utils} lib32-catalyst-utils
$PKG_MANAGER -S --asdeps mesa-libgl
[[ -f /etc/X11/xorg.conf.d/20-radeon.conf ]] && rm /etc/X11/xorg.conf.d/20-radeon.conf
[[ -f /etc/modules-load.d/ati.conf ]] && rm /etc/modules-load.d/ati.conf
package_install "xf86-video-${VIDEO_DRIVER} ${VIDEO_DRIVER}-dri"
if [[ ${ARCHI} == x86_64 ]]; then
is_package_installed "lib32-catalyst-utils" && pacman -Rdds --noconfirm lib32-catalyst-utils
package_install "lib32-${VIDEO_DRIVER}-dri"
fi
add_module "radeon" "ati"
#}}}
#Intel {{{
elif [[ ${VIDEO_DRIVER} == intel ]]; then
package_install "xf86-video-intel intel-dri libva-intel-driver"
[[ ${ARCHI} == x86_64 ]] && package_install "lib32-mesa-libgl"
#}}}
else
package_install "xf86-video-${VIDEO_DRIVER}"
[[ ${ARCHI} == x86_64 ]] && package_install "lib32-mesa-libgl"
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 hplip splix cups-pdf"
system_ctl enable cups
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 "alsa-firmware")"
echo " 2) $(menu_item "ipw2100-fw")"
echo " 3) $(menu_item "ipw2200-fw")"
echo " 4) $(menu_item "b43-firmware") $AUR"
echo " 5) $(menu_item "b43-firmware-legacy") $AUR"
echo " 6) $(menu_item "broadcom-wl") $AUR"
echo " 7) $(menu_item "bluez-firmware") [Broadcom BCM203x/STLC2300 Bluetooth]"
echo " 8) $(menu_item "libmtp") [Android Devices]"
echo " 9) $(menu_item "libffado") [Fireware Audio Devices]"
echo "10) $(menu_item "libraw1394") [IEEE1394 Driver]"
echo "11) $(menu_item "aic94xx-firmware") $AUR"
echo "12) $(menu_item "bfa-firmware") $AUR"
echo ""
echo " d) DONE"
echo ""
FIRMWARE_OPTIONS+=" d"
read_input_options "$FIRMWARE_OPTIONS"
for OPT in ${OPTIONS[@]}; do
case "$OPT" in
1)
package_install "alsa-firmware"
;;
2)
package_install "ipw2100-fw"
;;
3)
package_install "ipw2200-fw"
;;
4)
aur_package_install "b43-firmware"
;;
5)
aur_package_install "b43-firmware-legacy"
;;
6)
aur_package_install "broadcom-wl"
;;
7)
package_install "bluez-firmware"
;;
8)
package_install "libmtp"
aur_package_install "android-udev"
;;
9)
package_install "libffado"
;;
10)
package_install "libraw1394"
;;
11)
aur_package_install "aic94xx-firmware"
;;
12)
aur_package_install "bfa-firmware"
;;
"d")
break
;;
*)
invalid_option
;;
esac
done
elihw
done
fi
}
#}}}
#GIT ACCESS THRU A FIREWALL {{{
install_git_tor(){
print_title "GIT-TOR - https://wiki.archlinux.org/index.php/Tor"
print_info "Tor is an open source implementation of 2nd generation onion routing that provides free access to an anonymous proxy network. Its primary goal is to enable online anonymity by protecting against traffic analysis attacks."
read_input_text "Ensuring access to GIT through a firewall (bypass college/work firewall)" $GITTOR
if [[ $OPTION == y ]]; then
package_install "openbsd-netcat vidalia privoxy git"
if [[ ! -f /usr/bin/proxy-wrapper ]]; then
echo 'forward-socks5 / 127.0.0.1:9050 .' >> /etc/privoxy/config
echo -e '#!/bin/bash\nnc -xlocalhost:9050 -X5 $*' > /usr/bin/proxy-wrapper
chmod +x /usr/bin/proxy-wrapper
echo -e '\nexport GIT_PROXY_COMMAND="/usr/bin/proxy-wrapper"' >> /etc/bash.bashrc
export GIT_PROXY_COMMAND="/usr/bin/proxy-wrapper"
su - ${USER_NAME} -c 'export GIT_PROXY_COMMAND="/usr/bin/proxy-wrapper"'
fi
groupadd -g 42 privoxy
useradd -u 42 -g privoxy -s /bin/false -d /etc/privoxy privoxy
system_ctl start tor
system_ctl start privoxy
system_ctl enable tor
system_ctl enable privoxy
pause_function
fi
}
#}}}
#DESKTOP ENVIRONMENT {{{
install_desktop_environment(){
install_icon_theme() { #{{{
package_install "gtk-update-icon-cache"
while true
do
print_title "GNOME ICONS"
echo " 1) $(menu_item "awoken-icons" "Awoken")"
echo " 2) $(menu_item "elementary-xfce-icons" "Elementary XFCE")"
echo " 3) $(menu_item "faenza-icon-theme")"
echo " 4) $(menu_item "faenza-cupertino-icon-theme" "Faenza-Cupertino")"
echo " 5) $(menu_item "faience-icon-theme")"
echo " 6) $(menu_item "inx-icon-theme" "iNX")"
echo " 7) $(menu_item "matrilineare-icon-theme")"
echo " 8) $(menu_item "nitrux-icon-theme")"
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 "awoken-icons"
;;
2)
aur_package_install "elementary-xfce-icons"
;;
3)
package_install "faenza-icon-theme"
;;
4)
aur_package_install "faenza-cupertino-icon-theme"
;;
5)
package_install "faience-icon-theme"
;;
6)
aur_package_install "inx-icon-theme"
;;
7)
aur_package_install "matrilineare-icon-theme"
;;
8)
aur_package_install "nitrux-icon-theme"
;;
"b")
break
;;
*)
invalid_option
;;
esac
done
elihw
done
} #}}}
install_gtk_theme() { #{{{
while true
do
print_title "GTK2/GTK3 THEMES"
echo " 1) $(menu_item "xfce-theme-greybird-git" "Greybird")"
echo " 2) $(menu_item "faience-themes" "Faience")"
echo " 3) $(menu_item "gtk-theme-gnome-cupertino" "Gnome Cupertino")"
echo " 4) $(menu_item "mediterraneannight-theme" "MediterraneanNight")"
echo " 5) $(menu_item "gtk-theme-numix-git" "Numix")"
echo " 6) $(menu_item "zukitwo-themes" "Zukitwo")"
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 "xfce-theme-greybird-git"
;;
2)
package_install "faience-themes"
;;
3)
aur_package_install "gtk-theme-gnome-cupertino"
;;
4)
aur_package_install "mediterraneannight-theme"
;;
5)
aur_package_install "gtk-theme-numix-git"
;;
6)
aur_package_install "zukitwo-themes"
;;
"b")
break
;;
*)
invalid_option
;;
esac