blob: b5a9bdf5df169202e29f120e4e4e9a8c34ced0f6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#!/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') %>"
# Syntax check
if [ -z "$INSTANCE" ]; then
echo "Usage:`basename $0` <site> <instance>"
exit 1
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 $WEB_OWNER $WEB_GROUP
fi
# 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 $WEB_OWNER.$WWW_USER $SITE/$INSTANCE/ikiwiki.cgi
chmod 6550 $SITE/$INSTANCE/ikiwiki.cgi
# Setuid/setgid
chmod 0755 $REPO/hooks/post-update
chmod 0550 $SITE/$INSTANCE/ikiwiki.cgi
|