diff options
Diffstat (limited to 'templates/refresh.sh.erb')
-rw-r--r-- | templates/refresh.sh.erb | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/templates/refresh.sh.erb b/templates/refresh.sh.erb index 92c42ca..b5a9bdf 100644 --- a/templates/refresh.sh.erb +++ b/templates/refresh.sh.erb @@ -1,37 +1,42 @@ #!/bin/bash +# +# Refresh an ikiwiki instance. +# +# Parameters NAME="$1" WEB_OWNER="$2" WEB_GROUP="$3" +WWW_USER="<%= scope.lookupvar('ikiwiki::www_user') %>" BASE="<%= scope.lookupvar('ikiwiki::sites_folder') %>" SITE="$BASE/$NAME" CONF="/etc/ikiwiki" INSTANCE="ikiwiki" REPO_OWNER="<%= scope.lookupvar('ikiwiki::git_implementation') %>" REPO_GROUP="<%= scope.lookupvar('ikiwiki::git_implementation') %>" -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 # Deploy if needed if [ ! -d "$REPO" ]; then - ikiwiki-deploy $NAME $INSTANCE + ikiwiki-deploy $NAME $WEB_OWNER $WEB_GROUP fi # Setup -su $WEB_OWNER -s /bin/bash -c "ikiwiki --setup /etc/ikiwiki/$NAME.setup" +ikiwiki --setup /etc/ikiwiki/$NAME.setup # Fix permissions chown -R $REPO_OWNER.$REPO_GROUP $REPO -chown -R $WEB_OWNER.$WEB_GROUP $SITE/"$INSTANCE"_src $SITE/$INSTANCE +chown -R $WEB_OWNER.$WEB_GROUP $SITE/"$INSTANCE"_src $SITE/$INSTANCE +chown $WEB_OWNER.$WWW_USER $SITE/$INSTANCE/ikiwiki.cgi +chmod 6550 $SITE/$INSTANCE/ikiwiki.cgi # Setuid/setgid chmod 0755 $REPO/hooks/post-update |