From 7eaef173866e3eaa5921fa82793cbe09e6d02483 Mon Sep 17 00:00:00 2001 From: Matthew Saunders Brown Date: Tue, 5 Oct 2021 12:02:08 -0700 Subject: [PATCH] remove - (dash) from autogenerated username --- bin/vhost-deploy.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bin/vhost-deploy.sh b/bin/vhost-deploy.sh index a95758d..8b351f7 100755 --- a/bin/vhost-deploy.sh +++ b/bin/vhost-deploy.sh @@ -39,34 +39,42 @@ fi # check for and set username if [[ -z "$username" ]]; then username=`echo $domain | sed 's|\.||'` + username=`echo $username | sed 's|-||'` username=`echo ${username:0:8}` if grep -q "^$username:" /etc/passwd; then # username already exists, try another username=`echo $domain | sed 's|\.||'` + username=`echo $username | sed 's|-||'` username=`echo ${username:0:7}` if grep -q "^$username:" /etc/passwd; then # username already exists, try another username=`echo $domain | sed 's|\.||'` + username=`echo $username | sed 's|-||'` username=`echo ${username:0:6}` if grep -q "^$username:" /etc/passwd; then # username already exists, try another username=`echo $domain | sed 's|\.||'` + username=`echo $username | sed 's|-||'` username=`echo ${username:0:5}` if grep -q "^$username:" /etc/passwd; then # username already exists, try another username=`echo $domain | sed 's|\.||'` + username=`echo $username | sed 's|-||'` username=`echo ${username:0:9}` if grep -q "^$username:" /etc/passwd; then # username already exists, try another username=`echo $domain | sed 's|\.||'` + username=`echo $username | sed 's|-||'` username=`echo ${username:0:10}` if grep -q "^$username:" /etc/passwd; then # username already exists, try another username=`echo $domain | sed 's|\.||'` + username=`echo $username | sed 's|-||'` username=`echo ${username:0:11}` if grep -q "^$username:" /etc/passwd; then # username already exists, try another username=`echo $domain | sed 's|\.||'` + username=`echo $username | sed 's|-||'` username=`echo ${username:0:12}` if grep -q "^$username:" /etc/passwd; then echo "trouble setting unique username, specify '-u USERNAME' to use an existing username"