summaryrefslogtreecommitdiff
path: root/static/thesiah.sh
diff options
context:
space:
mode:
Diffstat (limited to 'static/thesiah.sh')
-rwxr-xr-xstatic/thesiah.sh70
1 files changed, 53 insertions, 17 deletions
diff --git a/static/thesiah.sh b/static/thesiah.sh
index ab8817d..7a49c66 100755
--- a/static/thesiah.sh
+++ b/static/thesiah.sh
@@ -76,7 +76,7 @@ adduserandpass() {
# Adds user `$name` with password $pass1.
whiptail --infobox "Adding user \"$name\"..." 7 50
useradd -m -g wheel -s /bin/zsh "$name" >/dev/null 2>&1 ||
- usermod -a -G wheel "$name" && mkdir -p /home/"$name"/{.config,Documents,Downloads,Music,Pictures,Videos} /home/"$name"/Media/{personal,sda,sdb,sdc,sdd,ssd,storage} /home/"$name"/Torrents/{complete,incomplete} /home/"$name"/.local/{bin,share,src,state} && chown "$name":wheel /home/"$name"
+ usermod -a -G wheel "$name" && mkdir -p /home/"$name"/{.config,Documents,Downloads,Music,Pictures,Videos,Media} /home/"$name"/Torrents/{complete,incomplete} /home/"$name"/.local/{bin,share,src,state} /media/{flash,hdd,ssd} /mnt/extra/{backup,vid,win10} && chown "$name":wheel /home/"$name"
export repodir="/home/$name/.local/src"
mkdir -p "$repodir"
chown -R "$name":wheel "$(dirname "$repodir")"
@@ -299,9 +299,17 @@ pamgnupg() {
echo "session optional pam_gnupg.so " >>/etc/pam.d/system-login >/dev/null 2>&1
}
+ecryptfssetup() {
+ [ -d /home/"$name"/Media ] || mkdir -p /home/"$name"/Media && chown "$name":wheel /home/"$name"/Media
+ # Create an ecrypted folder
+ printf '\nyes\nyes\n' | mount -t ecryptfs Media Media -o passphrase_passwd="$epass1",ecryptfs_cipher=aes,ecryptfs_key_bytes=32,ecryptfs_enable_filename_crypto=y,ecryptfs_passthrough=n >/dev/null 2>&1 || exit 1
+ umount /home/"$name"/Media >/dev/null 2>&1
+}
+
ufwsetup() {
whiptail --infobox "Setting service ufw..." 7 50
- [ -x "$(command -v "ufw")" ] || installpkg ufw && install ufw-"$initsys"
+ [ -x "$(command -v "ufw")" ] || installpkg ufw
+ pacman -Qq ufw-"$initsys" >/dev/null 2>&1 || install ufw-"$initsys"
ufw default deny incoming >/dev/null 2>&1
ufw allow 80 >/dev/null 2>&1
ufw allow 443 >/dev/null 2>&1
@@ -336,7 +344,8 @@ ufwsetup() {
sambasetup() {
whiptail --infobox "Setting service samba..." 7 50
- [ -x "$(command -v "samba")" ] || installpkg samba && installpkg samba-"$initsys"
+ [ -x "$(command -v "samba")" ] || installpkg samba
+ pacman -Qq samba-"$initsys" >/dev/null 2>&1 || installpkg samba-"$initsys"
ufw allow 137/tcp >/dev/null 2>&1
ufw allow 137/udp >/dev/null 2>&1
ufw allow 138/tcp >/dev/null 2>&1
@@ -344,7 +353,7 @@ sambasetup() {
ufw allow 139/tcp >/dev/null 2>&1
ufw allow 445/tcp >/dev/null 2>&1
ufw reload >/dev/null 2>&1
- $pass1 | smbpasswd -a $name >/dev/null 2>&1
+ $pass1 | smbpasswd -a "$name" >/dev/null 2>&1
case "$initsys" in
"runit")
ln -s /etc/runit/sv/smbd /run/runit/service/ >/dev/null 2>&1
@@ -367,11 +376,10 @@ sambasetup() {
tlpsetup() {
whiptail --infobox "Setting service tlp..." 7 50
- [ -x "$(command -v "tlp")" ] || installpkg tlp && installpkg tlp-"$initsys"
- sed -Ei "s/^#(CPU_ENERGY_PERF_POLICY_ON_AC=).*/\1balance_power/" /etc/tlp.conf >/dev/null 2>&1
- sed -Ei "s/^#(CPU_ENERGY_PERF_POLICY_ON_BAT=).*/\1poewr/" /etc/tlp.conf >/dev/null 2>&1
- sed -Ei "s/^#(PLATFORM_PROFILE_ON_AC=).*/\1balanced/" /etc/tlp.conf >/dev/null 2>&1
- sed -Ei "s/^#(PLATFORM_PROFILE_ON_BAT=).*/\1low-power/" /etc/tlp.conf >/dev/null 2>&1
+ [ -x "$(command -v "tlp")" ] || installpkg tlp
+ pacman -Qq tlp-"$initsys" >/dev/null 2>&1 || installpkg tlp-"$initsys"
+ sed -Ei "s/^#(CPU_ENERGY_PERF_POLICY_ON_AC=).*/\1balance_performance/" /etc/tlp.conf >/dev/null 2>&1
+ sed -Ei "s/^#(CPU_ENERGY_PERF_POLICY_ON_BAT=).*/\1balance_poewr/" /etc/tlp.conf >/dev/null 2>&1
sed -Ei "s/^#(START_CHARGE_THRESH_BAT0=).*/\150/" /etc/tlp.conf >/dev/null 2>&1
sed -Ei "s/^#(STOP_CHARGE_THRESH_BAT0=).*/\175/" /etc/tlp.conf >/dev/null 2>&1
sed -Ei "s/^#(START_CHARGE_THRESH_BAT1=).*/\150/" /etc/tlp.conf >/dev/null 2>&1
@@ -395,7 +403,8 @@ tlpsetup() {
cronsetup() {
whiptail --infobox "Setting service cronjob..." 7 50
- [ -x "$(command -v "cronie")" ] || installpkg cronie && installpkg cronie-"$initsys"
+ [ -x "$(command -v "cronie")" ] || installpkg cronie
+ pacman -Qq cronie-"$initsys" >/dev/null 2>&1 || installpkg cronie-"$initsys"
case "$initsys" in
"runit")
ln -s /etc/runit/sv/cronie /run/runit/service/ >/dev/null 2>&1
@@ -412,6 +421,32 @@ cronsetup() {
esac
}
+vpnsetup() {
+ whiptail --infobox "Setting service vpn..." 7 50
+ [ -x "$(command -v "openvpn")" ] || installpkg openvpn
+ pacman -Qq openvpn-"$initsys" >/dev/null 2>&1 || installpkg openvpn-"$initsys"
+ pacman -Qq networkmanager-openvpn >/dev/null 2>&1 || installpkg networkmanager-openvpn
+ nmcli connection import type openvpn file /home/"$name"/.dotfiles/.config/openvpn/thesiah.ovpn >/dev/null 2>&1
+}
+
+
+dashsetup() {
+ whiptail --infobox "Setting shell to dash..." 7 50
+ [ -x "$(command -v "dash")" ] || installpkg dash
+ printf '[Trigger]
+Type = Package
+Operation = Install
+Operation = Upgrade
+Target = bash
+
+[Action]
+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
+ ln -sfT dash /usr/bin/sh
+}
+
finalize() {
# Farewell
whiptail --title "All done!" \
@@ -574,12 +609,10 @@ pkill -u "$name" librewolf
addsudo
# Set pam-gnupg
-pamgnupg || exit 1
+pamgnupg || error "Failed to set up pam-gnupg"
-# Create an ecrypted folder
-[ -d /home/"$name"/Media ] || mkdir -p /home/"$name"/Media && chown "$name":wheel /home/"$name"/Media
-printf '\nyes\nyes\n' | mount -t ecryptfs Media Media -o passphrase_passwd="$epass1",ecryptfs_cipher=aes,ecryptfs_key_bytes=32,ecryptfs_enable_filename_crypto=y,ecryptfs_passthrough=n >/dev/null 2>&1 || exit 1
-umount /home/"$name"/Media >/dev/null 2>&1
+# ecryptfs set up
+ecryptfssetup || error "Failed to set up ecryptfs rules."
# ufw set up
ufwsetup || error "Failed to set up ufw rules."
@@ -593,8 +626,11 @@ tlpsetup || error "Failed to set up tlp"
# cronjob set up
cronsetup || error "Failed to set up cron"
-# Change /bin/sh from bash to dash
-ln -sf dash /bin/sh
+# vpn set up
+vpnsetup || error "Failed to set up vpn"
+
+# dash set up
+dashsetup || error "Failed to set up dash"
# Last message! Install complete!
finalize