post-install.sh 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592
  1. #! /bin/bash
  2. # COLORS {{{
  3. Bold=$(tput bold)
  4. Underline=$(tput sgr 0 1)
  5. Reset=$(tput sgr0)
  6. # Regular Colors
  7. Red=$(tput setaf 1)
  8. Green=$(tput setaf 2)
  9. Yellow=$(tput setaf 3)
  10. Blue=$(tput setaf 4)
  11. Purple=$(tput setaf 5)
  12. Cyan=$(tput setaf 6)
  13. White=$(tput setaf 7)
  14. # Bold
  15. BRed=${Bold}$(tput setaf 1)
  16. BGreen=${Bold}$(tput setaf 2)
  17. BYellow=${Bold}$(tput setaf 3)
  18. BBlue=${Bold}$(tput setaf 4)
  19. BPurple=${Bold}$(tput setaf 5)
  20. BCyan=${Bold}$(tput setaf 6)
  21. BWhite=${Bold}$(tput setaf 7)
  22. print_line() {
  23. printf "%$(tput cols)s\n"|tr ' ' '-'
  24. }
  25. print_title() {
  26. #clear
  27. print_line
  28. echo -e "# ${BPurple}$1${Reset}"
  29. print_line
  30. echo ""
  31. }
  32. print_question(){
  33. T_COLS=`tput cols`
  34. echo -n "${BBlue}$1${Reset}"
  35. }
  36. print_msg(){
  37. T_COLS=`tput cols`
  38. echo -e "${BGreen}$1${Reset}"
  39. sleep 2
  40. }
  41. print_info() {
  42. #Console width number
  43. T_COLS=`tput cols`
  44. echo -e "${Bold}$1${Reset}\n" | fold -sw $(( $T_COLS - 18 )) | sed 's/^/\t /'
  45. }
  46. print_warning() {
  47. T_COLS=`tput cols`
  48. echo -e "${BYellow}$1${Reset}\n" | fold -sw $(( $T_COLS - 1 ))
  49. sleep 4
  50. }
  51. print_title 'Arch Linux Postinstall'
  52. alpi_user(){
  53. print_title "User"
  54. print_question "Create new user? [Y|n]"
  55. read yn
  56. yn=${yn:-y}
  57. if [ "$yn" == "y" ]; then
  58. print_question "Enter user name:"
  59. read username
  60. # TODO: check username inytergrity
  61. useradd -m -g users -G wheel,sys -s /bin/bash ${username}
  62. chfn ${username}
  63. passwd ${username}
  64. print_msg "user $username created"
  65. pacman -S --needed --noconfirm sudo
  66. echo "$username ALL=(ALL) ALL" >> /etc/sudoers
  67. print_msg "$username added to sudoers"
  68. print_question "switch now to $username? you'll have to restart the script [Y|n]"
  69. read yn
  70. yn=${yn:-y}
  71. if [ "$yn" == "y" ]; then
  72. su ${username}
  73. fi
  74. fi
  75. }
  76. alpi_avahi(){
  77. print_msg "install avahi"
  78. sudo pacman -S --needed --noconfirm -q avahi nss-mdns
  79. print_msg "configure avahi"
  80. sudo systemctl enable avahi-daemon
  81. sudo systemctl start avahi-daemon
  82. sudo sed -i.back 's/hosts: files dns myhostname/hosts: files mdns_minimal [NOTFOUND=return] dns myhostname/' /etc/nsswitch.conf
  83. }
  84. alpi_basics(){
  85. print_title "basic packages install"
  86. print_question "install basic pkgs? [Y|n]"
  87. read yn
  88. yn=${yn:-y}
  89. if [ "$yn" == "y" ]; then
  90. sudo pacman -S --needed --noconfirm -q vim rsync acpi parted imagemagick lynx wget alsa-utils tmux git openssh knockd bluez-utils htop
  91. print_msg 'securing ssh'
  92. sudo sed -i.back 's/^#PermitEmptyPasswords.*/PermitEmptyPasswords no/' /etc/ssh/sshd_config
  93. sudo sed -i.back 's/^#PermitRootLogin.*/PermitRootLogin no/' /etc/ssh/sshd_config
  94. sudo systemctl enable sshd
  95. sudo systemctl start sshd
  96. # increase watch limit
  97. echo 100000 | sudo tee -a /usr/lib/sysctl.d/50-default.conf
  98. alpi_avahi
  99. print_msg "basic packages and configuration installed"
  100. fi
  101. }
  102. alpi_multilib(){
  103. # https://wiki.archlinux.org/index.php/Multilib
  104. print_msg "Enable Multilib repository package"
  105. sudo sed -i.back 's/^#[multilib]$/[multilib]/' /etc/pacman.conf
  106. sudo sed -i.back 's/^#Include = \/etc\/pacman\.d\/mirrorlist$/Include = /etc/pacman.d/mirrorlist/' /etc/pacman.conf
  107. sudo pacman -Syy
  108. }
  109. alpi_cosmetics(){
  110. print_title "apply pacman, bash, vim and git config (needs basic pkgs install)"
  111. alpi_basics
  112. _cwd="$(pwd)"
  113. # TODO: can't be launched as root, check before
  114. # vim
  115. print_msg 'vim configuration'
  116. sudo pacman -S --needed --noconfirm -q vim-{spell-fr,spell-en,nerdtree,supertab,systemd}
  117. cp -r $_cwd/assets/vim /home/$USER/.vim
  118. cp $_cwd/assets/vimrc /home/$USER/.vimrc
  119. sudo cp -r $_cwd/assets/vim /root/.vim
  120. sudo cp $_cwd/assets/vimrc /root/.vimrc
  121. print_msg 'Git Completion'
  122. sudo pacman -S --needed --noconfirm -q bash-completion
  123. sudo mkdir /etc/bash_completion.d
  124. sudo wget -O /etc/bash_completion.d/git-completion.bash https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash
  125. # bash & prompt
  126. print_msg 'Bash and Prompt (liquidprompt)'
  127. git clone https://github.com/nojhan/liquidprompt.git -o github /home/$USER/.liquidprompt
  128. cp $_cwd/assets/bash_profile /home/$USER/.bash_profile
  129. cp $_cwd/assets/bashrc /home/$USER/.bashrc
  130. mkdir /home/$USER/.config
  131. cp $_cwd/assets/config/liquidpromptrc /home/$USER/.config/
  132. # sudo pacman -S --needed --noconfirm -q bash-completion
  133. source /home/$USER/.bashrc
  134. touch /home/$USER/.inputrc
  135. echo 'set show-all-if-ambiguous on' >> /home/$USER/.inputrc
  136. echo 'set completion-ignore-case on' >> /home/$USER/.inputrc
  137. print_msg "I love candy! (pacman)"
  138. sudo sed -i.back 's/^#Color$/Color/' /etc/pacman.conf
  139. sudo sed -i.back 's/^#TotalDownload$/TotalDownload\nILoveCandy/' /etc/pacman.conf
  140. # sudo sed -i.back 's/.*\[options\].*/&\nILoveCandy/' /etc/pacman.conf
  141. print_msg "Bins"
  142. cp -r $_cwd/assets/bin /home/$USER/.bin
  143. #DefaultTimeoutStopSec=30s /etc/systemd/system.conf
  144. print_msg 'Config and Cosmetics done'
  145. }
  146. # GPG
  147. alpi_gnupg(){
  148. print_title 'Setup a gpg encripting'
  149. print_msg 'see https://wiki.archlinux.org/index.php/GnuPG'
  150. print_question "create your gpg encrypting key? [Y|n] "
  151. read yn
  152. yn=${yn:-y}
  153. if [ "$yn" == "y" ]; then
  154. gpg --full-gen-key
  155. fi
  156. print_msg 'Gnupg done!'
  157. }
  158. alpi_secure(){
  159. print_title 'Basic securing system'
  160. print_msg 'remove root autologin'
  161. sudo sed -i.back 's/--autologin root //' /etc/systemd/system/getty@tty1.service.d/autologin.conf
  162. print_msg 'remove root login'
  163. sudo sed -i.back 's/#auth\srequired\spam_wheel.so\suse_uid/auth required spam_wheel.so use_uid/' /etc/pam.d/su
  164. sudo sed -i.back 's/#auth\srequired\spam_wheel.so\suse_uid/auth required spam_wheel.so use_uid/' /etc/pam.d/su-l
  165. print_msg 'restrict log access to root'
  166. sudo touch /etc/sysctl.d/50-dmesg-restrict.conf
  167. sudo sh -c "echo 'kernel.dmesg_restrict = 1' >> /etc/sysctl.d/50-dmesg-restrict.conf"
  168. sudo touch /etc/sysctl.d/50-kptr-restrict.con
  169. sudo sh -c "echo 'kernel.kptr_restrict = 1' >> /etc/sysctl.d/50-kptr-restrict.conf"
  170. print_msg 'basics secure done'
  171. }
  172. # Display Manager
  173. alpi_xserver(){
  174. print_title "install Graphical Display Part 1 : Xorg server"
  175. print_msg "you will have to reboot at the end of part 1"
  176. print_question "install xorg server? [Y|n] "
  177. read yn
  178. yn=${yn:-y}
  179. if [ "$yn" == "y" ]; then
  180. # touch pad
  181. sudo pacman -S --needed --noconfirm -q xf86-input-libinput
  182. # integred gpu
  183. sudo pacman -S --needed --noconfirm -q xf86-video-intel
  184. # https://bbs.archlinux.org/viewtopic.php?pid=1533863#p1533863
  185. sudo cp $_cwd/assets/20-intel.conf /etc/X11/xorg.conf.d/
  186. # discret gpu
  187. # sudo pacman -S --needed --noconfirm -q bbswitch bumblebee primus
  188. # sudo pacman -S --needed --noconfirm -q nvidia nvidia-utils nvidia-libgl
  189. # xorg server
  190. sudo pacman -S --needed --noconfirm -q xorg-{server,xinit,apps,server-devel,xrandr,xclock} xterm
  191. sudo pacman -S --needed --noconfirm -q mesa mesa-{libgl,demos}
  192. # xinitrc
  193. touch /home/$USER/.xinitrc
  194. cat /etc/X11/xinit/xinitrc > /home/$USER/.xinitrc
  195. print_warning "xorg install complete, reboot and run startx to test xorg"
  196. print_warning "run part 2 after reboot if you need kde : Desktop manager Plasma5"
  197. print_warning "press enter to reboot"
  198. read x
  199. sudo reboot
  200. fi
  201. }
  202. alpi_plasma5(){
  203. print_title "install Graphical Display Part 2 : Desktop Manager Plasma 5"
  204. print_question "install Kde Plasma 5? [Y|n] "
  205. read yn
  206. yn=${yn:-y}
  207. if [ "$yn" == "y" ]; then
  208. print_msg "plasma"
  209. sudo pacman -S --needed --noconfirm -q --force plasma-meta
  210. print_msg "fonts"
  211. sudo pacman -S --needed --noconfirm -q ttf-{dejavu,liberation,droid,ubuntu-font-family}
  212. print_msg "network & Bluetooth"
  213. sudo pacman -S --needed --noconfirm -q networkmanager-openvpn pulseaudio-alsa pulseaudio-bluetooth rfkill bluedevil
  214. # yaourt -S --needed --noconfirm -q systemd-kcm
  215. print_msg "plasma addons"
  216. sudo pacman -S --needed --noconfirm -q kdeplasma-addons
  217. print_msg "file explorer : Dolphin"
  218. sudo pacman -S --needed --noconfirm -q dolphin dolphin-plugins ark unzip zip
  219. print_msg 'kleopatra and spectacle'
  220. sudo pacman -S --needed --noconfirm -q kleopatra spectacle
  221. # TODO these should go on alpi_defaultpkgs instead of alpi_plasma5
  222. print_msg "web browser, terminal emulator, disk tool, password tool"
  223. sudo pacman -S --needed --noconfirm -q chromium terminator gparted keepassx2
  224. sudo systemctl enable NetworkManager
  225. sudo systemctl start NetworkManager
  226. sudo systemctl enable bluetooth
  227. sudo systemctl start bluetooth
  228. # TODO start kde with xinitrc
  229. # echo 'exec startkde' > /home/$USER/.xinitrc
  230. print_msg "Plasma 5 install complete!"
  231. print_msg 'add exec startkde on ~/.xinitrc then run "startx" to start x server with kde plasma 5'
  232. fi
  233. }
  234. # Yaourt
  235. alpi_yaourt(){
  236. print_title "AUR helper : Yaourt"
  237. print_question "install Yaourt [Y|n] "
  238. read yaourt
  239. yaourt=${yaourt:-y}
  240. if [ "$yaourt" == "y" ]; then
  241. sudo pacman -S --needed base-devel
  242. mkdir -p /home/$USER/Developer/Linux/build-repos
  243. wget -O /home/$USER/Developer/Linux/build-repos/package-query.tar.gz https://aur.archlinux.org/cgit/aur.git/snapshot/package-query.tar.gz
  244. wget -O /home/$USER/Developer/Linux/build-repos/yaourt.tar.gz https://aur.archlinux.org/cgit/aur.git/snapshot/yaourt.tar.gz
  245. cd /home/$USER/Developer/Linux/build-repos
  246. tar -xvf package-query.tar.gz
  247. tar -xvf yaourt.tar.gz
  248. cd package-query
  249. makepkg -sri
  250. cd ../yaourt
  251. makepkg -sri
  252. echo 'ask for editing config file before build'
  253. echo "EDITFILES=1" >> ~/.yaourtrc
  254. print_msg "Yaourt install complete!"
  255. fi
  256. }
  257. alpi_cups(){
  258. print_title 'CUPS (for printing)'
  259. print_question "install cups [Y|n] "
  260. read yn
  261. yn=${yn:-y}
  262. if [ "$yn" == "y" ]; then
  263. sudo pacman -S --needed --noconfirm -q cups cups-filters libcups ghostscript gsfonts
  264. sudo pacman -S --needed --noconfirm -q gutenprint splix cups-pdf
  265. sudo pacman -S --needed --noconfirm -q print-manager
  266. alpi_avahi
  267. sudo systemctl enable org.cups.cupsd
  268. sudo systemctl start org.cups.cupsd
  269. sudo systemctl enable cups-browsed
  270. sudo systemctl start cups-browsed
  271. sudo gpasswd -a $USER sys
  272. print_msg "CUPS install complete!"
  273. fi
  274. }
  275. # kernel LTS
  276. alpi_kernellts(){
  277. print_title "Long Term Support Kernel"
  278. print_question "install kernel-lts)? [Y|n]"
  279. read yn
  280. yn=${yn:-y}
  281. if [ "$yn" == "y" ]; then
  282. sudo pacman -S linux-lts linux-lts-headers nvidia-lts bbswitch-lts
  283. # TODO : add entrie for lts kernel on /boot/loader/entries
  284. print_msg "kernel LTS install complete!"
  285. fi
  286. }
  287. alpi_mysql(){
  288. print_msg "installe mysql"
  289. sudo pacman -S --needed --noconfirm -q mariadb
  290. print_msg "configure mysql"
  291. sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
  292. sudo systemctl start mysqld
  293. mysql_secure_installation
  294. sudo sed -i.back 's/^log-bin=mysql-bin$/#&/' /etc/mysql/my.cnf
  295. sudo sed -i.back 's/^max_allowed_packet.*$/max_allowed_packet = 16M/' /etc/mysql/my.cnf
  296. }
  297. # Packages
  298. alpi_defaultpkgs(){
  299. print_title "Day to day software"
  300. print_question "install day to day packages? [Y|n]"
  301. read yn
  302. yn=${yn:-y}
  303. if [ "$yn" == "y" ]; then
  304. _cwd="$(pwd)"
  305. print_msg 'Pim softwares : mail, calendar, contact, xmpp, etc'
  306. sudo pacman -S --needed --noconfirm -q kmail korganizer kaddressbook kdeconnect gajim
  307. yaourt -S gajim-plugin-omemo
  308. # TODO need more works to let omemo plugin works on gajim
  309. sudo pacman -S --needed --noconfirm -q spamassassin razor
  310. sudo sa-update
  311. print_question "Install regular mysql support for akonadi? [Y|n] "
  312. read ako
  313. ako=${ako:-y}
  314. if [ "$ako" == "y" ]; then
  315. print_question "Should we install and configure mysql (if not already done)? [y|N] "
  316. read sql
  317. sql=${sql:-n}
  318. if [ "$sql" == "y" ]; then
  319. alpi_mysql
  320. fi
  321. # https://forum.kde.org/viewtopic.php?t=84478#p140762
  322. print_question "please type your root mysql password :"
  323. read -s -p Password: pswd
  324. mysql -u root -p$pswd -e "create database akonadi;"
  325. mysql -u root -p$pswd -e "create user 'akonadi'@'localhost' identified by 'akonadi';"
  326. mysql -u root -p$pswd -e "grant all privileges on akonadi.* to 'akonadi'@'localhost';"
  327. mysql -u root -p$pswd -e "flush privileges;"
  328. mkdir -p /home/$USER/.config/akonadi
  329. mv /home/$USER/.config/akonadi/akonadiserverrc /home/$USER/.config/akonadi/akonadiserverrc.back
  330. cp $_cwd/assets/akonadiserverrc /home/$USER/.config/akonadi/
  331. print_msg "Akonadi configured to use system wide sql server!"
  332. fi
  333. print_msg 'install office softwares'
  334. sudo pacman -S --needed --noconfirm -q gwenview kimageformats okular kipi-plugins libreoffice-fresh hunspell-{fr,en_US,en_GB}
  335. # fix theme appearence in kde plasma 5
  336. sudo sed -i.back 's/#export SAL_USE_VCLPLUGIN=gtk3/export SAL_USE_VCLPLUGIN=gtk3/' /etc/profile.d/libreoffice-fresh.sh
  337. print_msg 'install media softwares'
  338. sudo pacman -S --needed --noconfirm -q digikam darktable vlc lua-socket ktorrent
  339. # banshee is on aur
  340. print_msg 'install graphic softwares'
  341. sudo pacman -S --needed --noconfirm -q inkscape gimp scribus fontforge blender hyphen-{fr,en,de,es,it,nl,hu,pl,ro}
  342. print_msg 'web dev softwares'
  343. sudo pacman -S --needed --noconfirm -q firefox filezilla gulp
  344. print_msg 'install cloud softwares'
  345. sudo pacman -S --needed --noconfirm -q owncloud-client syncthing syncthing-gtk syncthing-inotify
  346. print_msg 'increase inotify watch limit'
  347. sleep 3
  348. sudo cp $_cwd/assets/90-inotify.conf /etc/sysctl.d/
  349. print_msg 'install dev softwares'
  350. sudo pacman -S --needed --noconfirm -q atom
  351. if [ -f /usr/bin/yaourt ];
  352. then
  353. yaourt -S downgrade
  354. yaourt -S pulseaudio-dlna
  355. else
  356. print_warning "some packages can't be installed because you don't have yaourt installed"
  357. fi
  358. fi
  359. }
  360. # LAMP
  361. alpi_lamp(){
  362. # https://wiki.archlinux.org/index.php/Apache_HTTP_Server
  363. _cwd="$(pwd)"
  364. print_title "Web Server (apache, php, mysql)"
  365. print_question "Install apache php mysql? [Y|n] "
  366. read yn
  367. yn=${yn:-y}
  368. if [ "$yn" == "y" ]; then
  369. sudo pacman -S --needed --noconfirm -q apache php php-apache phpmyadmin php-mcrypt php-gd
  370. print_question "Should we install and configure mysql (if not already done)? [y|N] "
  371. read sql
  372. sql=${sql:-n}
  373. if [ "$sql" == "y" ]; then
  374. alpi_mysql
  375. fi
  376. print_msg "configure apache"
  377. sudo sed -i.back 's/^LoadModule mpm_event_module modules\/mod_mpm_event\.so$/#&/' /etc/httpd/conf/httpd.conf
  378. sudo sed -i.back 's/^#LoadModule mpm_prefork_module modules\/mod_mpm_prefork\.so$/LoadModule mpm_prefork_module modules\/mod_mpm_prefork.so/' /etc/httpd/conf/httpd.conf
  379. sudo sed -i.back 's/^#LoadModule rewrite_module modules\/mod_rewrite\.so$/LoadModule rewrite_module modules\/mod_rewrite.so/' /etc/httpd/conf/httpd.conf
  380. print-msg "configure vhosts folder"
  381. sudo mkdir /etc/httpd/conf/vhosts
  382. sudo sed -i.back 's/^#Include conf\/extra\/httpd-vhosts\.conf$/&\nInclude conf\/vhosts\/*.conf/' /etc/httpd/conf/httpd.conf
  383. print_msg "Install Sites folder"
  384. mkdir /home/$USER/Sites
  385. sudo cp $_cwd/assets/vhosts/dev.conf /etc/httpd/conf/vhosts/
  386. cp $_cwd/assets/index.html /home/$USER/Sites/
  387. sudo cp $_cwd/assets/index.html /srv/http/
  388. sudo sed -i "s/USER/$USER/g" /etc/httpd/conf/vhosts/dev.conf
  389. sudo sed -i 's/# End of file/127.0.0.1 dev\n\n&/' /etc/hosts
  390. print_msg "configure apache for php"
  391. sudo sed -i.back 's/^LoadModule dir_module modules\/mod_dir\.so$/&\nLoadModule php7_module modules\/libphp7.so/' /etc/httpd/conf/httpd.conf
  392. sudo sh -c "echo 'Include conf/extra/php7_module.conf' >> /etc/httpd/conf/httpd.conf"
  393. print_msg "configure php"
  394. sudo sed -i.back 's/^memory_limit.*$/memory_limit = 512M/' /etc/php/php.ini
  395. sudo sed -i.back 's/^error_reporting.*$/error_reporting = E_ALL \& ~E_NOTICE/' /etc/php/php.ini
  396. sudo sed -i.back 's/;extension=gd\.so/extension=gd.so/' /etc/php/php.ini
  397. print_question "Should we configure custom basedir folder for php? [Y|n] "
  398. read bd
  399. sql=${bd:-y}
  400. if [ "$bd" == "y" ]; then
  401. print_question "Please enter the basedir path"
  402. read basedir
  403. sudo sed -i.back "s/^open_basedir = .*$/&:${basedir}/" /etc/php/php.ini
  404. fi
  405. print_msg "configure php for mysql"
  406. sudo sed -i.back 's/;extension=pdo_mysql\.so/extension=pdo_mysql.so/' /etc/php/php.ini
  407. print_msg "configure phpmyadmin"
  408. sudo sed -i.back 's/;extension=mysqli\.so/extension=mysqli.so/' /etc/php/php.ini
  409. sudo sed -i.back 's/;extension=mcrypt\.so/extension=mcrypt.so/' /etc/php/php.ini
  410. sudo sed -i.back 's/;extension=bz2\.so/extension=bz2.so/' /etc/php/php.ini
  411. sudo sed -i.back 's/;extension=zip\.so/extension=zip.so/' /etc/php/php.ini
  412. sudo sed -i.back 's/^open_basedir = .*$/&:\/etc\/webapps\//' /etc/php/php.ini
  413. # TODO : instal drush
  414. fi
  415. }
  416. alpi_bumblebee(){
  417. # https://wiki.archlinux.org/index.php/Bumblebee
  418. print_title "Bumblebee"
  419. print_question "Install Bumblebee? [Y|n] "
  420. read yn
  421. yn=${yn:-y}
  422. if [ "$yn" == "y" ]; then
  423. sudo pacman -S --needed --no-confirm bumblebee nvidia
  424. sudo gpasswd -a $USER bumblebee
  425. sudo systemctl enable bumblebeed
  426. sudo systemctl start bumblebeed
  427. sudo pacman -S --needed --no-confirm mesa-demos
  428. print_msg "run optirun glxgears -info to test your install"
  429. print_msg "Install primus bridge for better performances"
  430. sudo pacman -S --needed --no-confirm primus lib32-primus
  431. sudo sed -i.back 's/^Bridge=auto$/Bridge=primus/' /etc/bumblebee/bumblebee.conf
  432. print_msg "Install bbswitch to turn on and off discret card automatically (only for laptops)"
  433. sudo pacman -S --needed --no-confirm bbswitch
  434. fi
  435. }
  436. alpi_steam(){
  437. # https://wiki.archlinux.org/index.php/Steam
  438. print_title "Steam"
  439. print_question "Install steam? [Y|n] "
  440. read yn
  441. yn=${yn:-y}
  442. if [ "$yn" == "y" ]; then
  443. alpi_bumblebee
  444. alpi_multilib
  445. sudo pacman -S --needed --no-confirm lib32-virtualgl lib32-mesa-libgl lib32-nvidia-utils lib32-alsa-plugins ttf-liberation lib32-curl
  446. sudo pacman -S --needed --no-confirm steam
  447. fi
  448. }
  449. # END
  450. alpi_end(){
  451. print_question "Reboot now? [Y|n] "
  452. read yn
  453. yn=${yn:-y}
  454. if [ "$yn" != "y" ]; then
  455. print_warning "depending on what you've done you may need to reboot"
  456. exit
  457. fi
  458. print_msg "Rebooting in 5sec"
  459. sleep 3
  460. reboot
  461. }
  462. alpi_menu(){
  463. while true
  464. do
  465. print_question "choose an action (preferably in proposed order)"
  466. echo
  467. action_list=("create user" "install basics" "cosmetics" "create gnupgp key" "secure the system" "install Xorg Server" "install Plasma 5 (kde)" "yaourt" "multilib" "cups (printers)" "switch to LTS kernel" "install default packages" "install lamp" "install bumblebee" "install steam" "end");
  468. select action in "${action_list[@]}"; do
  469. case "$REPLY" in
  470. 1)
  471. alpi_user
  472. ;;
  473. 2)
  474. alpi_basics
  475. ;;
  476. 3)
  477. alpi_cosmetics
  478. ;;
  479. 4)
  480. alpi_gnupg
  481. ;;
  482. 5)
  483. alpi_secure
  484. ;;
  485. 6)
  486. alpi_xserver
  487. ;;
  488. 7)
  489. alpi_plasma5
  490. ;;
  491. 8)
  492. alpi_yaourt
  493. ;;
  494. 9)
  495. alpi_multilib
  496. ;;
  497. 10)
  498. alpi_cups
  499. ;;
  500. 11)
  501. alpi_kernellts
  502. ;;
  503. 12)
  504. alpi_defaultpkgs
  505. ;;
  506. 13)
  507. alpi_lamp
  508. ;;
  509. 14)
  510. alpi_bumblebee
  511. ;;
  512. 15)
  513. alpi_steam
  514. ;;
  515. 16)
  516. alpi_end
  517. ;;
  518. *)
  519. print_warning "dommage, essaye encore"
  520. ;;
  521. esac
  522. [[ -n $OPT ]] && break
  523. done
  524. done
  525. }
  526. alpi_menu