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.

135 lines
3.6 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
  1. #!/bin/bash
  2. if [ ! -f "/install/device" ]; then
  3. echo -n "What is the install device: "
  4. read device
  5. echo "Installing to $device... (Enter to continue)"
  6. read _
  7. mkdir -p /install
  8. echo $device > /install/device
  9. fi
  10. ln -sf /usr/share/zoneinfo/Europe/Istanbul /etc/localtime
  11. hwclock --systohc
  12. echo -e "en_US.UTF-8 UTF-8\ntr_TR.UTF-8 UTF-8" > /etc/locale.gen
  13. locale-gen
  14. echo "LANG=en_US.UTF-8" > /etc/locale.conf
  15. if [ ! -f "/tmp/.blackarch" ]; then
  16. curl https://blackarch.org/strap.sh > /tmp/strap.sh
  17. chmod +x /tmp/strap.sh
  18. /tmp/strap.sh
  19. touch /tmp/.blackarch
  20. fi
  21. echo "Please enter hostname: "
  22. read hostname
  23. echo $hostname > /etc/hostname
  24. echo "Please enter name for regular user:"
  25. read username
  26. useradd -m $username
  27. usermod -aG wheel yigit
  28. systemctl enable fstrim.timer
  29. echo -e "127.0.0.1 localhost\n::1 localhost\n127.0.0.1 $hostname.localdomain $hostname" > /etc/hosts
  30. cat << EOF > /etc/mkinitcpio.conf
  31. MODULES=(vfat i915)
  32. BINARIES=()
  33. FILES=()
  34. HOOKS=(base udev plymouth autodetect keyboard keymap consolefont modconf block plymouth-encrypt openswap resume filesystems fsck)
  35. EOF
  36. cat << EOF > /etc/initcpio/hooks/openswap
  37. run_hook ()
  38. {
  39. x=0;
  40. while [ ! -b /dev/mapper/root ] && [ \$x -le 10 ]; do
  41. x=$((x+1))
  42. sleep .2
  43. done
  44. mkdir crypto_key_device
  45. mount /dev/mapper/root crypto_key_device
  46. cryptsetup open --key-file crypto_key_device/root/.keys/swap-keyfile $(cat /install/device)2 swap
  47. umount crypto_key_device
  48. }
  49. EOF
  50. cat << EOF > /etc/initcpio/install/openswap
  51. build ()
  52. {
  53. add_runscript
  54. }
  55. help ()
  56. {
  57. cat<<HELPEOF
  58. This opens the swap encrypted partition $(cat /install/device)2 in /dev/mapper/swap
  59. HELPEOF
  60. }
  61. EOF
  62. pacman --noconfirm -R vim
  63. pacman -S --needed --noconfirm $(cat /install/nonAUR.txt)
  64. line=1
  65. blkid | while IFS= read -r i; do
  66. echo "$line: $i"
  67. ((line=line+1))
  68. done
  69. echo "Please select the device you will save the LUKS key to:"
  70. read keydev
  71. uuid=$(blkid | sed -n 's/.*UUID=\"\([^\"]*\)\".*/\1/p' | sed -n "$keydev"p)
  72. cat << EOF > /boot/refind_linux.conf
  73. "Boot with encryption" "root=/dev/mapper/root resume=/dev/mapper/swap cryptdevice=UUID=$(blkid -s UUID -o value $(cat /install/device)3):root:allow-discards cryptkey=UUID=$uuid:vfat:key.yeet rw loglevel=3 quiet splash"
  74. EOF
  75. mkdir -p /etc/sudoers.d
  76. echo "$username $hostname =NOPASSWD: /usr/bin/systemctl poweroff,/usr/bin/systemctl halt,/usr/bin/systemctl reboot,/usr/bin/systemctl hibernate" >> /etc/sudoers.d/wheel
  77. echo "Defaults env_reset,pwfeedback" >> /etc/sudoers.d/wheel
  78. echo "%wheel ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/nopwd
  79. echo "Set password for user $username: "
  80. passwd $username
  81. sudo -u $username bash -c "git clone https://aur.archlinux.org/yay.git /tmp/yay"
  82. sudo -u $username bash -c "(cd /tmp/yay; makepkg --noconfirm -si)"
  83. sudo -u $username bash -c "yay --noconfirm -S plymouth"
  84. refind-install
  85. sudo -u $username bash -c "git clone --recurse-submodules https://github.com/theFr1nge/dotfiles.git ~/.dotfiles"
  86. sudo -u $username bash -c "(cd ~/.dotfiles; ./install.sh)"
  87. git clone https://github.com/adi1090x/plymouth-themes.git /tmp/pthemes
  88. cat << EOF > /etc/plymouth/plymouthd.conf
  89. [Daemon]
  90. Theme=sphere
  91. ShowDelay=0
  92. DeviceTimeout=8
  93. EOF
  94. cp -r /tmp/pthemes/pack_4/sphere /usr/share/plymouth/themes
  95. echo -e "/boot/EFI/refind\n2\n2" | sudo bash -c "$(curl -fsSL https://raw.githubusercontent.com/bobafetthotmail/refind-theme-regular/master/install.sh)"
  96. systemctl enable NetworkManager
  97. systemctl enable ly
  98. systemctl enable cronie
  99. mkinitcpio -P
  100. vim /etc/fstab
  101. pacman -R nano # uninstall nano, eww
  102. rm -rf /etc/sudoers.d/nopwd
  103. echo "%wheel ALL=(ALL) ALL" >> /etc/sudoers.d/wheel
  104. rm -rf /bin/sh
  105. ln -sf /bin/dash /bin/sh
  106. echo "SETUP COMPLETE"
  107. bash