diff options
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) |