X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=usr%2Flocal%2Fbin%2Faddsite;h=815ecfc1719ed81be24824c2e3dc19665491b62e;hb=b436a7b3f9038c19993e031189dfef12a5601a0a;hp=93113deed0e3463c33cc5bca584548272874522b;hpb=ba17a2a9cea308a8f37fa291d1cd84c2cb7a56be;p=matthijs%2Fservers%2Fdrsnuggles.git diff --git a/usr/local/bin/addsite b/usr/local/bin/addsite index 93113de..815ecfc 100755 --- a/usr/local/bin/addsite +++ b/usr/local/bin/addsite @@ -14,23 +14,32 @@ HTTPD_USERS_GID=1002 # The template to copy TEMPLATE_DIR=/data/www/template # The bases to create users under -USERBASE=ou=Users,dc=drsnuggles,dc=stderr,dc=nl -GROUPBASE=ou=Groups,dc=drsnuggles,dc=stderr,dc=nl +USERBASE="ou=Httpd Users,ou=Users,dc=drsnuggles,dc=stderr,dc=nl" +GROUPBASE="ou=Domain Groups,ou=Groups,dc=drsnuggles,dc=stderr,dc=nl" # PHP config to change the error_log setting in PHP_CONFIG=conf/php.ini.override # PHP error logfile to set error_log to PHP_ERRORLOG=logs/php.log -# Get dir, but make it absolute -cd "$1" -DIR=`pwd` - +# Get dir +DIR="$1" -if [ -e "$DIR" -a ! -d "$DIR" ]; then - echo "$DIR" must be a directory, or not exist yet. - exit 1; +if [ -e "$DIR" ]; then + if [ ! -d "$DIR" ]; then + echo "$DIR" must be a directory, or not exist yet. + exit 1; + fi + echo "Skipping creation of $DIR, it already exists"; +else + # Create $DIR from $TEMPLATE_DIR, if it does not exist yet + echo "Creating $DIR from $TEMPLATE_DIR" + cp -R "$TEMPLATE_DIR" "$DIR" fi +# Make $DIR absolute +cd "$DIR" +DIR=`pwd` + # Strip prefix SITE=`basename $DIR` @@ -77,14 +86,6 @@ else exit 1 fi -if [ -e "$DIR" ]; then - echo "Skipping creation of $DIR, it already exists"; -else - # Create $DIR from $TEMPLATE_DIR, if it does not exist yet - echo "Creating $DIR from $TEMPLATE_DIR" - cp -R "$TEMPLATE_DIR" "$DIR" -fi - echo "Setting up permissions" # Set up permissions sudo chown -R 0:$GROUP "$DIR"