#!/usr/bin/env bash set -euo pipefail # function to keep sudo from timing out function func_dont_timeout { while true; do sudo -v sleep 60 done } # check if user is root if [ "$EUID" -ne 0 ]; then sudo -v fi # keep sudo active in background func_dont_timeout & cat </dev/null # check if the install scripts are the same # NOTE Arguments get passed automatically now if ! cmp --silent "$scriptloc" "$HOME/scripts/arch-config.sh"; then echo Removed old config file and launched new one. cp "$tempdir/arch-config/scripts/arch-config.sh" "$HOME/scripts/" && bash ~/scripts/arch-config.sh "$@" fi #################### #### Arguments #### #################### copy_firefox=0 # handle arguments if [[ "$#" -eq 1 ]]; then if [[ "$1" == "-f" || "$1" == "--firefox" ]]; then copy_firefox=1 elif [[ "$1" == "-h" || "$1" == "--help" ]]; then echo "-h, --help Show help menu" echo "-f, --firefox Update firefox config" exit 0 fi elif [[ "$#" -gt 1 ]]; then echo "Too many arguments" exit 1 fi echo cat </dev/null cp "$tempdir/bash-cat-with-cat/cat.sh" "$HOME/scripts/pieces/cat.sh" echo cat </dev/null fi # set group for libvirt if [[ $(pacman -Q | grep libvirt) ]]; then echo "Setting group for libvirt" sudo gpasswd -a "$USER" libvirt 1>/dev/null fi # set group for wireshark (only if installed) if [[ $(pacman -Q | grep wireshark-qt) ]]; then echo "Setting up group for wireshark" sudo groupadd -f wireshark sudo gpasswd -a "$USER" wireshark 1>/dev/null fi # add group for corectrl if [[ $(pacman -Q | grep corectrl) ]]; then echo "Setting up group for corectrl" sudo groupadd -f corectrl sudo gpasswd -a "$USER" corectrl 1>/dev/null fi # group for controlling backlight echo "Setting group for backlight" sudo groupadd -f video sudo gpasswd -a "$USER" video 1>/dev/null # render group echo "Setting group for GPU passing" sudo groupadd -f render sudo gpasswd -a "$USER" render 1>/dev/null # group for monitoring wireguard echo "Setting group for wireguard" sudo groupadd -f wireguard sudo gpasswd -a "$USER" wireguard 1>/dev/null echo cat <