norisa.sh 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #!/bin/bash
  2. pacman -Sy --noconfirm --needed git vim base-devel opendoas sudo || { printf "Error at script start:\n\nAre you sure you're running this as the root user?\n\t(Tip: run 'whoami' to check)\n\nAre you sure you have an internet connection?\n\t(Tip: run 'ip a' to check)\n"; exit; }
  3. # setup temporary sudo
  4. sed -i 's/# %wheel ALL=(ALL:ALL) N/%wheel ALL=(ALL:ALL) N/g' /etc/sudoers
  5. # setup doas
  6. echo "permit persist :wheel" > /etc/doas.conf
  7. chown -c root:root /etc/doas.conf
  8. chmod -c 0400 /etc/doas.conf
  9. # make new user
  10. read -rp "What is your desired username? " username
  11. useradd -m -g users -G wheel "$username"
  12. while true; do
  13. passwd "$username" && break
  14. done
  15. cd /home/"$username" || exit
  16. # create ~/ folders
  17. mkdir -p /home/"$username"/dox /home/"$username"/pix /home/"$username"/dl
  18. mkdir -p /home/"$username"/vids /home/"$username"/mus
  19. mkdir -p /home/"$username"/.local/bin /home/"$username"/.config
  20. mkdir -p /home/"$username"/.local/share /home/"$username"/.local/src
  21. chown -R "$username":users /home/"$username"/* /home/"$username"/.*
  22. # install aur helper (paru)
  23. if ! pacman -Q | grep -q paru; then
  24. cd /home/"$username"/.local/src || exit
  25. pacman -S --noconfirm --needed asp bat devtools
  26. curl -sO https://aur.archlinux.org/cgit/aur.git/snapshot/paru-bin.tar.gz &&
  27. tar xvf paru-bin.tar.gz
  28. cd /home/"$username" && chown -R "$username":wheel /home/"$username"/.local/src/ && cd .local/src || exit
  29. cd paru-bin || exit
  30. sudo -u "$username" makepkg --noconfirm -si
  31. rm /home/"$username"/.local/src/paru-bin.tar.gz
  32. fi
  33. # install some dependencies
  34. pacman -S --noconfirm --needed xorg-server xorg-xinit xorg-xwininfo xorg-xprop xorg-xbacklight xorg-xdpyinfo xorg-xsetroot xf86-video-modesetting xf86-video-vesa xf86-video-fbdev
  35. yes | sudo -u "$username" paru -S --needed libxft-bgra
  36. # clone dotfiles repo
  37. cd /home/"$username"/.local/src || exit
  38. git clone https://github.com/noahvogt/dotfiles.git
  39. cd dotfiles || exit
  40. sudo -u "$username" /home/"$username"/.local/src/dotfiles/apply-dotfiles
  41. # build dwm
  42. cd /home/"$username"/.local/src || exit
  43. git clone https://github.com/noahvogt/dwm.git
  44. cd dwm || exit
  45. make clean install
  46. # build st
  47. cd /home/"$username"/.local/src || exit
  48. git clone https://github.com/noahvogt/st.git
  49. cd st || exit
  50. make clean install
  51. # build dwmblocks
  52. cd /home/"$username"/.local/src || exit
  53. git clone https://github.com/noahvogt/dwmblocks.git
  54. cd dwmblocks || exit
  55. make clean install
  56. # build dmenu
  57. cd /home/"$username"/.local/src || exit
  58. git clone https://github.com/noahvogt/dmenu.git
  59. cd dmenu || exit
  60. make clean install
  61. # make user to owner of ~/ and /mnt/
  62. chown -R "$username":users /home/"$username"/
  63. chown -R "$username":users /mnt/
  64. # download packages from the official repos
  65. pacman -S --noconfirm --needed xorg-server xorg-xinit xorg-xwininfo xorg-xprop xorg-xbacklight xorg-xdpyinfo xorg-xsetroot xbindkeys jdk-openjdk geogebra shellcheck neovim ranger xournalpp ffmpeg obs-studio sxiv arandr man-db brightnessctl unzip python mupdf-gl mediainfo highlight pulseaudio-alsa pulsemixer pamixer ttf-linux-libertine calcurse xclip noto-fonts-emoji imagemagick gimp xorg-setxkbmap wavemon texlive-most dash neofetch htop wireless_tools alsa-utils acpi zip libreoffice nm-connection-editor dunst libnotify dosfstools tlp mpv xorg-xinput cpupower zsh zsh-syntax-highlighting newsboat nomacs pcmanfm openbsd-netcat powertop mupdf-tools wget nomacs stow zsh-autosuggestions xf86-video-amdgpu xf86-video-intel xf86-video-nouveau npm fzf unclutter
  66. # install aur packages
  67. sudo -u "$username" paru -S --noconfirm --needed betterlockscreen simple-mtpfs tibasicc-git redshift dashbinsh devour vim-plug lf-bin brave-bin picom-ibhagwan-git doasedit
  68. # set global zshenv
  69. mkdir -p /etc/zsh
  70. echo "export ZDOTDIR=\$HOME/.config/zsh" > /etc/zsh/zshenv
  71. # change shell to zsh
  72. while true; do
  73. sudo -u "$username" chsh -s $(which zsh) && break
  74. done
  75. # remove sudo
  76. pacman -R --noconfirm sudo
  77. # enable tap to click
  78. [ ! -f /etc/X11/xorg.conf.d/40-libinput.conf ] && printf 'Section "InputClass"
  79. Identifier "libinput touchpad catchall"
  80. MatchIsTouchpad "on"
  81. MatchDevicePath "/dev/input/event*"
  82. Driver "libinput"
  83. # Enable left mouse button by tapping
  84. Option "Tapping" "on"
  85. EndSection' > /etc/X11/xorg.conf.d/40-libinput.conf
  86. # cleanup
  87. rm /home/"$username"/.bash* /home/"$username"/.less*