repodir now created at correct time

This commit is contained in:
Luke Smith 2020-03-13 10:54:22 -04:00
parent a757df2c13
commit f3f1e7221f
No known key found for this signature in database
GPG Key ID: 4C50B54A911F6252

View File

@ -46,7 +46,6 @@ selectdotfiles() { \
getuserandpass() { \ getuserandpass() { \
# Prompts user for new username an password. # Prompts user for new username an password.
name=$(dialog --inputbox "First, please enter a name for the user account." 10 60 3>&1 1>&2 2>&3 3>&1) || exit name=$(dialog --inputbox "First, please enter a name for the user account." 10 60 3>&1 1>&2 2>&3 3>&1) || exit
repodir="/home/$name/.local/src"; mkdir -p "$repodir"; chown -R "$name":wheel "$repodir"
while ! echo "$name" | grep "^[a-z_][a-z0-9_-]*$" >/dev/null 2>&1; do while ! echo "$name" | grep "^[a-z_][a-z0-9_-]*$" >/dev/null 2>&1; do
name=$(dialog --no-cancel --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) name=$(dialog --no-cancel --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 done
@ -72,6 +71,7 @@ adduserandpass() { \
dialog --infobox "Adding user \"$name\"..." 4 50 dialog --infobox "Adding user \"$name\"..." 4 50
useradd -m -g wheel -s /bin/bash "$name" >/dev/null 2>&1 || useradd -m -g wheel -s /bin/bash "$name" >/dev/null 2>&1 ||
usermod -a -G wheel "$name" && mkdir -p /home/"$name" && chown "$name":wheel /home/"$name" usermod -a -G wheel "$name" && mkdir -p /home/"$name" && chown "$name":wheel /home/"$name"
repodir="/home/$name/.local/src"; mkdir -p "$repodir"; chown -R "$name":wheel "$repodir"
echo "$name:$pass1" | chpasswd echo "$name:$pass1" | chpasswd
unset pass1 pass2 ;} unset pass1 pass2 ;}