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.

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