post-install.sh 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. #! /bin/sh
  2. echo 'Arch Linux Postinstall'
  3. echo -n "Should we start? [Y|n] "
  4. read yn
  5. yn=${yn:-y}
  6. if [ "$yn" != "y" ]; then
  7. echo "aborting script!"
  8. exit
  9. fi
  10. _cwd="$(pwd)"
  11. echo -n "Create your user? [Y|n]"
  12. read yn
  13. yn=${yn:-y}
  14. if [ "$yn" == "y" ]; then
  15. echo -n "Enter user name:"
  16. read user
  17. useradd -m -g users "$user"
  18. passwd "$user"
  19. echo "user $user created"
  20. echo "$user ALL=(ALL) ALL" >> /etc/sudoers
  21. echo "$user added to sudoers"
  22. su "$user"
  23. fi
  24. # remove root autologin
  25. sudo sed -i.back 's/--autologin root //' /etc/systemd/system/getty@tty1.service.d/autologin.conf
  26. # remove root login
  27. sudo sed -i.back 's/#auth\srequired\spam_wheel.so\suse_uid/auth required spam_wheel.so use_uid/' /etc/pam.d/su
  28. sudo sed -i.back 's/#auth\srequired\spam_wheel.so\suse_uid/auth required spam_wheel.so use_uid/' /etc/pam.d/su-l
  29. # security
  30. sudo touch /etc/sysctl.d/50-dmesg-restrict.conf
  31. sudo sh -c "echo 'kernel.dmesg_restrict = 1' >> /etc/sysctl.d/50-dmesg-restrict.conf"
  32. sudo touch /etc/sysctl.d/50-kptr-restrict.con
  33. sudo sh -c "echo 'kernel.kptr_restrict = 1' >> /etc/sysctl.d/50-kptr-restrict.conf"
  34. # Yaourt
  35. echo 'ask for editing config file before build'
  36. echo "EDITFILES=1" >> ~/.yaourtrc
  37. echo 'ILoveCandy'
  38. sudo sed -i.back 's/.*\[options\].*/&\nILoveCandy/' /etc/pacman.conf
  39. # bash & prompt
  40. echo 'Bash and Prompt'
  41. git clone https://github.com/hojhan/liquidprompt.git -o github /home/$USER/.liquidprompt
  42. cp $_cwd/assets/bash_profile /home/$USER/.bash_profile
  43. cp $_cwd/assets/bashrc /home/$USER/.bashrc
  44. mkdir /home/$USER/.config
  45. cp $_cwd/assets/liquiprompt /home/$USER/.config/
  46. # sudo pacman -S --needed --noconfirm bash-completion
  47. source /home/$USER/.bashrc
  48. # vim
  49. echo 'vim configuration'
  50. sleep 3
  51. cp $_cwp/assets/vim /home/$USER/.vim
  52. cp $_cwd/assets/vimrc /home/$USER/.vimrc
  53. sudo cp $_cwd/assets/vim /root/.vim
  54. sudo cp $_cwd/assets/vimrc /root/.vimrc
  55. echo 'Misc'
  56. sleep 3
  57. touch /home/$USER/.inputrc
  58. echo 'set show-all-if-ambiguous on' >> /home/$USER/.inputrc
  59. echo 'set completion-ignore-case on' >> /home/$USER/.inputrc
  60. echo 'Git Completion'
  61. sleep 3
  62. sudo pacman -S --needed --noconfirm bash-completion wget
  63. sudo mkdir /etc/bash_completion.d
  64. sudo wget -O /etc/bash_completion.d/git-completion.bash https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash
  65. echo 'increase inotify watch limit'
  66. sleep 3
  67. sudo cp $_cwd/assets/90-inotify.conf /etc/sysctl.d/
  68. # X server
  69. echo 'Installing Xorg server'
  70. echo -n "install Graphical Display ? [Y|n] "
  71. read yn
  72. yn=${yn:-y}
  73. if [ "$yn" == "y" ]; then
  74. sudo pacman -S --needed --noconfirm bumblebee
  75. sudo pacman -S --needed --noconfirm mesa
  76. sudo pacman -S --needed --noconfirm xf86-video-intel
  77. sudo pacman -S --needed --noconfirm nvidia
  78. sudo gpasswd -a $USER bumblebee
  79. sudo systemctl enable bumblebeed
  80. sudo reboot
  81. fi
  82. echo 'Setup a gpg encripting'
  83. echo 'see https://wiki.archlinux.org/index.php/GnuPG'
  84. echo -n "create your gpg encrypting key? [Y|n] "
  85. read yn
  86. yn=${yn:-y}
  87. if [ "$yn" == "y" ]; then
  88. gpg --full-gen-key
  89. fi
  90. echo -n "Reboot? [Y|n] "
  91. read yn
  92. yn=${yn:-y}
  93. if [ "$yn" != "y" ]; then
  94. echo "please reboot"
  95. exit
  96. fi
  97. reboot