archsetup

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

post-install.sh (3449B)


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