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.

240 lines
6.0 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
  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. touch /tmp/.blackarch
  46. clear
  47. fi
  48. clear
  49. echo "Please enter hostname: "
  50. read hostname
  51. echo $hostname > /etc/hostname
  52. echo "Set password for root: "
  53. passwd root
  54. echo "Please enter name for regular user:"
  55. read username
  56. useradd -m $username
  57. echo "Set password for user $username: "
  58. passwd $username
  59. usermod -aG wheel $username
  60. echo -e "127.0.0.1 localhost\n::1 localhost\n127.0.0.1 $hostname.localdomain $hostname" > /etc/hosts
  61. if [ -f "/install/encrypted" ]; then
  62. cat << EOF > /etc/initcpio/hooks/openswap
  63. run_hook ()
  64. {
  65. x=0;
  66. while [ ! -b /dev/mapper/root ] && [ \$x -le 10 ]; do
  67. x=$((x+1))
  68. sleep .2
  69. done
  70. mkdir crypto_key_device
  71. mount /dev/mapper/root crypto_key_device
  72. cryptsetup open --key-file crypto_key_device/root/.keys/swap-keyfile $swap swap
  73. umount crypto_key_device
  74. }
  75. EOF
  76. cat << EOF > /etc/initcpio/install/openswap
  77. build ()
  78. {
  79. add_runscript
  80. }
  81. help ()
  82. {
  83. cat<<HELPEOF
  84. This opens the swap encrypted partition $swap in /dev/mapper/swap
  85. HELPEOF
  86. }
  87. EOF
  88. if [ ! "$home" = "" ]; then
  89. cat << EOF > /etc/initcpio/hooks/openhome
  90. run_hook ()
  91. {
  92. x=0;
  93. while [ ! -b /dev/mapper/root ] && [ \$x -le 10 ]; do
  94. x=$((x+1))
  95. sleep .2
  96. done
  97. mkdir crypto_key_device
  98. mount /dev/mapper/root crypto_key_device
  99. cryptsetup open --key-file crypto_key_device/root/.keys/home-keyfile $home home
  100. umount crypto_key_device
  101. }
  102. EOF
  103. cat << EOF > /etc/initcpio/install/openhome
  104. build ()
  105. {
  106. add_runscript
  107. }
  108. help ()
  109. {
  110. cat<<HELPEOF
  111. This opens the swap encrypted partition $home in /dev/mapper/home
  112. HELPEOF
  113. }
  114. EOF
  115. cat << EOF > /etc/mkinitcpio.conf
  116. MODULES=(vfat i915)
  117. BINARIES=()
  118. FILES=()
  119. HOOKS=(base udev plymouth autodetect keyboard keymap consolefont modconf block plymouth-encrypt openswap openhome resume filesystems fsck)
  120. EOF
  121. else
  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 resume filesystems fsck)
  127. EOF
  128. fi
  129. else
  130. cat << EOF > /etc/mkinitcpio.conf
  131. MODULES=(vfat i915)
  132. BINARIES=()
  133. FILES=()
  134. HOOKS=(base udev plymouth autodetect keyboard keymap consolefont modconf block plymouth resume filesystems fsck)
  135. EOF
  136. fi
  137. pacman --noconfirm -R vim
  138. line=1
  139. blkid | while IFS= read -r i; do
  140. echo "$line: $i"
  141. ((line=line+1))
  142. done
  143. if [ -f "/install/encrypted" ]; then
  144. echo "Please select the device you will save the LUKS key to:"
  145. read keydev
  146. uuid=$(blkid | sed -n 's/.*UUID=\"\([^\"]*\)\".*/\1/p' | sed -n "$keydev"p)
  147. cat << EOF > /boot/refind_linux.conf
  148. "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"
  149. EOF
  150. clear
  151. else
  152. cat << EOF > /boot/refind_linux.conf
  153. "Boot with encryption" "root=UUID=$(blkid -s UUID -o value $root) resume=UUID=$(blkid -s UUID -o value $swap) rw loglevel=3 quiet splash"
  154. EOF
  155. fi
  156. mkdir -p /etc/sudoers.d
  157. echo "$username $hostname =NOPASSWD: /usr/bin/systemctl poweroff,/usr/bin/systemctl halt,/usr/bin/systemctl reboot,/usr/bin/systemctl hibernate" > /etc/sudoers.d/wheel
  158. echo "Defaults env_reset,pwfeedback" >> /etc/sudoers.d/wheel
  159. echo "%wheel ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/nopwd
  160. sudo -u $username bash -c "git clone https://aur.archlinux.org/yay.git /tmp/yay"
  161. sudo -u $username bash -c "(cd /tmp/yay; makepkg --noconfirm -si)"
  162. sudo -u $username bash -c "yay --noconfirm -S plymouth"
  163. clear
  164. sudo -u $username bash -c "git clone --recurse-submodules https://github.com/theFr1nge/dotfiles.git ~/.dotfiles"
  165. sudo -u $username bash -c "(cd ~/.dotfiles; ./install.sh)"
  166. clear
  167. git clone https://github.com/adi1090x/plymouth-themes.git /tmp/pthemes
  168. cat << EOF > /etc/plymouth/plymouthd.conf
  169. [Daemon]
  170. Theme=sphere
  171. ShowDelay=0
  172. DeviceTimeout=8
  173. EOF
  174. cp -r /tmp/pthemes/pack_4/sphere /usr/share/plymouth/themes
  175. clear
  176. refind-install
  177. echo -e "/boot/EFI/refind\n2\n2" | sudo bash -c "$(curl -fsSL https://raw.githubusercontent.com/bobafetthotmail/refind-theme-regular/master/install.sh)"
  178. systemctl enable NetworkManager
  179. systemctl enable ly
  180. systemctl enable fstrim.timer
  181. systemctl enable cronie
  182. systemctl enable bluetooth
  183. clear
  184. mkinitcpio -P
  185. if [ -f "/install/encrypted" ]; then
  186. vim /etc/fstab
  187. fi
  188. pacman --noconfirm -R nano # uninstall nano, eww
  189. clear
  190. rm -rf /etc/sudoers.d/nopwd
  191. echo "%wheel ALL=(ALL) ALL" >> /etc/sudoers.d/wheel
  192. rm -rf /bin/sh
  193. ln -sf /bin/dash /bin/sh
  194. chsh -s $(which mksh) $username
  195. clear
  196. echo "SETUP COMPLETE"
  197. bash
  198. rm -rf /install