Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

249 lines
6.4 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. #!/bin/bash
  2. ln -sf /bin/bash /bin/sh
  3. if [ ! -f "/install/device" ]; then
  4. mkdir -p /install
  5. echo "Now you will specify the partitions you have created"
  6. echo "Please enter the suffix for each partition. For Ex:"
  7. echo "1 if boot partition is /dev/sda1 or p1 if boot is on /dev/nvme0n1p1 and the disk is /dev/nvme0n1"
  8. echo -n "Please enter boot partition suffix: "
  9. read boot_p
  10. boot=$device$boot_p
  11. echo -n "Please enter root partition suffix: "
  12. read root_p
  13. root=$device$root_p
  14. echo -n "Please enter swap partition suffix: "
  15. read swap_p
  16. swap=$device$swap_p
  17. echo -n "Did you create a home partition as well?(y/N): "
  18. read home_s
  19. if [ "$home_s" = "y" ]; then
  20. echo -n "Please enter home partition suffix: "
  21. read home_p
  22. home=$device$home_p
  23. echo -en "$boot\n$root\n$swap\n$home" > /install/device
  24. else
  25. echo -en "$boot\n$root\n$swap" > /install/device
  26. fi
  27. fi
  28. clear
  29. boot=$(head -n 1 /install/device | tail -n 1)
  30. root=$(head -n 2 /install/device | tail -n 1)
  31. swap=$(head -n 3 /install/device | tail -n 1)
  32. if [ ! "$(wc -l /install/device)" = "3" ]; then
  33. home=$(head -n 4 /install/device | tail -n 1)
  34. fi
  35. ln -sf /usr/share/zoneinfo/Europe/Istanbul /etc/localtime
  36. hwclock --systohc
  37. echo -e "en_US.UTF-8 UTF-8\ntr_TR.UTF-8 UTF-8" > /etc/locale.gen
  38. locale-gen
  39. echo "LANG=en_US.UTF-8" > /etc/locale.conf
  40. if [ ! -f "/tmp/.blackarch" ]; then
  41. echo -e "\n[multilib]\nInclude = /etc/pacman.d/mirrorlist" >> /etc/pacman.conf
  42. curl https://blackarch.org/strap.sh > /tmp/strap.sh
  43. chmod +x /tmp/strap.sh
  44. /tmp/strap.sh
  45. echo -e "[multilib]\nInclude = /etc/pacman.d/mirrorlist\n\n[options]\nILoveCandy\nTotalDownload\nColor"
  46. pacman -Syy
  47. touch /tmp/.blackarch
  48. echo -n "Did any errors occur?(y/N): "
  49. read errors
  50. while [ "$errors" = "y" ]; do
  51. echo "Dropping you into a shell so that you can fix them, once you quit the shell, the installation will continue from where you left off."
  52. bash
  53. done
  54. fi
  55. clear
  56. echo "Please enter hostname: "
  57. read hostname
  58. echo $hostname > /etc/hostname
  59. echo "Set password for root: "
  60. passwd root
  61. echo "Please enter name for regular user:"
  62. read username
  63. useradd -m $username
  64. echo "Set password for user $username: "
  65. passwd $username
  66. usermod -aG wheel $username
  67. echo -e "127.0.0.1 localhost\n::1 localhost\n127.0.0.1 $hostname.localdomain $hostname" > /etc/hosts
  68. if [ -f "/install/encrypted" ]; then
  69. cat << EOF > /etc/initcpio/hooks/openswap
  70. run_hook ()
  71. {
  72. x=0;
  73. while [ ! -b /dev/mapper/root ] && [ \$x -le 10 ]; do
  74. x=$((x+1))
  75. sleep .2
  76. done
  77. mkdir crypto_key_device
  78. mount /dev/mapper/root crypto_key_device
  79. cryptsetup open --key-file crypto_key_device/root/.keys/swap-keyfile $swap swap
  80. umount crypto_key_device
  81. }
  82. EOF
  83. cat << EOF > /etc/initcpio/install/openswap
  84. build ()
  85. {
  86. add_runscript
  87. }
  88. help ()
  89. {
  90. cat<<HELPEOF
  91. This opens the swap encrypted partition $swap in /dev/mapper/swap
  92. HELPEOF
  93. }
  94. EOF
  95. if [ ! "$home" = "" ]; then
  96. cat << EOF > /etc/initcpio/hooks/openhome
  97. run_hook ()
  98. {
  99. x=0;
  100. while [ ! -b /dev/mapper/root ] && [ \$x -le 10 ]; do
  101. x=$((x+1))
  102. sleep .2
  103. done
  104. mkdir crypto_key_device
  105. mount /dev/mapper/root crypto_key_device
  106. cryptsetup open --key-file crypto_key_device/root/.keys/home-keyfile $home home
  107. umount crypto_key_device
  108. }
  109. EOF
  110. cat << EOF > /etc/initcpio/install/openhome
  111. build ()
  112. {
  113. add_runscript
  114. }
  115. help ()
  116. {
  117. cat<<HELPEOF
  118. This opens the swap encrypted partition $home in /dev/mapper/home
  119. HELPEOF
  120. }
  121. EOF
  122. cat << EOF > /etc/mkinitcpio.conf
  123. MODULES=(vfat i915)
  124. BINARIES=()
  125. FILES=()
  126. HOOKS=(base udev plymouth autodetect keyboard keymap consolefont modconf block plymouth-encrypt openswap openhome resume filesystems fsck)
  127. EOF
  128. else
  129. cat << EOF > /etc/mkinitcpio.conf
  130. MODULES=(vfat i915)
  131. BINARIES=()
  132. FILES=()
  133. HOOKS=(base udev plymouth autodetect keyboard keymap consolefont modconf block plymouth-encrypt openswap resume filesystems fsck)
  134. EOF
  135. fi
  136. else
  137. cat << EOF > /etc/mkinitcpio.conf
  138. MODULES=(vfat i915)
  139. BINARIES=()
  140. FILES=()
  141. HOOKS=(base udev plymouth autodetect keyboard keymap consolefont modconf block plymouth resume filesystems fsck)
  142. EOF
  143. fi
  144. pacman --noconfirm -R vim
  145. line=1
  146. blkid | while IFS= read -r i; do
  147. echo "$line: $i"
  148. ((line=line+1))
  149. done
  150. if [ -f "/install/encrypted" ]; then
  151. echo "Please select the device you will save the LUKS key to:"
  152. read keydev
  153. uuid=$(blkid | sed -n 's/.*UUID=\"\([^\"]*\)\".*/\1/p' | sed -n "$keydev"p)
  154. cat << EOF > /boot/refind_linux.conf
  155. "Boot with encryption" "root=/dev/mapper/root resume=/dev/mapper/swap cryptdevice=UUID=$(blkid -s UUID -o value $root):root:allow-discards cryptkey=UUID=$uuid:vfat:key.yeet rw loglevel=3 quiet splash"
  156. EOF
  157. clear
  158. else
  159. cat << EOF > /boot/refind_linux.conf
  160. "Boot with encryption" "root=UUID=$(blkid -s UUID -o value $root) resume=UUID=$(blkid -s UUID -o value $swap) rw loglevel=3 quiet splash"
  161. EOF
  162. fi
  163. mkdir -p /etc/sudoers.d
  164. echo "$username $hostname =NOPASSWD: /usr/bin/systemctl poweroff,/usr/bin/systemctl halt,/usr/bin/systemctl reboot,/usr/bin/systemctl hibernate" > /etc/sudoers.d/wheel
  165. echo "Defaults env_reset,pwfeedback" >> /etc/sudoers.d/wheel
  166. echo "%wheel ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/nopwd
  167. sudo -u $username bash -c "git clone https://aur.archlinux.org/yay.git /tmp/yay"
  168. sudo -u $username bash -c "(cd /tmp/yay; makepkg --noconfirm -si)"
  169. sudo -u $username bash -c "yay --noconfirm -S plymouth"
  170. clear
  171. sudo -u $username bash -c "git clone --recurse-submodules https://github.com/theFr1nge/dotfiles.git ~/.dotfiles"
  172. sudo -u $username bash -c "(cd ~/.dotfiles; ./install.sh)"
  173. clear
  174. git clone https://github.com/adi1090x/plymouth-themes.git /tmp/pthemes
  175. cat << EOF > /etc/plymouth/plymouthd.conf
  176. [Daemon]
  177. Theme=sphere
  178. ShowDelay=0
  179. DeviceTimeout=8
  180. EOF
  181. cp -r /tmp/pthemes/pack_4/sphere /usr/share/plymouth/themes
  182. clear
  183. refind-install
  184. echo -e "/boot/EFI/refind\n2\n2" | sudo bash -c "$(curl -fsSL https://raw.githubusercontent.com/bobafetthotmail/refind-theme-regular/master/install.sh)"
  185. systemctl enable NetworkManager
  186. systemctl enable ly
  187. systemctl enable fstrim.timer
  188. systemctl enable cronie
  189. systemctl enable bluetooth
  190. clear
  191. mkinitcpio -P
  192. if [ -f "/install/encrypted" ]; then
  193. vim /etc/fstab
  194. fi
  195. pacman --noconfirm -R nano # uninstall nano, eww
  196. clear
  197. rm -rf /etc/sudoers.d/nopwd
  198. echo "%wheel ALL=(ALL) ALL" >> /etc/sudoers.d/wheel
  199. rm -rf /bin/sh
  200. ln -sf /bin/dash /bin/sh
  201. chsh -s $(which mksh) $username
  202. clear
  203. echo "SETUP COMPLETE"
  204. bash
  205. rm -rf /install