summaryrefslogtreecommitdiff
path: root/public/thesiah.sh
diff options
context:
space:
mode:
Diffstat (limited to 'public/thesiah.sh')
-rwxr-xr-xpublic/thesiah.sh1016
1 files changed, 508 insertions, 508 deletions
diff --git a/public/thesiah.sh b/public/thesiah.sh
index 5c00b9c..162f698 100755
--- a/public/thesiah.sh
+++ b/public/thesiah.sh
@@ -20,273 +20,273 @@ export TERM=ansi
### FUNCTIONS ###
installpkg() {
- pacman --noconfirm --needed -S "$1" >/dev/null 2>&1
+ pacman --noconfirm --needed -S "$1" >/dev/null 2>&1
}
error() {
- # Log to stderr and exit with failure.
- printf "%s\n" "$1" >&2
- exit 1
+ # Log to stderr and exit with failure.
+ printf "%s\n" "$1" >&2
+ exit 1
}
welcomemsg() {
- whiptail --title "Welcome!" \
- --msgbox "Welcome to Soomin's Auto-Rice Bootstrapping Script!\\n\\nThis script will automatically install a fully-featured Linux desktop, which I use as my main machine.\\n\\n-Soomin" 10 60
+ whiptail --title "Welcome!" \
+ --msgbox "Welcome to Soomin's Auto-Rice Bootstrapping Script!\\n\\nThis script will automatically install a fully-featured Linux desktop, which I use as my main machine.\\n\\n-Soomin" 10 60
- whiptail --title "Important Note!" --yes-button "All ready!" \
- --no-button "Return..." \
- --yesno "Be sure the computer you are using has current pacman updates and refreshed Arch keyrings.\\n\\nIf it does not, the installation of some programs might fail." 8 70
+ whiptail --title "Important Note!" --yes-button "All ready!" \
+ --no-button "Return..." \
+ --yesno "Be sure the computer you are using has current pacman updates and refreshed Arch keyrings.\\n\\nIf it does not, the installation of some programs might fail." 8 70
}
shcheck() {
- CURRENT_SHELL=$(readlink /bin/sh)
- whiptail --title "Checking system to start the installation!"
- if [ "${CURRENT_SHELL##*/}" = "dash" ]; then
- whiptail --infobox "/bin/sh is linked to dash. Switching to bash..." 10 60 3>&1 1>&2 2>&3 3>&1
- if command -v bash >/dev/null 2>&1; then
- sudo ln -sfT /bin/bash /bin/sh
- whiptail --infobox "/bin/sh is now linked to bash." 10 60 3>&1 1>&2 2>&3 3>&1
- else
- whiptail --infobox "bash is not installed on your system." 10 60 3>&1 1>&2 2>&3 3>&1
- exit 1
- fi
+ CURRENT_SHELL=$(readlink /bin/sh)
+ whiptail --title "Checking system to start the installation!"
+ if [ "${CURRENT_SHELL##*/}" = "dash" ]; then
+ whiptail --infobox "/bin/sh is linked to dash. Switching to bash..." 10 60 3>&1 1>&2 2>&3 3>&1
+ if command -v bash >/dev/null 2>&1; then
+ sudo ln -sfT /bin/bash /bin/sh
+ whiptail --infobox "/bin/sh is now linked to bash." 10 60 3>&1 1>&2 2>&3 3>&1
+ else
+ whiptail --infobox "bash is not installed on your system." 10 60 3>&1 1>&2 2>&3 3>&1
+ exit 1
fi
+ fi
}
getuserandpass() {
- # Prompts user for new username an password.
- name=$(whiptail --inputbox "First, please enter a name for the user account." 10 60 3>&1 1>&2 2>&3 3>&1) || exit 1
- while ! echo "$name" | grep -q "^[a-z_][a-z0-9_-]*$"; do
- name=$(whiptail --nocancel --inputbox "Username not valid. Give a username beginning with a letter, with only lowercase letters, - or _." 10 60 3>&1 1>&2 2>&3 3>&1)
- done
- pass1=$(whiptail --nocancel --passwordbox "Enter a password for that user." 10 60 3>&1 1>&2 2>&3 3>&1)
+ # Prompts user for new username an password.
+ name=$(whiptail --inputbox "First, please enter a name for the user account." 10 60 3>&1 1>&2 2>&3 3>&1) || exit 1
+ while ! echo "$name" | grep -q "^[a-z_][a-z0-9_-]*$"; do
+ name=$(whiptail --nocancel --inputbox "Username not valid. Give a username beginning with a letter, with only lowercase letters, - or _." 10 60 3>&1 1>&2 2>&3 3>&1)
+ done
+ pass1=$(whiptail --nocancel --passwordbox "Enter a password for that user." 10 60 3>&1 1>&2 2>&3 3>&1)
+ pass2=$(whiptail --nocancel --passwordbox "Retype password." 10 60 3>&1 1>&2 2>&3 3>&1)
+ while ! [ "$pass1" = "$pass2" ]; do
+ unset pass2
+ pass1=$(whiptail --nocancel --passwordbox "Passwords do not match.\\n\\nEnter password again." 10 60 3>&1 1>&2 2>&3 3>&1)
pass2=$(whiptail --nocancel --passwordbox "Retype password." 10 60 3>&1 1>&2 2>&3 3>&1)
- while ! [ "$pass1" = "$pass2" ]; do
- unset pass2
- pass1=$(whiptail --nocancel --passwordbox "Passwords do not match.\\n\\nEnter password again." 10 60 3>&1 1>&2 2>&3 3>&1)
- pass2=$(whiptail --nocancel --passwordbox "Retype password." 10 60 3>&1 1>&2 2>&3 3>&1)
- done
- epass1=$(whiptail --nocancel --passwordbox "Enter a password for ecryptfs which will be used to set up an encrypt folder." 10 60 3>&1 1>&2 2>&3 3>&1)
+ done
+ epass1=$(whiptail --nocancel --passwordbox "Enter a password for ecryptfs which will be used to set up an encrypt folder." 10 60 3>&1 1>&2 2>&3 3>&1)
+ epass2=$(whiptail --nocancel --passwordbox "Retype password." 10 60 3>&1 1>&2 2>&3 3>&1)
+ while ! [ "$epass1" = "$epass2" ]; do
+ unset epass2
+ epass1=$(whiptail --nocancel --passwordbox "Passwords do not match.\\n\\nEnter password again." 10 60 3>&1 1>&2 2>&3 3>&1)
epass2=$(whiptail --nocancel --passwordbox "Retype password." 10 60 3>&1 1>&2 2>&3 3>&1)
- while ! [ "$epass1" = "$epass2" ]; do
- unset epass2
- epass1=$(whiptail --nocancel --passwordbox "Passwords do not match.\\n\\nEnter password again." 10 60 3>&1 1>&2 2>&3 3>&1)
- epass2=$(whiptail --nocancel --passwordbox "Retype password." 10 60 3>&1 1>&2 2>&3 3>&1)
- done
+ done
}
repocheck() {
- putrepo=$(whiptail --inputbox "Do you want to clone TheSiahxyz's repositories? y/n" 10 60 3>&1 1>&2 2>&3 3>&1) || exit 1
- while [ "$putrepo" != "y" ] && [ "$putrepo" != "n" ]; do
- putrepo=$(whiptail --inputbox "Invalid option! Choose 'y' or 'n'.\nDo you want to clone TheSiahxyz's repositories? y/n" 10 60 3>&1 1>&2 2>&3 3>&1) || exit 1
- done
+ putrepo=$(whiptail --inputbox "Do you want to clone TheSiahxyz's repositories? y/n" 10 60 3>&1 1>&2 2>&3 3>&1) || exit 1
+ while [ "$putrepo" != "y" ] && [ "$putrepo" != "n" ]; do
+ putrepo=$(whiptail --inputbox "Invalid option! Choose 'y' or 'n'.\nDo you want to clone TheSiahxyz's repositories? y/n" 10 60 3>&1 1>&2 2>&3 3>&1) || exit 1
+ done
}
usercheck() {
- ! { id -u "$name" >/dev/null 2>&1; } ||
- whiptail --title "WARNING" --yes-button "CONTINUE" \
- --no-button "No wait..." \
- --yesno "The user \`$name\` already exists on this system. SI can install for a user already existing, but it will OVERWRITE any conflicting settings/dotfiles on the user account.\\n\\nSI will NOT overwrite your user files, documents, videos, etc., so don't worry about that, but only click <CONTINUE> if you don't mind your settings being overwritten.\\n\\nNote also that SI will change $name's password to the one you just gave." 14 70
+ ! { id -u "$name" >/dev/null 2>&1; } ||
+ whiptail --title "WARNING" --yes-button "CONTINUE" \
+ --no-button "No wait..." \
+ --yesno "The user \`$name\` already exists on this system. SI can install for a user already existing, but it will OVERWRITE any conflicting settings/dotfiles on the user account.\\n\\nSI will NOT overwrite your user files, documents, videos, etc., so don't worry about that, but only click <CONTINUE> if you don't mind your settings being overwritten.\\n\\nNote also that SI will change $name's password to the one you just gave." 14 70
}
preinstallmsg() {
- whiptail --title "Let's get this party started!" --yes-button "Let's go!" \
- --no-button "No, nevermind!" \
- --yesno "The rest of the installation will now be totally automated, so you can sit back and relax.\\n\\nIt will take some time, but when done, you can relax even more with your complete system.\\n\\nNow just press <Let's go!> and the system will begin installation!" 13 60 || {
- clear
- exit 1
- }
+ whiptail --title "Let's get this party started!" --yes-button "Let's go!" \
+ --no-button "No, nevermind!" \
+ --yesno "The rest of the installation will now be totally automated, so you can sit back and relax.\\n\\nIt will take some time, but when done, you can relax even more with your complete system.\\n\\nNow just press <Let's go!> and the system will begin installation!" 13 60 || {
+ clear
+ exit 1
+ }
}
adduserandpass() {
- # Adds user `$name` with password $pass1.
- whiptail --infobox "Adding user \"$name\"..." 7 50
- useradd -m -g wheel -G storage,power,video,audio -s /bin/zsh "$name" >/dev/null 2>&1 ||
- usermod -a -G wheel,storage,power,video,audio "$name" && mkdir -p \
- "/home/$name/.config" \
- "/home/$name/.local/bin" \
- "/home/$name/.local/share/history" \
- "/home/$name/.local/share/wallpapers" \
- "/home/$name/.local/src" \
- "/home/$name/Desktop" \
- "/home/$name/Documents" \
- "/home/$name/Downloads" \
- "/home/$name/Music" \
- "/home/$name/Pictures" \
- "/home/$name/Private/repos" \
- "/home/$name/Public" \
- "/home/$name/Torrents/complete" \
- "/home/$name/Torrents/incomplete" \
- "/media/$name/flash" \
- "/mnt/second" \
- "/home/$name" && echo "This is a private folder." >"/home/$name/Private/README.md" && chown -R "$name":wheel /home/"$name"
- export repodir="/home/$name/.local/src"
- mkdir -p "$repodir"
- chown -R "$name":wheel "$(dirname "$repodir")"
- echo "$name:$pass1" | chpasswd
+ # Adds user `$name` with password $pass1.
+ whiptail --infobox "Adding user \"$name\"..." 7 50
+ useradd -m -g wheel -G storage,power,video,audio -s /bin/zsh "$name" >/dev/null 2>&1 ||
+ usermod -a -G wheel,storage,power,video,audio "$name" && mkdir -p \
+ "/home/$name/.config" \
+ "/home/$name/.local/bin" \
+ "/home/$name/.local/share/history" \
+ "/home/$name/.local/share/wallpapers" \
+ "/home/$name/.local/src" \
+ "/home/$name/Desktop" \
+ "/home/$name/Documents" \
+ "/home/$name/Downloads" \
+ "/home/$name/Music" \
+ "/home/$name/Pictures" \
+ "/home/$name/Private/repos" \
+ "/home/$name/Public" \
+ "/home/$name/Torrents/complete" \
+ "/home/$name/Torrents/incomplete" \
+ "/media/$name/flash" \
+ "/mnt/second" \
+ "/home/$name" && echo "This is a private folder." >"/home/$name/Private/README.md" && chown -R "$name":wheel /home/"$name"
+ export repodir="/home/$name/.local/src"
+ mkdir -p "$repodir"
+ chown -R "$name":wheel "$(dirname "$repodir")"
+ echo "$name:$pass1" | chpasswd
}
refreshkeys() {
- case "$(readlink -f /sbin/init)" in
- *systemd*)
- whiptail --infobox "Refreshing Arch Keyring..." 7 40
- pacman --noconfirm -S archlinux-keyring >/dev/null 2>&1
- installpkg arch-install-scripts
- ;;
- *)
- whiptail --infobox "Enabling Arch Repositories for more a more extensive software collection..." 7 40
- pacman --noconfirm --needed -S \
- artix-keyring artix-archlinux-support >/dev/null 2>&1
- grep -q "^\[extra\]" /etc/pacman.conf ||
- printf '[extra]
+ case "$(readlink -f /sbin/init)" in
+ *systemd*)
+ whiptail --infobox "Refreshing Arch Keyring..." 7 40
+ pacman --noconfirm -S archlinux-keyring >/dev/null 2>&1
+ installpkg arch-install-scripts
+ ;;
+ *)
+ whiptail --infobox "Enabling Arch Repositories for more a more extensive software collection..." 7 40
+ pacman --noconfirm --needed -S \
+ artix-keyring artix-archlinux-support >/dev/null 2>&1
+ grep -q "^\[extra\]" /etc/pacman.conf ||
+ printf '[extra]
Include = /etc/pacman.d/mirrorlist-arch
[multilib]
Include = /etc/pacman.d/mirrorlist-arch' >>/etc/pacman.conf
- pacman -Sy --noconfirm >/dev/null 2>&1
- pacman-key --populate archlinux >/dev/null 2>&1
- installpkg artools-base
- ;;
- esac
+ pacman -Sy --noconfirm >/dev/null 2>&1
+ pacman-key --populate archlinux >/dev/null 2>&1
+ installpkg artools-base
+ ;;
+ esac
}
manualinstall() {
- # Installs $1 manually. Used only for AUR helper here.
- # Should be run after repodir is created and var is set.
- pacman -Qq "$1" && return 0
- whiptail --infobox "Installing \"$1\" manually." 7 50
- sudo -u "$name" mkdir -p "$repodir/$1"
- sudo -u "$name" git -C "$repodir" clone --depth 1 --single-branch \
- --no-tags -q "https://aur.archlinux.org/$1.git" "$repodir/$1" >/dev/null 2>&1 ||
- {
- cd "$repodir/$1" || return 1
- sudo -u "$name" git pull --force origin master >/dev/null 2>&1
- }
- cd "$repodir/$1" || exit 1
- sudo -u "$name" sh -c "cd '$repodir/$1' && makepkg --noconfirm -si >/dev/null 2>&1" || exit 1
+ # Installs $1 manually. Used only for AUR helper here.
+ # Should be run after repodir is created and var is set.
+ pacman -Qq "$1" && return 0
+ whiptail --infobox "Installing \"$1\" manually." 7 50
+ sudo -u "$name" mkdir -p "$repodir/$1"
+ sudo -u "$name" git -C "$repodir" clone --depth 1 --single-branch \
+ --no-tags -q "https://aur.archlinux.org/$1.git" "$repodir/$1" >/dev/null 2>&1 ||
+ {
+ cd "$repodir/$1" || return 1
+ sudo -u "$name" git pull --force origin master >/dev/null 2>&1
+ }
+ cd "$repodir/$1" || exit 1
+ sudo -u "$name" sh -c "cd '$repodir/$1' && makepkg --noconfirm -si >/dev/null 2>&1" || exit 1
}
maininstall() {
- # Installs all needed programs from master repo.
- whiptail --title "SI Installation" --infobox "Installing \`$1\` ($n of $total). $1 $2" 9 70
- installpkg "$1"
+ # Installs all needed programs from master repo.
+ whiptail --title "SI Installation" --infobox "Installing \`$1\` ($n of $total). $1 $2" 9 70
+ installpkg "$1"
}
gitmakeinstall() {
- progname="${1##*/}"
- progname="${progname%.git}"
- dir="$repodir/$progname"
- whiptail --title "SI Installation" \
- --infobox "Installing \`$progname\` ($n of $total) via \`git\` and \`make\`. $(basename "$1") $2" 8 70
- sudo -u "$name" git -C "$repodir" clone --depth 1 --single-branch \
- --no-tags -q "$1" "$dir" ||
- {
- cd "$dir" || return 1
- sudo -u "$name" git pull --force origin master
- }
- # Check the repository name and act accordingly for suckless
- case "$progname" in
- "suckless")
- for sub in "${dir}/"*; do
- cd "$sub" || continue
- make >/dev/null 2>&1
- make install >/dev/null 2>&1
- done
- ;;
- *)
- cd "$dir" || exit 1
- make >/dev/null 2>&1
- make install >/dev/null 2>&1
- ;;
- esac
- cd /tmp || return 1
+ progname="${1##*/}"
+ progname="${progname%.git}"
+ dir="$repodir/$progname"
+ whiptail --title "SI Installation" \
+ --infobox "Installing \`$progname\` ($n of $total) via \`git\` and \`make\`. $(basename "$1") $2" 8 70
+ sudo -u "$name" git -C "$repodir" clone --depth 1 --single-branch \
+ --no-tags -q "$1" "$dir" ||
+ {
+ cd "$dir" || return 1
+ sudo -u "$name" git pull --force origin master
+ }
+ # Check the repository name and act accordingly for suckless
+ case "$progname" in
+ "suckless")
+ for sub in "${dir}/"*; do
+ cd "$sub" || continue
+ make >/dev/null 2>&1
+ make install >/dev/null 2>&1
+ done
+ ;;
+ *)
+ cd "$dir" || exit 1
+ make >/dev/null 2>&1
+ make install >/dev/null 2>&1
+ ;;
+ esac
+ cd /tmp || return 1
}
aurinstall() {
- whiptail --title "SI Installation" \
- --infobox "Installing \`$1\` ($n of $total) from the AUR. $1 $2" 9 70
- echo "$aurinstalled" | grep -q "^$1$"
- sudo -u "$name" $aurhelper -S --noconfirm "$1" >/dev/null 2>&1
+ whiptail --title "SI Installation" \
+ --infobox "Installing \`$1\` ($n of $total) from the AUR. $1 $2" 9 70
+ echo "$aurinstalled" | grep -q "^$1$"
+ sudo -u "$name" $aurhelper -S --noconfirm "$1" >/dev/null 2>&1
}
pipinstall() {
- whiptail --title "SI Installation" \
- --infobox "Installing the Python package \`$1\` ($n of $total). $1 $2" 9 70
- [ -x "$(command -v "pip")" ] || installpkg python-pip >/dev/null 2>&1
- [ -x "$(command -v "pipx")" ] || installpkg python-pipx >/dev/null 2>&1
- yes | pip install "$1" >/dev/null 2>&1 || yes | pipx install "$1" >/dev/null 2>&1
+ whiptail --title "SI Installation" \
+ --infobox "Installing the Python package \`$1\` ($n of $total). $1 $2" 9 70
+ [ -x "$(command -v "pip")" ] || installpkg python-pip >/dev/null 2>&1
+ [ -x "$(command -v "pipx")" ] || installpkg python-pipx >/dev/null 2>&1
+ yes | pip install "$1" >/dev/null 2>&1 || yes | pipx install "$1" >/dev/null 2>&1
}
# runit
initinstall() {
- initpkg="$1-$initsys"
- whiptail --title "SI Installation" \
- --infobox "Installing the package \`$1\` and the corresponding init package \'$initpkg'\ ($n of $total). $1 $initpkg $2" 9 70
- installpkg "$1" && installpkg "$1-$initsys" || error "Failed to install package $1 and init package $initpkg"
+ initpkg="$1-$initsys"
+ whiptail --title "SI Installation" \
+ --infobox "Installing the package \`$1\` and the corresponding init package \'$initpkg'\ ($n of $total). $1 $initpkg $2" 9 70
+ installpkg "$1" && installpkg "$1-$initsys" || error "Failed to install package $1 and init package $initpkg"
}
installationloop() {
- ([ -f "$progsfile" ] && cp "$progsfile" /tmp/progs.csv) ||
- curl -Ls "$progsfile" | sed '/^#/d' >/tmp/progs.csv
- total=$(wc -l </tmp/progs.csv)
- aurinstalled=$(pacman -Qqm)
- while IFS=, read -r tag program comment; do
- n=$((n + 1))
- echo "$comment" | grep -q "^\".*\"$" &&
- comment="$(echo "$comment" | sed -E "s/(^\"|\"$)//g")"
- case "$tag" in
- "A") aurinstall "$program" "$comment" ;;
- "I")
- case "$(readlink -f /sbin/init)" in
- *systemd*) maininstall "$program" "$comment" ;;
- *) initinstall "$program" "$comment" ;;
- esac
- ;;
- "G") gitmakeinstall "$program" "$comment" ;;
- "P") pipinstall "$program" "$comment" ;;
- *) maininstall "$program" "$comment" ;;
- esac
- done </tmp/progs.csv
+ ([ -f "$progsfile" ] && cp "$progsfile" /tmp/progs.csv) ||
+ curl -Ls "$progsfile" | sed '/^#/d' >/tmp/progs.csv
+ total=$(wc -l </tmp/progs.csv)
+ aurinstalled=$(pacman -Qqm)
+ while IFS=, read -r tag program comment; do
+ n=$((n + 1))
+ echo "$comment" | grep -q "^\".*\"$" &&
+ comment="$(echo "$comment" | sed -E "s/(^\"|\"$)//g")"
+ case "$tag" in
+ "A") aurinstall "$program" "$comment" ;;
+ "I")
+ case "$(readlink -f /sbin/init)" in
+ *systemd*) maininstall "$program" "$comment" ;;
+ *) initinstall "$program" "$comment" ;;
+ esac
+ ;;
+ "G") gitmakeinstall "$program" "$comment" ;;
+ "P") pipinstall "$program" "$comment" ;;
+ *) maininstall "$program" "$comment" ;;
+ esac
+ done </tmp/progs.csv
}
putgitrepo() {
- # Downloads a gitrepo $1 and places the files in $2 only overwriting conflicts
- whiptail --infobox "Downloading and installing config files..." 7 60
- [ -z "$3" ] && branch="master" || branch="$repobranch"
- dir=$(mktemp -d)
- [ ! -d "$2" ] && mkdir -p "$2"
- chown "$name":wheel "$dir" "$2"
- sudo -u "$name" git -C "$repodir" clone --depth 1 \
- --single-branch --no-tags -q --recursive -b "$branch" \
- --recurse-submodules "$1" "$dir"
- sudo -u "$name" cp -rfT "$dir" "$2"
+ # Downloads a gitrepo $1 and places the files in $2 only overwriting conflicts
+ whiptail --infobox "Downloading and installing config files..." 7 60
+ [ -z "$3" ] && branch="master" || branch="$repobranch"
+ dir=$(mktemp -d)
+ [ ! -d "$2" ] && mkdir -p "$2"
+ chown "$name":wheel "$dir" "$2"
+ sudo -u "$name" git -C "$repodir" clone --depth 1 \
+ --single-branch --no-tags -q --recursive -b "$branch" \
+ --recurse-submodules "$1" "$dir"
+ sudo -u "$name" cp -rfT "$dir" "$2"
}
vimplugininstall() {
- # Installs vim plugins.
- whiptail --infobox "Installing vim plugins..." 7 60
- mkdir -p "/home/$name/.config/vim/autoload"
- curl -Ls "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" >"/home/$name/.config/vim/autoload/plug.vim"
- chown -R "$name:wheel" "/home/$name/.config/vim"
- NVIM_APPNAME=TheSiahxyz nvim --headless "+Lazy! sync" +qa
+ # Installs vim plugins.
+ whiptail --infobox "Installing vim plugins..." 7 60
+ mkdir -p "/home/$name/.config/vim/autoload"
+ curl -Ls "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" >"/home/$name/.config/vim/autoload/plug.vim"
+ chown -R "$name:wheel" "/home/$name/.config/vim"
+ NVIM_APPNAME=TheSiahxyz nvim --headless "+Lazy! sync" +qa
}
makeuserjs() {
- # Get the Arkenfox user.js and prepare it.
- arkenfox="$sipdir/arkenfox.js"
- overrides="$sipdir/user-overrides.js"
- userjs="$sipdir/user.js"
- ln -fs "/home/$name/.config/firefox/thesiah.js" "$overrides"
- [ ! -f "$arkenfox" ] && curl -sL "https://raw.githubusercontent.com/arkenfox/user.js/master/user.js" >"$arkenfox"
- chown "$name:wheel" "$arkenfox" "$userjs"
- cat "$arkenfox" "$overrides" >"$userjs"
- # Install the updating script.
- mkdir -p /usr/local/lib /etc/pacman.d/hooks
- cp "/home/$name/.local/bin/arkenfox-auto-update" /usr/local/lib/
- chown root:root /usr/local/lib/arkenfox-auto-update
- chmod 755 /usr/local/lib/arkenfox-auto-update
- # Trigger the update when needed via a pacman hook.
- printf '[Trigger]
+ # Get the Arkenfox user.js and prepare it.
+ arkenfox="$sipdir/arkenfox.js"
+ overrides="$sipdir/user-overrides.js"
+ userjs="$sipdir/user.js"
+ ln -fs "/home/$name/.config/firefox/thesiah.js" "$overrides"
+ [ ! -f "$arkenfox" ] && curl -sL "https://raw.githubusercontent.com/arkenfox/user.js/master/user.js" >"$arkenfox"
+ chown "$name:wheel" "$arkenfox" "$userjs"
+ cat "$arkenfox" "$overrides" >"$userjs"
+ # Install the updating script.
+ mkdir -p /usr/local/lib /etc/pacman.d/hooks
+ cp "/home/$name/.local/bin/arkenfox-auto-update" /usr/local/lib/
+ chown root:root /usr/local/lib/arkenfox-auto-update
+ chmod 755 /usr/local/lib/arkenfox-auto-update
+ # Trigger the update when needed via a pacman hook.
+ printf '[Trigger]
Operation = Upgrade
Type = Package
Target = firefox
@@ -300,360 +300,360 @@ Exec=/usr/local/lib/arkenfox-auto-update' >/etc/pacman.d/hooks/arkenfox.hook
}
installffaddons() {
- addonlist="ublock-origin decentraleyes istilldontcareaboutcookies vimium-ff sponsorblock enhancerforyouTube adblock-plus languagetool darkreader livemarks traduzir-paginas-web video-downloadhelper passff"
- addontmp="$(mktemp -d)"
- trap 'rm -rf "$addontmp"' HUP INT QUIT TERM PWR EXIT
- IFS=' '
- sudo -u "$name" mkdir -p "$sipdir/extensions/"
- for addon in $addonlist; do
- if [ "$addon" = "ublock-origin" ]; then
- addonurl="$(curl -sL https://api.github.com/repos/gorhill/uBlock/releases/latest | grep -E 'browser_download_url.*\.firefox\..*xpi' | cut -d '"' -f 4)"
- else
- addonurl="$(curl -s "https://addons.mozilla.org/en-US/firefox/addon/${addon}/" | grep -o 'https://addons.mozilla.org/firefox/downloads/file/[^"]*')"
- fi
- file="${addonurl##*/}"
- sudo -u "$name" curl -LOs "$addonurl" >"$addontmp/$file"
- id="$(unzip -p "$file" manifest.json | grep "\"id\"")"
- id="${id%\"*}"
- id="${id##*\"}"
- mv "$file" "$sipdir/extensions/$id.xpi"
- done
- chown -R "$name:$name" "$sipdir/extensions"
+ addonlist="ublock-origin decentraleyes istilldontcareaboutcookies vimium-ff sponsorblock enhancerforyouTube adblock-plus languagetool darkreader livemarks traduzir-paginas-web video-downloadhelper passff"
+ addontmp="$(mktemp -d)"
+ trap 'rm -rf "$addontmp"' HUP INT QUIT TERM PWR EXIT
+ IFS=' '
+ sudo -u "$name" mkdir -p "$sipdir/extensions/"
+ for addon in $addonlist; do
+ if [ "$addon" = "ublock-origin" ]; then
+ addonurl="$(curl -sL https://api.github.com/repos/gorhill/uBlock/releases/latest | grep -E 'browser_download_url.*\.firefox\..*xpi' | cut -d '"' -f 4)"
+ else
+ addonurl="$(curl -s "https://addons.mozilla.org/en-US/firefox/addon/${addon}/" | grep -o 'https://addons.mozilla.org/firefox/downloads/file/[^"]*')"
+ fi
+ file="${addonurl##*/}"
+ sudo -u "$name" curl -LOs "$addonurl" >"$addontmp/$file"
+ id="$(unzip -p "$file" manifest.json | grep "\"id\"")"
+ id="${id%\"*}"
+ id="${id##*\"}"
+ mv "$file" "$sipdir/extensions/$id.xpi"
+ done
+ chown -R "$name:$name" "$sipdir/extensions"
}
librewolfsetup() {
- whiptail --infobox "Setting browser privacy settings and add-ons..." 7 60
+ whiptail --infobox "Setting browser privacy settings and add-ons..." 7 60
- browserdir="/home/$name/.librewolf"
- profilesini="$browserdir/profiles.ini"
+ browserdir="/home/$name/.librewolf"
+ profilesini="$browserdir/profiles.ini"
- sudo -u "$name" librewolf --headless >/dev/null 2>&1 &
- sleep 1
- profile="$(sed -En '/Default=.*\.default-(default|release)/s/.*=//p' "$profilesini")"
- pdir="$browserdir/$profile"
- siprofile="si.default"
- sipdir="$browserdir/$siprofile"
+ sudo -u "$name" librewolf --headless >/dev/null 2>&1 &
+ sleep 1
+ profile="$(sed -En '/Default=.*\.default-(default|release)/s/.*=//p' "$profilesini")"
+ pdir="$browserdir/$profile"
+ siprofile="si.default"
+ sipdir="$browserdir/$siprofile"
- if [ -d "$pdir" ]; then
- mv "$pdir" "$sipdir"
- sed -i "s/$profile/$siprofile/g" "$profilesini"
+ if [ -d "$pdir" ]; then
+ mv "$pdir" "$sipdir"
+ sed -i "s/$profile/$siprofile/g" "$profilesini"
- makeuserjs
- installffaddons
- else
- error "User exited."
- fi
+ makeuserjs
+ installffaddons
+ else
+ error "User exited."
+ fi
- pkill -u "$name" librewolf
+ pkill -u "$name" librewolf
}
addsudo() {
- echo "%wheel ALL=(ALL:ALL) ALL" >/etc/sudoers.d/00-thesiah-wheel-can-sudo
- echo "%wheel ALL=(ALL:ALL) NOPASSWD: /usr/bin/shutdown,/usr/bin/reboot,/usr/bin/systemctl suspend,/usr/bin/wifi-menu,/usr/bin/mount,/usr/bin/umount,/usr/bin/lsblk,/usr/bin/pacman -Syu,/usr/bin/pacman -Syyu,/usr/bin/pacman -Syyu --noconfirm,/usr/bin/loadkeys,/usr/bin/pacman -Syyuw --noconfirm,/usr/bin/pacman -S -y --config /etc/pacman.conf --,/usr/bin/pacman -S -y -u --config /etc/pacman.conf --,/usr/bin/cat" >/etc/sudoers.d/01-thesiah-cmds-without-password
- echo "Defaults editor=/usr/bin/nvim" >/etc/sudoers.d/02-thesiah-visudo-editor
- mkdir -p /etc/sysctl.d
- echo "kernel.dmesg_restrict = 0" >/etc/sysctl.d/dmesg.conf
+ echo "%wheel ALL=(ALL:ALL) ALL" >/etc/sudoers.d/00-thesiah-wheel-can-sudo
+ echo "%wheel ALL=(ALL:ALL) NOPASSWD: /usr/bin/shutdown,/usr/bin/reboot,/usr/bin/systemctl suspend,/usr/bin/wifi-menu,/usr/bin/mount,/usr/bin/umount,/usr/bin/lsblk,/usr/bin/pacman -Syu,/usr/bin/pacman -Syyu,/usr/bin/pacman -Syyu --noconfirm,/usr/bin/loadkeys,/usr/bin/pacman -Syyuw --noconfirm,/usr/bin/pacman -S -y --config /etc/pacman.conf --,/usr/bin/pacman -S -y -u --config /etc/pacman.conf --,/usr/bin/cat" >/etc/sudoers.d/01-thesiah-cmds-without-password
+ echo "Defaults editor=/usr/bin/nvim" >/etc/sudoers.d/02-thesiah-visudo-editor
+ mkdir -p /etc/sysctl.d
+ echo "kernel.dmesg_restrict = 0" >/etc/sysctl.d/dmesg.conf
- # Cleanup
- rm -f /etc/sudoers.d/thesiah-temp
+ # Cleanup
+ rm -f /etc/sudoers.d/thesiah-temp
}
pamgnupg() {
- whiptail --infobox "Setting up pam-gnupg..." 7 50
- $aurhelper -Qq pam-gnupg >/dev/null 2>&1 || aurinstall pam-gnupg
- pacman -Qq pam_mount >/dev/null 2>&1 || installpkg pam_mount
- sleep 3
- grep -Eq "auth\s+optional\s+pam_gnupg.so store-only" /etc/pam.d/system-local-login || echo "auth optional pam_gnupg.so store-only" >>/etc/pam.d/system-local-login
- grep -Eq "session\s+optional\s+pam_gnupg.so" /etc/pam.d/system-local-login || echo "session optional pam_gnupg.so" >>/etc/pam.d/system-local-login
- grep -Eq "auth\s+optional\s+pam_mount.so" /etc/pam.d/system-login || sed -i "/auth requisite pam_nologin.so/a auth optional pam_mount.so" /etc/pam.d/system-login
- grep -Eq "password\s+optional\s+pam_mount.so" /etc/pam.d/system-login || sed -i "/password include system-auth/i password optional pam_mount.so " /etc/pam.d/system-login
- grep -Eq "session\s+\[success=1 default=ignore\]\s+pam_succeed_if.so\s+service = systemd-user quiet" /etc/pam.d/system-login || sed -i "/session optional pam_keyinit.so force revoke/a session [success=1 default=ignore] pam_succeed_if.so service = systemd-user quiet\nsession optional pam_mount.so" /etc/pam.d/system-login
+ whiptail --infobox "Setting up pam-gnupg..." 7 50
+ $aurhelper -Qq pam-gnupg >/dev/null 2>&1 || aurinstall pam-gnupg
+ pacman -Qq pam_mount >/dev/null 2>&1 || installpkg pam_mount
+ sleep 3
+ grep -Eq "auth\s+optional\s+pam_gnupg.so store-only" /etc/pam.d/system-local-login || echo "auth optional pam_gnupg.so store-only" >>/etc/pam.d/system-local-login
+ grep -Eq "session\s+optional\s+pam_gnupg.so" /etc/pam.d/system-local-login || echo "session optional pam_gnupg.so" >>/etc/pam.d/system-local-login
+ grep -Eq "auth\s+optional\s+pam_mount.so" /etc/pam.d/system-login || sed -i "/auth requisite pam_nologin.so/a auth optional pam_mount.so" /etc/pam.d/system-login
+ grep -Eq "password\s+optional\s+pam_mount.so" /etc/pam.d/system-login || sed -i "/password include system-auth/i password optional pam_mount.so " /etc/pam.d/system-login
+ grep -Eq "session\s+\[success=1 default=ignore\]\s+pam_succeed_if.so\s+service = systemd-user quiet" /etc/pam.d/system-login || sed -i "/session optional pam_keyinit.so force revoke/a session [success=1 default=ignore] pam_succeed_if.so service = systemd-user quiet\nsession optional pam_mount.so" /etc/pam.d/system-login
}
ecryptfssetup() {
- whiptail --infobox "Setting up ecryptfs..." 7 50
- [ -x "$(command -v "ecryptfs")" ] || installpkg ecryptfs-utils
- [ -d "/home/$name/.secret" ] || mkdir -p "/home/$name/.secret"
- [ -d "/home/$name/Private" ] || mkdir -p "/home/$name/Private"
- chown "$name":wheel "/home/$name/.secret"
- chown "$name":wheel "/home/$name/Private"
-
- # Ecrypt the folder
- [ -d /root/.ecryptfs ] && rm -rf /root/.ecryptfs
- sleep 1
- printf '\nyes\nyes\n' | mount -t ecryptfs /home/"$name"/.secret /home/"$name"/Private -o ecryptfs_passthrough=n,ecryptfs_enable_filename_crypto=y,passphrase_passwd="$epass1",ecryptfs_cipher=aes,ecryptfs_key_bytes=32 >/dev/null 2>&1
- sleep 1
- umount /home/"$name"/Private >/dev/null 2>&1
- sleep 1
+ whiptail --infobox "Setting up ecryptfs..." 7 50
+ [ -x "$(command -v "ecryptfs")" ] || installpkg ecryptfs-utils
+ [ -d "/home/$name/.secret" ] || mkdir -p "/home/$name/.secret"
+ [ -d "/home/$name/Private" ] || mkdir -p "/home/$name/Private"
+ chown "$name":wheel "/home/$name/.secret"
+ chown "$name":wheel "/home/$name/Private"
+
+ # Ecrypt the folder
+ [ -d /root/.ecryptfs ] && rm -rf /root/.ecryptfs
+ sleep 1
+ printf '\nyes\nyes\n' | mount -t ecryptfs /home/"$name"/.secret /home/"$name"/Private -o ecryptfs_passthrough=n,ecryptfs_enable_filename_crypto=y,passphrase_passwd="$epass1",ecryptfs_cipher=aes,ecryptfs_key_bytes=32 >/dev/null 2>&1
+ sleep 1
+ umount /home/"$name"/Private >/dev/null 2>&1
+ sleep 1
}
ufwsetup() {
- whiptail --infobox "Setting up ufw..." 7 50
- [ -x "$(command -v "ufw")" ] || installpkg ufw
- [ ! "$initsys" = "systemd" ] && {
- pacman -Qq ufw-"$initsys" >/dev/null 2>&1 || installpkg ufw-"$initsys"
- }
+ whiptail --infobox "Setting up ufw..." 7 50
+ [ -x "$(command -v "ufw")" ] || installpkg ufw
+ [ ! "$initsys" = "systemd" ] && {
+ pacman -Qq ufw-"$initsys" >/dev/null 2>&1 || installpkg ufw-"$initsys"
+ }
+ sleep 1
+ ufw --force reload >/dev/null 2>&1
+ ufw default deny incoming >/dev/null 2>&1
+ ufw allow 80 >/dev/null 2>&1
+ ufw allow 443 >/dev/null 2>&1
+ ufw allow 25/tcp >/dev/null 2>&1
+ ufw allow 587/tcp >/dev/null 2>&1
+ ufw allow 3478/udp >/dev/null 2>&1
+ ufw allow 5349/tcp >/dev/null 2>&1
+ ufw allow 10000/udp >/dev/null 2>&1
+ ufw allow in ssh >/dev/null 2>&1
+ ufw allow in IMAPS >/dev/null 2>&1
+ ufw allow in POP3 >/dev/null 2>&1
+ ufw allow in SMTP >/dev/null 2>&1
+ ufw allow in 'WWW Full' >/dev/null 2>&1
+ ufw allow in 'Postfix SMTPS' >/dev/null 2>&1
+ ufw allow in 'Mail Submission' >/dev/null 2>&1
+ ufw --force reload >/dev/null 2>&1
+ sleep 1
+ case "$initsys" in
+ "runit")
+ ln -sf /etc/runit/sv/ufw /run/runit/service/ >/dev/null 2>&1
sleep 1
- ufw --force reload >/dev/null 2>&1
- ufw default deny incoming >/dev/null 2>&1
- ufw allow 80 >/dev/null 2>&1
- ufw allow 443 >/dev/null 2>&1
- ufw allow 25/tcp >/dev/null 2>&1
- ufw allow 587/tcp >/dev/null 2>&1
- ufw allow 3478/udp >/dev/null 2>&1
- ufw allow 5349/tcp >/dev/null 2>&1
- ufw allow 10000/udp >/dev/null 2>&1
- ufw allow in ssh >/dev/null 2>&1
- ufw allow in IMAPS >/dev/null 2>&1
- ufw allow in POP3 >/dev/null 2>&1
- ufw allow in SMTP >/dev/null 2>&1
- ufw allow in 'WWW Full' >/dev/null 2>&1
- ufw allow in 'Postfix SMTPS' >/dev/null 2>&1
- ufw allow in 'Mail Submission' >/dev/null 2>&1
- ufw --force reload >/dev/null 2>&1
+ sv start ufw >/dev/null 2>&1 || sv force-restart ufw >/dev/null 2>&1
+ ;;
+ "openrc")
+ rc-update add ufw default >/dev/null 2>&1
sleep 1
- case "$initsys" in
- "runit")
- ln -sf /etc/runit/sv/ufw /run/runit/service/ >/dev/null 2>&1
- sleep 1
- sv start ufw >/dev/null 2>&1 || sv force-restart ufw >/dev/null 2>&1
- ;;
- "openrc")
- rc-update add ufw default >/dev/null 2>&1
- sleep 1
- rc-service ufw start >/dev/null 2>&1
- ;;
- "s6")
- ln -sf /etc/s6/sv/ufw /run/s6/services/ >/dev/null 2>&1
- sleep 1
- s6-svc -u /run/s6/services/ufw >/dev/null 2>&1
- ;;
- "systemd")
- systemctl restart ufw
- ;;
- esac
+ rc-service ufw start >/dev/null 2>&1
+ ;;
+ "s6")
+ ln -sf /etc/s6/sv/ufw /run/s6/services/ >/dev/null 2>&1
+ sleep 1
+ s6-svc -u /run/s6/services/ufw >/dev/null 2>&1
+ ;;
+ "systemd")
+ systemctl restart ufw
+ ;;
+ esac
}
sambasetup() {
- whiptail --infobox "Setting up samba..." 7 50
- [ -x "$(command -v "samba")" ] || installpkg samba
- [ ! "$initsys" = "systemd" ] && {
- pacman -Qq samba-"$initsys" >/dev/null 2>&1 || installpkg samba-"$initsys"
- }
+ whiptail --infobox "Setting up samba..." 7 50
+ [ -x "$(command -v "samba")" ] || installpkg samba
+ [ ! "$initsys" = "systemd" ] && {
+ pacman -Qq samba-"$initsys" >/dev/null 2>&1 || installpkg samba-"$initsys"
+ }
+ sleep 1
+ ufw allow 137/tcp >/dev/null 2>&1
+ ufw allow 137/udp >/dev/null 2>&1
+ ufw allow 138/tcp >/dev/null 2>&1
+ ufw allow 138/udp >/dev/null 2>&1
+ ufw allow 139/tcp >/dev/null 2>&1
+ ufw allow 445/tcp >/dev/null 2>&1
+ ufw --force reload >/dev/null 2>&1
+ [ -f /etc/samba/smb.conf ] || touch /etc/samba/smb.conf
+ sleep 1
+ printf "$pass1" | smbpasswd -a "$name" >/dev/null 2>&1
+ sleep 1
+ case "$initsys" in
+ "runit")
+ ln -sf /etc/runit/sv/smbd /run/runit/service/ >/dev/null 2>&1
+ ln -sf /etc/runit/sv/nmbd /run/runit/service/ >/dev/null 2>&1
sleep 1
- ufw allow 137/tcp >/dev/null 2>&1
- ufw allow 137/udp >/dev/null 2>&1
- ufw allow 138/tcp >/dev/null 2>&1
- ufw allow 138/udp >/dev/null 2>&1
- ufw allow 139/tcp >/dev/null 2>&1
- ufw allow 445/tcp >/dev/null 2>&1
- ufw --force reload >/dev/null 2>&1
- [ -f /etc/samba/smb.conf ] || touch /etc/samba/smb.conf
+ sv start smbd >/dev/null 2>&1 || sv force-restart smbd >/dev/null 2>&1
+ sv start nmbd >/dev/null 2>&1 || sv force-restart nmbd >/dev/null 2>&1
+ ;;
+ "openrc")
+ rc-update add samba default >/dev/null 2>&1
sleep 1
- printf "$pass1" | smbpasswd -a "$name" >/dev/null 2>&1
+ rc-service samba start >/dev/null 2>&1
+ ;;
+ "s6")
+ ln -sf /etc/s6/sv/smbd /run/s6/services/ >/dev/null 2>&1
+ ln -sf /etc/s6/sv/nmbd /run/s6/services/ >/dev/null 2>&1
sleep 1
- case "$initsys" in
- "runit")
- ln -sf /etc/runit/sv/smbd /run/runit/service/ >/dev/null 2>&1
- ln -sf /etc/runit/sv/nmbd /run/runit/service/ >/dev/null 2>&1
- sleep 1
- sv start smbd >/dev/null 2>&1 || sv force-restart smbd >/dev/null 2>&1
- sv start nmbd >/dev/null 2>&1 || sv force-restart nmbd >/dev/null 2>&1
- ;;
- "openrc")
- rc-update add samba default >/dev/null 2>&1
- sleep 1
- rc-service samba start >/dev/null 2>&1
- ;;
- "s6")
- ln -sf /etc/s6/sv/smbd /run/s6/services/ >/dev/null 2>&1
- ln -sf /etc/s6/sv/nmbd /run/s6/services/ >/dev/null 2>&1
- sleep 1
- s6-svc -u /run/s6/services/smbd >/dev/null 2>&1
- s6-svc -u /run/s6/services/nmbd >/dev/null 2>&1
- ;;
- "systemd")
- systemctl restart smbd
- systemctl restart nmbd
- ;;
- esac
+ s6-svc -u /run/s6/services/smbd >/dev/null 2>&1
+ s6-svc -u /run/s6/services/nmbd >/dev/null 2>&1
+ ;;
+ "systemd")
+ systemctl restart smbd
+ systemctl restart nmbd
+ ;;
+ esac
}
bluezsetup() {
- whiptail --infobox "Setting up bluetooth..." 7 50
- pacman -Qq bluez >/dev/null 2>&1 || installpkg bluez
- [ ! "$initsys" = "systemd" ] && {
- pacman -Qq bluez-"$initsys" >/dev/null 2>&1 || installpkg bluez-"$initsys"
- }
- sleep 3
- case "$initsys" in
- "runit")
- ln -sf /etc/runit/sv/bluetoothd /run/runit/service/ >/dev/null 2>&1
- sleep 1
- sv start bluetoothd >/dev/null 2>&1 || sv force-restart bluetoothd >/dev/null 2>&1
- ;;
- "openrc")
- rc-update add bluetoothd default >/dev/null 2>&1
- sleep 1
- rc-service bluetoothd start >/dev/null 2>&1
- ;;
- "s6")
- ln -sf /etc/s6/sv/bluetoothd /run/s6/services/ >/dev/null 2>&1
- sleep 1
- s6-svc -u /run/s6/services/bluetoothd >/dev/null 2>&1
- ;;
- "systemd")
- systemctl restart bluetooth
- ;;
- esac
+ whiptail --infobox "Setting up bluetooth..." 7 50
+ pacman -Qq bluez >/dev/null 2>&1 || installpkg bluez
+ [ ! "$initsys" = "systemd" ] && {
+ pacman -Qq bluez-"$initsys" >/dev/null 2>&1 || installpkg bluez-"$initsys"
+ }
+ sleep 3
+ case "$initsys" in
+ "runit")
+ ln -sf /etc/runit/sv/bluetoothd /run/runit/service/ >/dev/null 2>&1
+ sleep 1
+ sv start bluetoothd >/dev/null 2>&1 || sv force-restart bluetoothd >/dev/null 2>&1
+ ;;
+ "openrc")
+ rc-update add bluetoothd default >/dev/null 2>&1
+ sleep 1
+ rc-service bluetoothd start >/dev/null 2>&1
+ ;;
+ "s6")
+ ln -sf /etc/s6/sv/bluetoothd /run/s6/services/ >/dev/null 2>&1
+ sleep 1
+ s6-svc -u /run/s6/services/bluetoothd >/dev/null 2>&1
+ ;;
+ "systemd")
+ systemctl restart bluetooth
+ ;;
+ esac
}
cronsetup() {
- whiptail --infobox "Setting up cronjob..." 7 50
- pacman -Qq cronie >/dev/null 2>&1 || installpkg cronie
- [ ! "$initsys" = "systemd" ] && {
- pacman -Qq cronie-"$initsys" >/dev/null 2>&1 || installpkg cronie-"$initsys"
- }
+ whiptail --infobox "Setting up cronjob..." 7 50
+ pacman -Qq cronie >/dev/null 2>&1 || installpkg cronie
+ [ ! "$initsys" = "systemd" ] && {
+ pacman -Qq cronie-"$initsys" >/dev/null 2>&1 || installpkg cronie-"$initsys"
+ }
+ sleep 1
+ [ -f "${XDG_CONFIG_HOME:-$HOME/.config}"/crons ] &&
+ crontab -u "$name" - <"${XDG_CONFIG_HOME:-$HOME/.config}"/crons &&
+ rm "${XDG_CONFIG_HOME:-$HOME/.config}"/crons
+ sleep 3
+ case "$initsys" in
+ "runit")
+ ln -sf /etc/runit/sv/cronie /run/runit/service/ >/dev/null 2>&1
sleep 1
- [ -f "${XDG_CONFIG_HOME:-$HOME/.config}"/crons ] &&
- crontab -u "$name" - <"${XDG_CONFIG_HOME:-$HOME/.config}"/crons &&
- rm "${XDG_CONFIG_HOME:-$HOME/.config}"/crons
- sleep 3
- case "$initsys" in
- "runit")
- ln -sf /etc/runit/sv/cronie /run/runit/service/ >/dev/null 2>&1
- sleep 1
- sv start cronie >/dev/null 2>&1 || sv force-restart cronie >/dev/null 2>&1
- ;;
- "openrc")
- rc-update add cronie default >/dev/null 2>&1
- sleep 1
- rc-service cronie start >/dev/null 2>&1
- ;;
- "s6")
- ln -sf /etc/s6/sv/cronie /run/s6/services/ >/dev/null 2>&1
- sleep 1
- s6-svc -u /run/s6/services/cronie >/dev/null 2>&1
- ;;
- "systemd")
- systemctl restart cronie
- ;;
- esac
+ sv start cronie >/dev/null 2>&1 || sv force-restart cronie >/dev/null 2>&1
+ ;;
+ "openrc")
+ rc-update add cronie default >/dev/null 2>&1
+ sleep 1
+ rc-service cronie start >/dev/null 2>&1
+ ;;
+ "s6")
+ ln -sf /etc/s6/sv/cronie /run/s6/services/ >/dev/null 2>&1
+ sleep 1
+ s6-svc -u /run/s6/services/cronie >/dev/null 2>&1
+ ;;
+ "systemd")
+ systemctl restart cronie
+ ;;
+ esac
}
tlpsetup() {
- whiptail --infobox "Setting up tlp..." 7 50
- [ -x "$(command -v "tlp")" ] || installpkg tlp
- [ ! "$initsys" = "systemd" ] && {
- pacman -Qq tlp-"$initsys" >/dev/null 2>&1 || installpkg tlp-"$initsys"
- }
- sleep 1
- printf 'TLP_DEFAULT_MODE=AC
+ whiptail --infobox "Setting up tlp..." 7 50
+ [ -x "$(command -v "tlp")" ] || installpkg tlp
+ [ ! "$initsys" = "systemd" ] && {
+ pacman -Qq tlp-"$initsys" >/dev/null 2>&1 || installpkg tlp-"$initsys"
+ }
+ sleep 1
+ printf 'TLP_DEFAULT_MODE=AC
START_CHARGE_THRESH_BAT0=20
STOP_CHARGE_THRESH_BAT0=80
START_CHARGE_THRESH_BAT1=50
STOP_CHARGE_THRESH_BAT1=75' >/etc/tlp.d/01-battery.conf 2>/dev/null
- echo 'USB_AUTOSUSPEND=0' >/etc/tlp.d/02-usb.conf 2>/dev/null
- case "$initsys" in
- "runit")
- ln -sf /etc/runit/sv/tlp /run/runit/service/ >/dev/null 2>&1
- sleep 1
- sv start tlp >/dev/null 2>&1 || sv force-restart tlp >/dev/null 2>&1
- ;;
- "openrc")
- rc-update add tlp default >/dev/null 2>&1
- sleep 1
- rc-service tlp start >/dev/null 2>&1
- ;;
- "s6")
- ln -sf /etc/s6/sv/tlp /run/s6/services/ >/dev/null 2>&1
- sleep 1
- s6-svc -u /run/s6/services/tlp >/dev/null 2>&1
- ;;
- "systemd")
- systemctl restart tlp
- ;;
- esac
- tlp start >/dev/null 2>&1
+ echo 'USB_AUTOSUSPEND=0' >/etc/tlp.d/02-usb.conf 2>/dev/null
+ case "$initsys" in
+ "runit")
+ ln -sf /etc/runit/sv/tlp /run/runit/service/ >/dev/null 2>&1
+ sleep 1
+ sv start tlp >/dev/null 2>&1 || sv force-restart tlp >/dev/null 2>&1
+ ;;
+ "openrc")
+ rc-update add tlp default >/dev/null 2>&1
+ sleep 1
+ rc-service tlp start >/dev/null 2>&1
+ ;;
+ "s6")
+ ln -sf /etc/s6/sv/tlp /run/s6/services/ >/dev/null 2>&1
+ sleep 1
+ s6-svc -u /run/s6/services/tlp >/dev/null 2>&1
+ ;;
+ "systemd")
+ systemctl restart tlp
+ ;;
+ esac
+ tlp start >/dev/null 2>&1
}
bbswitchsetup() {
- whiptail --infobox "Setting up bbswitch..." 7 50
- pacman -Qq bbswitch >/dev/null 2>&1 || installpkg bbswitch
- sleep 1
- echo 'bbswitch' >/etc/modules-load.d/bbswitch.conf >/dev/null 2>&1
- echo 'options bbswitch load_state=0 unload_state=1' >/etc/modprobe.d/bbswitch.conf >/dev/null 2>&1
- echo 'RUNTIME_PM_DRIVER_DENYLIST="nouveau nvidia"' >/etc/tlp.d/03-driver.conf 2>/dev/null
+ whiptail --infobox "Setting up bbswitch..." 7 50
+ pacman -Qq bbswitch >/dev/null 2>&1 || installpkg bbswitch
+ sleep 1
+ echo 'bbswitch' >/etc/modules-load.d/bbswitch.conf >/dev/null 2>&1
+ echo 'options bbswitch load_state=0 unload_state=1' >/etc/modprobe.d/bbswitch.conf >/dev/null 2>&1
+ echo 'RUNTIME_PM_DRIVER_DENYLIST="nouveau nvidia"' >/etc/tlp.d/03-driver.conf 2>/dev/null
}
sshsetup() {
- whiptail --infobox "Setting up ssh..." 7 50
- [ -x "$(command -v "ssh")" ] || installpkg openssh
- [ ! "$initsys" = "systemd" ] && {
- pacman -Qq openssh-"$initsys" >/dev/null 2>&1 || installpkg openssh-"$initsys"
- }
+ whiptail --infobox "Setting up ssh..." 7 50
+ [ -x "$(command -v "ssh")" ] || installpkg openssh
+ [ ! "$initsys" = "systemd" ] && {
+ pacman -Qq openssh-"$initsys" >/dev/null 2>&1 || installpkg openssh-"$initsys"
+ }
+ sleep 1
+ sed -Ei "s/^#?(PasswordAuthentication).*/\1 no/;s/^#?(UsePAM).*/\1 no/" /etc/ssh/sshd_config
+ case "$initsys" in
+ "runit")
+ ln -sf /etc/runit/sv/sshd /run/runit/service/ >/dev/null 2>&1
sleep 1
- sed -Ei "s/^#?(PasswordAuthentication).*/\1 no/;s/^#?(UsePAM).*/\1 no/" /etc/ssh/sshd_config
- case "$initsys" in
- "runit")
- ln -sf /etc/runit/sv/sshd /run/runit/service/ >/dev/null 2>&1
- sleep 1
- sv start sshd >/dev/null 2>&1 || sv force-restart sshd >/dev/null 2>&1
- ;;
- "openrc")
- rc-update add sshd default >/dev/null 2>&1
- sleep 1
- rc-service sshd start >/dev/null 2>&1
- ;;
- "s6")
- ln -sf /etc/s6/sv/sshd /run/s6/services/ >/dev/null 2>&1
- sleep 1
- s6-svc -u /run/s6/services/sshd >/dev/null 2>&1
- ;;
- "systemd")
- systemctl restart sshd
- ;;
- esac
+ sv start sshd >/dev/null 2>&1 || sv force-restart sshd >/dev/null 2>&1
+ ;;
+ "openrc")
+ rc-update add sshd default >/dev/null 2>&1
+ sleep 1
+ rc-service sshd start >/dev/null 2>&1
+ ;;
+ "s6")
+ ln -sf /etc/s6/sv/sshd /run/s6/services/ >/dev/null 2>&1
+ sleep 1
+ s6-svc -u /run/s6/services/sshd >/dev/null 2>&1
+ ;;
+ "systemd")
+ systemctl restart sshd
+ ;;
+ esac
}
vpnsetup() {
- whiptail --infobox "Setting up vpn..." 7 50
- [ -x "$(command -v "openvpn")" ] || installpkg openvpn
- [ ! "$initsys" = "systemd" ] && {
- pacman -Qq openvpn-"$initsys" >/dev/null 2>&1 || installpkg openvpn-"$initsys"
- }
- pacman -Qq networkmanager-openvpn >/dev/null 2>&1 || installpkg networkmanager-openvpn
- sleep 3
- nmcli connection import type openvpn file /home/"$name"/.dotfiles/ar/.config/openvpn/thesiah.ovpn >/dev/null 2>&1
+ whiptail --infobox "Setting up vpn..." 7 50
+ [ -x "$(command -v "openvpn")" ] || installpkg openvpn
+ [ ! "$initsys" = "systemd" ] && {
+ pacman -Qq openvpn-"$initsys" >/dev/null 2>&1 || installpkg openvpn-"$initsys"
+ }
+ pacman -Qq networkmanager-openvpn >/dev/null 2>&1 || installpkg networkmanager-openvpn
+ sleep 3
+ nmcli connection import type openvpn file /home/"$name"/.dotfiles/ar/.config/openvpn/thesiah.ovpn >/dev/null 2>&1
}
elogindsetup() {
- [ -d /etc/elogind/logind.conf.d ] || mkdir -p /etc/elogind/logind.conf.d 2>/dev/null
- printf '[Login]
+ [ -d /etc/elogind/logind.conf.d ] || mkdir -p /etc/elogind/logind.conf.d 2>/dev/null
+ printf '[Login]
HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore
LidSwitchIgnoreInhibited=no' >/etc/elogind/logind.conf.d/00-lid.conf 2>/dev/null
- ln -sf /etc/runit/sv/elogind /run/runit/service/
- sleep 1
- sv start elogind >/dev/null 2>&1 || sv force-restart elogind >/dev/null 2>&1
+ ln -sf /etc/runit/sv/elogind /run/runit/service/
+ sleep 1
+ sv start elogind >/dev/null 2>&1 || sv force-restart elogind >/dev/null 2>&1
}
microsetup() {
- microinfo=$(lspci | grep -E "VGA|Display")
- if echo "$microinfo" | grep -qi "Intel"; then
- installpkg xf86-video-intel
- installpkg intel-ucode
- elif echo "$microinfo" | grep -qi "AMD"; then
- installpkg xf86-video-amdgpu
- installpkg amd-ucode
- fi
+ microinfo=$(lspci | grep -E "VGA|Display")
+ if echo "$microinfo" | grep -qi "Intel"; then
+ installpkg xf86-video-intel
+ installpkg intel-ucode
+ elif echo "$microinfo" | grep -qi "AMD"; then
+ installpkg xf86-video-amdgpu
+ installpkg amd-ucode
+ fi
}
dashsetup() {
- whiptail --infobox "Setting shell to dash..." 7 50
- [ -x "$(command -v "dash")" ] || installpkg dash
- printf '[Trigger]
+ whiptail --infobox "Setting shell to dash..." 7 50
+ [ -x "$(command -v "dash")" ] || installpkg dash
+ printf '[Trigger]
Type = Package
Operation = Install
Operation = Upgrade
@@ -664,17 +664,17 @@ Description = Re-pointing /bin/sh symlink to dash...
When = PostTransaction
Exec = /usr/bin/ln -sfT dash /usr/bin/sh
Depends = dash' >/usr/share/libalpm/hooks/relinking-dash.hook
- sleep 1
- ln -sfT dash /usr/bin/sh
+ sleep 1
+ ln -sfT dash /usr/bin/sh
}
finalize() {
- unset pass1 pass2
- unset epass1 epass2
- sudo -u "$name" ln -sf /home/"$name"/.dotfiles/default/Pictures/wallpaper/city.png /home/"$name"/.local/share/wallpapers/bg
- # Farewell
- whiptail --title "All done!" \
- --msgbox "Congrats! Provided there were no hidden errors, the script completed successfully and all the programs and configuration files should be in place.\\n\\nTo run the new graphical environment, log out and log back in as your new user, then run the command \"startx\" to start the graphical environment (it will start automatically in tty1).\\n\\n.t Soomin" 13 80
+ unset pass1 pass2
+ unset epass1 epass2
+ sudo -u "$name" ln -sf /home/"$name"/.dotfiles/default/Pictures/wallpaper/city.png /home/"$name"/.local/share/wallpapers/bg
+ # Farewell
+ whiptail --title "All done!" \
+ --msgbox "Congrats! Provided there were no hidden errors, the script completed successfully and all the programs and configuration files should be in place.\\n\\nTo run the new graphical environment, log out and log back in as your new user, then run the command \"startx\" to start the graphical environment (it will start automatically in tty1).\\n\\n.t Soomin" 13 80
}
### THE ACTUAL SCRIPT ###
@@ -683,7 +683,7 @@ finalize() {
# Check if user is root on Arch distro. Install whiptail.
pacman --noconfirm --needed -Sy libnewt ||
- error "Are you sure you're running this as the root user, are on an Arch-based distribution and have an internet connection?"
+ error "Are you sure you're running this as the root user, are on an Arch-based distribution and have an internet connection?"
# Welcome user and pick dotfiles.
welcomemsg || error "User exited."
@@ -696,7 +696,7 @@ getuserandpass || error "User exited."
# Decide cloning repositories.
[ "$name" = "si" ] && {
- repocheck || error "User exited."
+ repocheck || error "User exited."
}
# Give warning if user already exists.
@@ -709,16 +709,16 @@ preinstallmsg || error "User exited."
# Refresh Arch keyrings.
refreshkeys ||
- error "Error automatically refreshing Arch keyring. Consider doing so manually."
+ error "Error automatically refreshing Arch keyring. Consider doing so manually."
for x in curl ca-certificates base-devel git ntp zsh stow; do
- whiptail --title "SI Installation" \
- --infobox "Installing \`$x\` which is required to install and configure other programs." 8 70
- installpkg "$x"
+ whiptail --title "SI Installation" \
+ --infobox "Installing \`$x\` which is required to install and configure other programs." 8 70
+ installpkg "$x"
done
whiptail --title "SI Installation" \
- --infobox "Synchronizing system time to ensure successful and secure installation of software..." 8 70
+ --infobox "Synchronizing system time to ensure successful and secure installation of software..." 8 70
ntpd -q -g >/dev/null 2>&1
adduserandpass || error "Error adding username and/or password."
@@ -850,10 +850,10 @@ librewolfsetup || error "User exited."
# Clone TheSiahxyz's repositories
[ "$putrepo" = "y" ] && {
- putgitrepo "$passwordrepo" "/home/$name/.local/share" "$repobranch"
- putgitrepo "$neetcoderepo" "/home/$name/Private/git" "$repobranch"
- putgitrepo "$obsidianrepo" "/home/$name/Private/git" "$repobranch"
- putgitrepo "$webrepo" "/home/$name/Private/git" "$repobranch"
+ putgitrepo "$passwordrepo" "/home/$name/.local/share" "$repobranch"
+ putgitrepo "$neetcoderepo" "/home/$name/Private/git" "$repobranch"
+ putgitrepo "$obsidianrepo" "/home/$name/Private/git" "$repobranch"
+ putgitrepo "$webrepo" "/home/$name/Private/git" "$repobranch"
}
# Make grub fast