norisa.sh 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. # need to use piped yes as --noconfirm doesn't work with package conflicts
  34. yes | sudo -u "$username" paru -S --needed libxft-bgra
  35. # clone dotfiles repo
  36. cd /home/"$username"/.local/src || exit
  37. git clone https://github.com/noahvogt/dotfiles.git
  38. cd dotfiles || exit
  39. sudo -u "$username" /home/"$username"/.local/src/dotfiles/apply-dotfiles
  40. # download packages from the official repos
  41. pacman -S --noconfirm --needed xorg-server xorg-xinit xorg-xwininfo xorg-xprop xorg-xbacklight xorg-xdpyinfo xorg-xsetroot xbindkeys xf86-video-modesetting xf86-video-vesa xf86-video-fbdev libxinerama 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
  42. # install aur packages
  43. 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
  44. # build dwm
  45. cd /home/"$username"/.local/src || exit
  46. git clone https://github.com/noahvogt/dwm.git
  47. cd dwm || exit
  48. make clean install
  49. # build st
  50. cd /home/"$username"/.local/src || exit
  51. git clone https://github.com/noahvogt/st.git
  52. cd st || exit
  53. make clean install
  54. # build dwmblocks
  55. cd /home/"$username"/.local/src || exit
  56. git clone https://github.com/noahvogt/dwmblocks.git
  57. cd dwmblocks || exit
  58. make clean install
  59. # build dmenu
  60. cd /home/"$username"/.local/src || exit
  61. git clone https://github.com/noahvogt/dmenu.git
  62. cd dmenu || exit
  63. make clean install
  64. # set global zshenv
  65. mkdir -p /etc/zsh
  66. echo "export ZDOTDIR=\$HOME/.config/zsh" > /etc/zsh/zshenv
  67. # make initial history file
  68. mkdir -p /home/"$username"/.cache/zsh
  69. touch /home/"$username"/.cache/zsh/history
  70. # make user to owner of ~/ and /mnt/
  71. chown -R "$username":users /home/"$username"/
  72. chown -R "$username":users /mnt/
  73. # change shell to zsh
  74. while true; do
  75. sudo -u "$username" chsh -s $(which zsh) && break
  76. done
  77. # remove sudo
  78. pacman -R --noconfirm sudo
  79. # enable tap to click
  80. [ ! -f /etc/X11/xorg.conf.d/40-libinput.conf ] && printf 'Section "InputClass"
  81. Identifier "libinput touchpad catchall"
  82. MatchIsTouchpad "on"
  83. MatchDevicePath "/dev/input/event*"
  84. Driver "libinput"
  85. # Enable left mouse button by tapping
  86. Option "Tapping" "on"
  87. EndSection' > /etc/X11/xorg.conf.d/40-libinput.conf
  88. # cleanup
  89. rm /home/"$username"/.bash* /home/"$username"/.less*