archsetup

bootstrapping script for Arch Linux
git clone git://git.hanetzok.net/archsetup
Log | Files | Refs | README

post-install.sh (3241B)


      1 #!/bin/sh
      2 
      3 set -e
      4 
      5 # variables used in the script
      6 user="markus"
      7 hostname="totoro"
      8 tz="Europe/Berlin"
      9 locale="de_DE.UTF-8"
     10 suckless="git://git.hanetzok.net"
     11 
     12 ### functions
     13 
     14 slinstall() {
     15 	sudo -u "$user" git clone "$suckless"/"$1" /home/"$user"/src/"$1"
     16 	cd /home/"$user"/src/"$1"
     17 	sudo -u "$user" make && make install
     18 }
     19 
     20 if [ "$EUID" -ne 0 ]
     21   then echo "Please run as root"
     22   exit
     23 fi
     24 
     25 # enable multilib repo and run system update
     26 echo "[multilib]" >> /etc/pacman.conf
     27 echo "Include = /etc/pacman.d/mirrorlist" >> /etc/pacman.conf
     28 pacman -Syu --noconfirm --needed zsh
     29 
     30 cp ./progs.list /tmp
     31 cp ./aur.list /tmp
     32 cd /tmp
     33 
     34 echo "Set root password..."
     35 passwd
     36 
     37 # user creation
     38 echo "Add user..."
     39 useradd -m -G wheel -s /usr/bin/zsh $user
     40 echo "%wheel ALL=(ALL:ALL) ALL" >> /etc/sudoers
     41 echo "Set user password..."
     42 passwd markus
     43 
     44 # timezone & locale
     45 echo "Set timezone and locale..."
     46 echo "$locale UTF-8" >> /etc/locale.gen
     47 locale-gen
     48 echo "LANG=$locale" >> /etc/locale.conf
     49 ln -sf /usr/share/zoneinfo/"$tz" /etc/localtime
     50 
     51 # set hostname
     52 echo "$hostname" > /etc/hostname
     53 
     54 # delete comments from progs.list
     55 sed '/^#/d' progs.list > ./progscleared.list
     56 
     57 # install packages
     58 echo "Installing packages from the official repos..."
     59 while IFS=$'\n' read -r prog; do
     60 	echo "Installing $prog..."
     61 	pacman --noconfirm --needed -S "$prog" > /dev/null
     62 done < ./progscleared.list
     63 
     64 rm ./progscleared.list
     65 
     66 # check if yay is already installed
     67 if ! hash yay
     68 then
     69 	echo "Download and install yay..."
     70 	git clone https://aur.archlinux.org/yay-bin /opt/yay-bin
     71 	chown "$user":"$user" -R /opt/yay-bin
     72 	cd /opt/yay-bin
     73 	sudo -u "$user" makepkg -si > /dev/null
     74 	cd /tmp
     75 fi
     76 
     77 # install GRUB (UEFI)
     78 echo "Install grub..."
     79 grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB > /dev/null
     80 grub-mkconfig -o /boot/grub/grub.cfg > /dev/null
     81 
     82 # set GRUB theme
     83 git clone https://github.com/dracula/grub.git /tmp/grub
     84 mv /tmp/grub/dracula /boot/grub/themes
     85 echo "GRUB_THEME=/boot/grub/themes/dracula/theme.txt" >> /etc/default/grub
     86 grub-mkconfig -o /boot/grub/grub.cfg
     87 
     88 # set ZDOTDIR in zshenv to keep $HOME clean(er)
     89 echo 'export ZDOTDIR="$HOME/.config/zsh"' >> /etc/zsh/zshenv
     90 
     91 # disable hardware speaker bell
     92 rmmod pcspkr
     93 echo "blacklist pcspkr" > /etc/modprobe.d/nobeep.conf
     94 
     95 # dotfiles
     96 echo "Get dotfiles..."
     97 rm -f /home/$user/.bash*
     98 git clone git://git.hanetzok.net/dotfiles /tmp/dotfiles
     99 cp -r /tmp/dotfiles/.* /home/$user/
    100 chown $user:$user -R /home/$user
    101 
    102 # install stuff via git
    103 git clone "https://github.com/alexwlchan/dominant_colours.git" /tmp/dominant_colours
    104 chown "$user":"$user" /tmp/dominant_colours && cd /tmp/dominant_colours
    105 sudo -u "$user" rustup default stable
    106 sudo -u "$user" cargo install --path .
    107 
    108 # install suckless suite
    109 sudo -u "$user" mkdir /home/"$user"/src
    110 slinstall dwm
    111 slinstall st
    112 slinstall dmenu
    113 
    114 
    115 # misc
    116 echo "auth       optional     pam_gnome_keyring.so">> /etc/pam.d/login
    117 echo "session    optional     pam_gnome_keyring.so auto_start" >> /etc/pam.d/login
    118 
    119 systemctl enable NetworkManager
    120 systemctl enable cups
    121 
    122 # install from AUR
    123 clear
    124 echo "Installing packages from the AUR - User interaction needed!"
    125 while IFS='\n' read -r aur; do
    126 	echo "Installing $aur..."
    127 	sudo -u "$user" yay -S $prog > /dev/null
    128 done < ./aur.list