aboutsummaryrefslogtreecommitdiff
path: root/templates/deploy.sh.erb
diff options
context:
space:
mode:
Diffstat (limited to 'templates/deploy.sh.erb')
-rw-r--r--templates/deploy.sh.erb37
1 files changed, 21 insertions, 16 deletions
diff --git a/templates/deploy.sh.erb b/templates/deploy.sh.erb
index cc31401..73127da 100644
--- a/templates/deploy.sh.erb
+++ b/templates/deploy.sh.erb
@@ -25,26 +25,31 @@ elif [ ! -e "$CONF/$NAME.setup" ]; then
exit 1
fi
-# Setup source folder
-mkdir -p $SITE/"$INSTANCE"_src_tmp/
-rm -rf $SITE/"$INSTANCE"_src
+# Repository setup
+if [ ! -d "$REPO" ]; then
+ # Setup source folder
+ mkdir -p $SITE/"$INSTANCE"_src_tmp/
+ rm -rf $SITE/"$INSTANCE"_src
-# Create initial page
-echo "Welcome to your new wiki powered by [ikiwiki](http://ikiwiki.info)." > $SITE/"$INSTANCE"_src_tmp/index.mdwn
+ # Create initial page
+ echo "Welcome to your new wiki powered by [ikiwiki](http://ikiwiki.info)." > $SITE/"$INSTANCE"_src_tmp/index.mdwn
-# Create ikiwiki repository
-ikiwiki-makerepo git $SITE/"$INSTANCE"_src_tmp $REPO
+ # Create ikiwiki repository
+ ikiwiki-makerepo git $SITE/"$INSTANCE"_src_tmp $REPO
+fi
# Clone it again
-git clone $REPO $SITE/"$INSTANCE"_src
-
-# Fix remotes
-cd $SITE/"$INSTANCE"_src
-git remote rm origin
-git remote add origin $REMOTE
-git config branch.master.remote origin
-git config branch.master.merge refs/heads/master
-cd $CWD
+if [ ! -d "$SITE"/"$INSTANCE"_src ]; then
+ git clone $REPO $SITE/"$INSTANCE"_src
+
+ # Fix remotes
+ cd $SITE/"$INSTANCE"_src
+ git remote rm origin
+ git remote add origin $REMOTE
+ git config branch.master.remote origin
+ git config branch.master.merge refs/heads/master
+ cd $CWD
+fi
# Cleanup
rm -rf $SITE/"$INSTANCE"_src_tmp