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.

270 lines
7.2 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
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. if [ "$flexo" = "y" ]; then
  52. echo -n "Please enter ip address of flexo server: "
  53. read flexo_ip
  54. echo -e "\nServer = http://$flexo_ip:7878/\$repo/os/\$arch\n" >> /etc/pacman.d/mirrorlist
  55. fi
  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. refind-install
  156. if [ -f "/install/encrypted" ]; then
  157. line=1
  158. blkid | while IFS= read -r i; do
  159. echo "$line: $i"
  160. ((line=line+1))
  161. done
  162. echo -n "Please select the device you will save the LUKS key to: "
  163. read keydev
  164. uuid=$(blkid | sed -n 's/.*UUID=\"\([^\"]*\)\".*/\1/p' | sed -n "$keydev"p)
  165. cat << EOF > /boot/refind_linux.conf
  166. "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"
  167. EOF
  168. clear
  169. else
  170. cat << EOF > /boot/refind_linux.conf
  171. "Boot without encryption" "root=UUID=$(blkid -s UUID -o value $root) resume=UUID=$(blkid -s UUID -o value $swap) rw loglevel=3 quiet splash"
  172. EOF
  173. fi
  174. mkdir -p /etc/sudoers.d
  175. echo "Defaults env_reset,pwfeedback" >> /etc/sudoers.d/wheel
  176. echo "%wheel ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/nopwd
  177. echo "$username $hostname =NOPASSWD: /sbin/shutdown ,/sbin/halt,/sbin/reboot,/sbin/hibernate, /bin/pacman -Syyuw --noconfirm" > /etc/sudoers.d/wheel
  178. sudo -u $username bash -c "git clone https://aur.archlinux.org/yay.git /tmp/yay"
  179. sudo -u $username bash -c "(cd /tmp/yay; makepkg --noconfirm -si)"
  180. sudo -u $username bash -c "yay --noconfirm -S plymouth"
  181. if [ -f "/install/artix" ]; then
  182. sudo -u $username bash -c "yay --noconfirm -S plymouth-openrc-plugin"
  183. fi
  184. clear
  185. echo -n "Would you like to automatically install my dotfiles?(y/N): "
  186. read dotfiles
  187. if [ "$dotfiles" = "y" ]; then
  188. pacman -R --noconfirm vim
  189. sudo -u $username bash -c "git clone --recurse-submodules https://github.com/theFr1nge/dotfiles.git ~/.dotfiles"
  190. sudo -u $username bash -c "(cd ~/.dotfiles; ./install.sh)"
  191. clear
  192. git clone https://github.com/adi1090x/plymouth-themes.git /tmp/pthemes
  193. cat << EOF > /etc/plymouth/plymouthd.conf
  194. [Daemon]
  195. Theme=sphere
  196. ShowDelay=0
  197. DeviceTimeout=8
  198. EOF
  199. cp -r /tmp/pthemes/pack_4/sphere /usr/share/plymouth/themes
  200. clear
  201. fi
  202. echo -e "/boot/EFI/refind\n2\n2" | sudo bash -c "$(curl -fsSL https://raw.githubusercontent.com/bobafetthotmail/refind-theme-regular/master/install.sh)"
  203. if [ -f "/install/artix" ]; then
  204. echo "Manually enable services, not implemented"
  205. else
  206. systemctl enable NetworkManager
  207. systemctl enable ly
  208. systemctl enable fstrim.timer
  209. systemctl enable cronie
  210. systemctl enable bluetooth
  211. fi
  212. clear
  213. mkinitcpio -P
  214. if [ -f "/install/encrypted" ]; then
  215. vim /etc/fstab
  216. fi
  217. pacman --noconfirm -R nano # uninstall nano, eww
  218. clear
  219. rm -rf /etc/sudoers.d/nopwd
  220. echo "%wheel ALL=(ALL) ALL" >> /etc/sudoers.d/wheel
  221. ln -sf /bin/dash /bin/sh
  222. clear
  223. echo "SETUP COMPLETE"
  224. bash
  225. rm -rf /install