enabled -w write option

This commit is contained in:
Matthew Saunders Brown 2021-10-05 11:57:44 -07:00
parent e8570e1a82
commit 59ab03c734

View File

@ -19,6 +19,7 @@ help()
echo " -u <username> Username to use for this virtualhost. Optional, defaults to first 8 alphanumeric characters of virtualhost." echo " -u <username> Username to use for this virtualhost. Optional, defaults to first 8 alphanumeric characters of virtualhost."
echo " -p <password> Password for username. Optional, random password generated if none specified." echo " -p <password> Password for username. Optional, random password generated if none specified."
echo " -j Whether or not to jail the user. Optional, default is to not jail user." echo " -j Whether or not to jail the user. Optional, default is to not jail user."
echo " -w Write user & mysql info to files. Warning! This inlcudes the unencrypted passwords."
exit exit
} }
@ -86,7 +87,11 @@ if ! grep -q "^$username:" /etc/passwd; then
password=`/usr/bin/pwgen 12 1` password=`/usr/bin/pwgen 12 1`
fi fi
# add user # add user
if [[ -n $write ]]; then
/usr/local/bin/vhost-user-add.sh $username -p "$password" -w
else
/usr/local/bin/vhost-user-add.sh $username -p "$password" /usr/local/bin/vhost-user-add.sh $username -p "$password"
fi
# if jail option is set then jail user # if jail option is set then jail user
if [[ -n $jail ]]; then if [[ -n $jail ]]; then
/usr/local/bin/vhost-user-jail.sh $username > /dev/null 2>&1 /usr/local/bin/vhost-user-jail.sh $username > /dev/null 2>&1
@ -97,4 +102,8 @@ fi
/usr/local/bin/vhost-add.sh $domain $username > /dev/null 2>&1 /usr/local/bin/vhost-add.sh $domain $username > /dev/null 2>&1
# add mysql database # add mysql database
/usr/local/bin/vhost-mysql-db-add.sh $domain > /dev/null 2>&1 if [[ -n $write ]]; then
/usr/local/bin/vhost-mysql-db-add.sh $domain -w > /dev/null 2>&1
else
/usr/local/bin/vhost-mysql-db-add.sh $domain > /dev/null 2>&1
fi