aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-01-04 11:59:16 -0200
committerSilvio Rhatto <rhatto@riseup.net>2014-01-04 11:59:16 -0200
commitc92cdc9d3a81ca6809a39f26c23053db6b5a4ebe (patch)
tree419b8fa70303899b4f4b28b3a42ff1056d9f2f47
parent205ced3a10be2c4e9e2b291e83d8d77c075db7ff (diff)
downloadpuppet-ikiwiki-c92cdc9d3a81ca6809a39f26c23053db6b5a4ebe.tar.gz
puppet-ikiwiki-c92cdc9d3a81ca6809a39f26c23053db6b5a4ebe.tar.bz2
Deploy also if ikiwiki_src does not exit
-rw-r--r--templates/deploy.sh.erb37
-rw-r--r--templates/refresh.sh.erb2
2 files changed, 22 insertions, 17 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
diff --git a/templates/refresh.sh.erb b/templates/refresh.sh.erb
index 6ef0b7d..7561311 100644
--- a/templates/refresh.sh.erb
+++ b/templates/refresh.sh.erb
@@ -26,7 +26,7 @@ elif [ ! -e "$CONF/$NAME.setup" ]; then
fi
# Deploy if needed
-if [ ! -d "$REPO" ]; then
+if [ ! -d "$REPO" ] || [ ! -d "$SITE"/"$INSTANCE"_src ]; then
ikiwiki-deploy $NAME $OWNER $GROUP
fi