projects
/
matthijs
/
servers
/
drsnuggles.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5c8cddf
)
addsite: Create the directory properly.
author
Matthijs Kooijman
<matthijs@stdin.nl>
Sun, 29 Mar 2009 16:18:18 +0000
(18:18 +0200)
committer
Matthijs Kooijman
<matthijs@stdin.nl>
Sun, 29 Mar 2009 16:18:18 +0000
(18:18 +0200)
usr/local/bin/addsite
patch
|
blob
|
history
diff --git
a/usr/local/bin/addsite
b/usr/local/bin/addsite
index c0ecae848afa8d75c7593ea68fad33f5cac4474d..815ecfc1719ed81be24824c2e3dc19665491b62e 100755
(executable)
--- a/
usr/local/bin/addsite
+++ b/
usr/local/bin/addsite
@@
-21,16
+21,25
@@
PHP_CONFIG=conf/php.ini.override
# PHP error logfile to set error_log to
PHP_ERRORLOG=logs/php.log
# 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
fi
+# Make $DIR absolute
+cd "$DIR"
+DIR=`pwd`
+
# Strip prefix
SITE=`basename $DIR`
# Strip prefix
SITE=`basename $DIR`
@@
-77,14
+86,6
@@
else
exit 1
fi
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"
echo "Setting up permissions"
# Set up permissions
sudo chown -R 0:$GROUP "$DIR"