aboutsummaryrefslogtreecommitdiff
path: root/templates/deploy.sh.erb
blob: 5386729706a22bf936fcd6a9dc98b3a2bff36c53 (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

NAME="$1"
INSTANCE="$2"
BASE="<%= apache_sites_folder %>"
SITE=$BASE/$NAME
CONF="/etc/ikiwiki"
OWNER="gitosis"
WEB_GROUP="www-data"
REPO_GROUP="gitosis"
REPO="/var/git/repositories/$NAME.git"

if [ -z "$INSTANCE" ]; then
  echo "Usage:`basename $0` <site> <instance>"
fi

if [ ! -e "$CONF/$NAME" ]; then
  echo "No config file for $NAME"
fi

# Setup source folder
mkdir -p $SITE/"$INSTANCE"_src/

# Create initial page
echo > $SITE/"$INSTANCE"_src/index.mdwn <<EOF
Welcome to your new wiki.

All wikis are supposed to have a [[SandBox]], so this one does too.

----

This wiki is powered by [ikiwiki](http://ikiwiki.info).
EOF

# Create ikiwiki instance
ikiwiki-makerepo git $SITE/"$INSTANCE"_src/ $REPO
touch $REPO/git-daemon-export-ok
( cd $REPO/$NAME.git && git --bare update-server-info )
ikiwiki --setup /etc/ikiwiki/$NAME.setup

# Set permissions
chown -R $OWNER.$WEB_GROUP $SITE/"$INSTANCE"_src $SITE/$INSTANCE
chown -R $OWNER.$REPO_GROUP $REPO