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.

195 lines
5.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
  1. #!/bin/bash
  2. if [ ! -f "/install/device" ]; then
  3. mkdir -p /install
  4. echo "Now you will specify the partitions you have created"
  5. echo "Please enter the suffix for each partition. For Ex:"
  6. echo "1 if boot partition is /dev/sda1 or p1 if boot is on /dev/nvme0n1p1 and the disk is /dev/nvme0n1"
  7. echo -n "Please enter boot partition suffix: "
  8. read boot_p
  9. boot=$device$boot_p
  10. echo -n "Please enter root partition suffix: "
  11. read root_p
  12. root=$device$root_p
  13. echo -n "Please enter swap partition suffix: "
  14. read swap_p
  15. swap=$device$swap_p
  16. echo -n "Did you create a home partition as well?(y/N): "
  17. read home_s
  18. if [ "$home_s" = "y" ]; then
  19. echo -n "Please enter home partition suffix: "
  20. read home_p
  21. home=$device$home_p
  22. echo -en "$boot\n$root\n$swap\n$home" > /install/device
  23. else
  24. echo -en "$boot\n$root\n$swap" > /install/device
  25. fi
  26. fi
  27. boot=$(head -n 1 /install/device | tail -n 1)
  28. root=$(head -n 2 /install/device | tail -n 1)
  29. swap=$(head -n 3 /install/device | tail -n 1)
  30. if [ ! "$(wc -l /install/device)" = "3" ]; then
  31. home=$(head -n 4 /install/device | tail -n 1)
  32. fi
  33. ln -sf /usr/share/zoneinfo/Europe/Istanbul /etc/localtime
  34. hwclock --systohc
  35. echo -e "en_US.UTF-8 UTF-8\ntr_TR.UTF-8 UTF-8" > /etc/locale.gen
  36. locale-gen
  37. echo "LANG=en_US.UTF-8" > /etc/locale.conf
  38. if [ ! -f "/tmp/.blackarch" ]; then
  39. curl https://blackarch.org/strap.sh > /tmp/strap.sh
  40. chmod +x /tmp/strap.sh
  41. /tmp/strap.sh
  42. touch /tmp/.blackarch
  43. fi
  44. echo "Please enter hostname: "
  45. read hostname
  46. echo $hostname > /etc/hostname
  47. echo "Please enter name for regular user:"
  48. read username
  49. useradd -m $username
  50. usermod -aG wheel yigit
  51. systemctl enable fstrim.timer
  52. echo -e "127.0.0.1 localhost\n::1 localhost\n127.0.0.1 $hostname.localdomain $hostname" > /etc/hosts
  53. cat << EOF > /etc/initcpio/hooks/openswap
  54. run_hook ()
  55. {
  56. x=0;
  57. while [ ! -b /dev/mapper/root ] && [ \$x -le 10 ]; do
  58. x=$((x+1))
  59. sleep .2
  60. done
  61. mkdir crypto_key_device
  62. mount /dev/mapper/root crypto_key_device
  63. cryptsetup open --key-file crypto_key_device/root/.keys/swap-keyfile $swap swap
  64. umount crypto_key_device
  65. }
  66. EOF
  67. cat << EOF > /etc/initcpio/install/openswap
  68. build ()
  69. {
  70. add_runscript
  71. }
  72. help ()
  73. {
  74. cat<<HELPEOF
  75. This opens the swap encrypted partition $swap in /dev/mapper/swap
  76. HELPEOF
  77. }
  78. EOF
  79. if [ ! "$home" = "" ]; then
  80. cat << EOF > /etc/initcpio/hooks/openhome
  81. run_hook ()
  82. {
  83. x=0;
  84. while [ ! -b /dev/mapper/root ] && [ \$x -le 10 ]; do
  85. x=$((x+1))
  86. sleep .2
  87. done
  88. mkdir crypto_key_device
  89. mount /dev/mapper/root crypto_key_device
  90. cryptsetup open --key-file crypto_key_device/root/.keys/home-keyfile $home home
  91. umount crypto_key_device
  92. }
  93. EOF
  94. cat << EOF > /etc/initcpio/install/openhome
  95. build ()
  96. {
  97. add_runscript
  98. }
  99. help ()
  100. {
  101. cat<<HELPEOF
  102. This opens the swap encrypted partition $home in /dev/mapper/home
  103. HELPEOF
  104. }
  105. EOF
  106. cat << EOF > /etc/mkinitcpio.conf
  107. MODULES=(vfat i915)
  108. BINARIES=()
  109. FILES=()
  110. HOOKS=(base udev plymouth autodetect keyboard keymap consolefont modconf block plymouth-encrypt openswap openhome resume filesystems fsck)
  111. EOF
  112. else
  113. cat << EOF > /etc/mkinitcpio.conf
  114. MODULES=(vfat i915)
  115. BINARIES=()
  116. FILES=()
  117. HOOKS=(base udev plymouth autodetect keyboard keymap consolefont modconf block plymouth-encrypt openswap resume filesystems fsck)
  118. EOF
  119. fi
  120. pacman --noconfirm -R vim
  121. line=1
  122. blkid | while IFS= read -r i; do
  123. echo "$line: $i"
  124. ((line=line+1))
  125. done
  126. echo "Please select the device you will save the LUKS key to:"
  127. read keydev
  128. uuid=$(blkid | sed -n 's/.*UUID=\"\([^\"]*\)\".*/\1/p' | sed -n "$keydev"p)
  129. cat << EOF > /boot/refind_linux.conf
  130. "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"
  131. EOF
  132. mkdir -p /etc/sudoers.d
  133. echo "$username $hostname =NOPASSWD: /usr/bin/systemctl poweroff,/usr/bin/systemctl halt,/usr/bin/systemctl reboot,/usr/bin/systemctl hibernate" >> /etc/sudoers.d/wheel
  134. echo "Defaults env_reset,pwfeedback" >> /etc/sudoers.d/wheel
  135. echo "%wheel ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/nopwd
  136. echo "Set password for user $username: "
  137. passwd $username
  138. sudo -u $username bash -c "git clone https://aur.archlinux.org/yay.git /tmp/yay"
  139. sudo -u $username bash -c "(cd /tmp/yay; makepkg --noconfirm -si)"
  140. sudo -u $username bash -c "yay --noconfirm -S plymouth"
  141. refind-install
  142. sudo -u $username bash -c "git clone --recurse-submodules https://github.com/theFr1nge/dotfiles.git ~/.dotfiles"
  143. sudo -u $username bash -c "(cd ~/.dotfiles; ./install.sh)"
  144. git clone https://github.com/adi1090x/plymouth-themes.git /tmp/pthemes
  145. cat << EOF > /etc/plymouth/plymouthd.conf
  146. [Daemon]
  147. Theme=sphere
  148. ShowDelay=0
  149. DeviceTimeout=8
  150. EOF
  151. cp -r /tmp/pthemes/pack_4/sphere /usr/share/plymouth/themes
  152. echo -e "/boot/EFI/refind\n2\n2" | sudo bash -c "$(curl -fsSL https://raw.githubusercontent.com/bobafetthotmail/refind-theme-regular/master/install.sh)"
  153. systemctl enable NetworkManager
  154. systemctl enable ly
  155. systemctl enable cronie
  156. mkinitcpio -P
  157. vim /etc/fstab
  158. pacman -R nano # uninstall nano, eww
  159. rm -rf /etc/sudoers.d/nopwd
  160. echo "%wheel ALL=(ALL) ALL" >> /etc/sudoers.d/wheel
  161. rm -rf /bin/sh
  162. ln -sf /bin/dash /bin/sh
  163. echo "SETUP COMPLETE"
  164. bash
  165. rm -rf /install