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.

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