Ver código fonte

update norisa.sh + fix arch.sh

Noah Vogt 3 anos atrás
pai
commit
f54494f203
2 arquivos alterados com 52 adições e 35 exclusões
  1. 1 0
      arch.sh
  2. 51 35
      norisa.sh

+ 1 - 0
arch.sh

@@ -33,6 +33,7 @@ p
 
 
 +${SIZE}G
+t
 82
 n
 p

+ 51 - 35
norisa.sh

@@ -1,44 +1,52 @@
 #!/bin/bash
 
-pacman -Sy --noconfirm git vim ||  { 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; }
+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; }
 
+# setup temporary sudo
+sed -i 's/# %wheel ALL=(ALL:ALL) N/%wheel ALL=(ALL:ALL) N/g' /etc/sudoers
 
+# setup doas
+echo "permit persist :wheel" > /etc/doas.conf
+chown -c root:root /etc/doas.conf
+chmod -c 0400 /etc/doas.conf
 
 # make new user
-sed -i 's/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/g' /etc/sudoers
-sed -i 's/# %wheel ALL=(ALL) NOPASSWD: ALL/%wheel ALL=(ALL) NOPASSWD: ALL/g' /etc/sudoers
 read -rp "What is your desired username? " username
 useradd -m -g users -G wheel "$username"
-passwd "$username"
+while true; do
+    passwd "$username" && break
+done
 cd /home/"$username" || exit
 
-# setting up build environment
-sudo -u "$username" mkdir -p /home/"$username"/.local/src && cd .. && chown -R "$username":wheel "$username"/.local/src/
-pwd
-ls "$username"
-
-# install aur helper (paru)
-cd /home/"$username"/.local/src || exit
-pacman -S --noconfirm asp bat devtools
-curl -sO https://aur.archlinux.org/cgit/aur.git/snapshot/paru.tar.gz &&
-tar xvf paru.tar.gz
-cd /home/"$username" && chown -R "$username":wheel /home/"$username"/.local/src/ && cd .local/src || exit
-cd paru || exit
-sudo -u "$username" makepkg --noconfirm -si
-
-pacman -S --noconfirm xorg-server xorg-xinit xorg-xwininfo xorg-xprop xorg-xbacklight xorg-xdpyinfo xorg-xsetroot 
-sudo -u "$username" paru -S --noconfirm libxft-bgra-git
-
+# create ~/ folders
 mkdir -p /home/"$username"/dox /home/"$username"/pix /home/"$username"/dl
-mkdir -p /home/"$username"/vids /home/"$username"/.local/share
+mkdir -p /home/"$username"/vids /home/"$username"/mus
 mkdir -p /home/"$username"/.local/bin /home/"$username"/.config
+mkdir -p /home/"$username"/.local/share /home/"$username"/.local/src
+
+chown -R "$username":users /home/"$username"/* /home/"$username"/.*
+
+# install aur helper (paru)
+if ! pacman -Q | grep -q paru; then
+    cd /home/"$username"/.local/src || exit
+    pacman -S --noconfirm --needed asp bat devtools
+    curl -sO https://aur.archlinux.org/cgit/aur.git/snapshot/paru-bin.tar.gz &&
+    tar xvf paru-bin.tar.gz
+    cd /home/"$username" && chown -R "$username":wheel /home/"$username"/.local/src/ && cd .local/src || exit
+    cd paru-bin || exit
+    sudo -u "$username" makepkg --noconfirm -si
+    rm /home/"$username"/.local/src/paru-bin.tar.gz
+fi
+
+# install some dependencies
+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
+yes | sudo -u "$username" paru -S --needed libxft-bgra
 
 # clone dotfiles repo
 cd /home/"$username"/.local/src || exit
 git clone https://github.com/noahvogt/dotfiles.git
 cd dotfiles || exit
-git checkout stow
-/home/"$username"/.local/src/dotfiles/apply-dotfiles
+sudo -u "$username" /home/"$username"/.local/src/dotfiles/apply-dotfiles
 
 # build dwm
 cd /home/"$username"/.local/src || exit
@@ -65,14 +73,26 @@ cd dmenu || exit
 make clean install
 
 # make user to owner of ~/ and /mnt/
-chown -R "$username":wheel /home/"$username"/
-chown -R "$username":wheel /mnt/
+chown -R "$username":users /home/"$username"/
+chown -R "$username":users /mnt/
 
-# download packages from the official repo
-pacman -S --noconfirm xorg-server xorg-xinit xorg-xwininfo xorg-xprop xorg-xbacklight xorg-xdpyinfo xorg-xsetroot picom xbindkeys jdk-openjdk geogebra shellcheck neovim ranger xournalpp ffmpeg obs-studio sxiv arandr man-db brightnessctl unzip unrar 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 unrar 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
+# download packages from the official repos
+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
 
 # install aur packages
-sudo -u "$username" paru -S --noconfirm betterlockscreen simple-mtpfs tibasicc-git redshift dashbinsh devour vim-plug lf-bin brave-bin
+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
+
+# set global zshenv
+mkdir -p /etc/zsh
+echo "export ZDOTDIR=\$HOME/.config/zsh" > /etc/zsh/zshenv
+
+# change shell to zsh
+while true; do
+    sudo -u "$username" chsh -s $(which zsh) && break
+done
+
+# remove sudo
+pacman -R --noconfirm sudo
 
 # enable tap to click
 [ ! -f /etc/X11/xorg.conf.d/40-libinput.conf ] && printf 'Section "InputClass"
@@ -84,9 +104,5 @@ sudo -u "$username" paru -S --noconfirm betterlockscreen simple-mtpfs tibasicc-g
     Option "Tapping" "on"
 EndSection' > /etc/X11/xorg.conf.d/40-libinput.conf
 
-# set global zshenv
-[ ! -d /etc/zsh ] && mkdir -p /etc/zsh
-echo "export ZDOTDIR=\$HOME/.config/zsh" > /etc/zsh/zshenv
-
-# set the real world /etc/sudoers
-sed -i "s/%wheel ALL=(ALL) NOPASSWD: ALL/${username} ALL = NOPASSWD: \/usr\/bin\/mount, \/usr\/bin\/umount/g" /etc/sudoers
+# cleanup
+rm /home/"$username"/.bash* /home/"$username"/.less*