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.

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