diff --git a/bin/vhost-add.sh b/bin/vhost-add.sh index 6fa21c4..beb5ce0 100644 --- a/bin/vhost-add.sh +++ b/bin/vhost-add.sh @@ -9,7 +9,12 @@ source $(dirname $0)/vhost.sh # check for and set virtualhost if [ -n "$1" ]; then - virtualhost=$1 + if vhost::validate_domain $1; then + virtualhost=$1 + else + echo "ERROR: $1 is not a valid domain name." + exit 1 + fi else echo "virtualhost not set" exit 1 diff --git a/bin/vhost-deploy.sh b/bin/vhost-deploy.sh index fc0ad95..55970ab 100644 --- a/bin/vhost-deploy.sh +++ b/bin/vhost-deploy.sh @@ -41,7 +41,13 @@ done if [ ! -n "$virtualhost" ]; then echo "virtualhost not set" exit 1 -elif [ -d /srv/www/$virtualhost ] || [ -f /etc/apache2/sites-available/$virtualhost.conf ]; then + +if ! vhost::validate_domain $virtualhost; then + echo "ERROR: $virtualhost is not a valid domain name." + exit 1 +fi + +if [ -d /srv/www/$virtualhost ] || [ -f /etc/apache2/sites-available/$virtualhost.conf ]; then echo "virtualhost for $virtualhost already installed" exit 1 fi