diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2013-04-11 18:45:51 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2013-04-11 18:45:51 -0300 |
commit | deddeb6c9333caeaa09fc7ee3e24fb268faa79d5 (patch) | |
tree | c6a94330bde53e6b73603b6a7e3b6307f1064f21 /templates/deploy.sh.erb | |
parent | d0499250019785e683b90c09196e7c74e6aa19e2 (diff) | |
download | puppet-ikiwiki-deddeb6c9333caeaa09fc7ee3e24fb268faa79d5.tar.gz puppet-ikiwiki-deddeb6c9333caeaa09fc7ee3e24fb268faa79d5.tar.bz2 |
Another major rewrite
Diffstat (limited to 'templates/deploy.sh.erb')
-rw-r--r-- | templates/deploy.sh.erb | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/templates/deploy.sh.erb b/templates/deploy.sh.erb index d971cc1..b851d63 100644 --- a/templates/deploy.sh.erb +++ b/templates/deploy.sh.erb @@ -1,19 +1,25 @@ #!/bin/bash +# +# Deploy an ikiwiki instance. +# +# Parameters NAME="$1" +WEB_OWNER="$2" +WEB_GROUP="$3" INSTANCE="ikiwiki" BASE="<%= scope.lookupvar('ikiwiki::sites_folder') %>" SITE=$BASE/$NAME CONF="/etc/ikiwiki" REPO_OWNER="<%= scope.lookupvar('ikiwiki::git_implementation') %>" -REPO="$REPO_OWNER@localhost:$NAME" +REMOTE="$REPO_OWNER@localhost:$NAME" +REPO="/var/git/repositories/$NAME.git" +# Syntax check if [ -z "$INSTANCE" ]; then echo "Usage:`basename $0` <site> <instance>" exit 1 -fi - -if [ ! -e "$CONF/$NAME.setup" ]; then +elif [ ! -e "$CONF/$NAME.setup" ]; then echo "No config file for $NAME" exit 1 fi @@ -35,6 +41,17 @@ EOF fi # Create ikiwiki repository -ikiwiki-makerepo git $SITE/"$INSTANCE"_src_tmp $SITE/"$INSTANCE"_src +ikiwiki-makerepo git $SITE/"$INSTANCE"_src_tmp $REPO + +# Clone it again +git clone $REPO $SITE/"$INSTANCE"_src + +# Fix remotes +( cd $SITE/"$INSTANCE"_src && git remote rm origin && git remote add origin $REMOTE ) + +# Fix permissions +chown $REPO_OWNER. $REPO +chown $WEB_OWNER.$WEB_GROUP $SITE/"$INSTANCE"_src + +# Cleanup rm -rf $SITE/"$INSTANCE"_src_tmp -( cd $SITE/"$INSTANCE"_src && git remote rm origin && git remote add origin $REPO) |