aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2010-01-06 23:52:08 -0200
committerSilvio Rhatto <rhatto@riseup.net>2010-01-06 23:52:08 -0200
commit3ae3212b65bd72cef6fc8ca5adbd47996c0a1fe0 (patch)
treeff441accb922d0daf26871f0bc3086cca90451a2
parent15ada7b0e17a61a78b3f3f40405da50b525711d2 (diff)
downloadpuppet-ikiwiki-3ae3212b65bd72cef6fc8ca5adbd47996c0a1fe0.tar.gz
puppet-ikiwiki-3ae3212b65bd72cef6fc8ca5adbd47996c0a1fe0.tar.bz2
Running deploy as root and then setting permissions
-rw-r--r--manifests/init.pp1
-rw-r--r--templates/deploy.sh.erb9
2 files changed, 10 insertions, 0 deletions
diff --git a/manifests/init.pp b/manifests/init.pp
index edfba03..f50c9f0 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -33,6 +33,7 @@ class ikiwiki {
exec { "/usr/local/sbin/ikiwiki-deploy $name":
unless => "/bin/sh -c [ -f '${apache_sites_folder}/${name}/ikiwiki_src/index.mdw' ]",
+ user => root,
}
if !defined(File["${apache_sites_folder}/${name}/ikiwiki_src"]) {
diff --git a/templates/deploy.sh.erb b/templates/deploy.sh.erb
index 19aa514..66c0f10 100644
--- a/templates/deploy.sh.erb
+++ b/templates/deploy.sh.erb
@@ -4,6 +4,8 @@ NAME="$1"
BASE="<%= apache_sites_folder %>"
SITE=$BASE/$NAME
CONF="/etc/ikiwiki"
+OWNER="gitosis"
+GROUP="gitosis"
if [ -z "$NAME" ]; then
echo "Usage:`basename $0` <site>"
@@ -13,7 +15,10 @@ if [ ! -e "$CONF/$NAME" ]; then
echo "No config file for $NAME"
fi
+# Setup source folder
mkdir -p $SITE/ikiwiki_src/
+
+# Create initial page
echo > $SITE/ikiwiki_src/index.mdw <<EOF
Welcome to your new wiki.
@@ -24,7 +29,11 @@ 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/ikiwiki_src/ /var/git/repositories/$NAME.git
touch /var/git/repositories/$NAME.git/git-daemon-export-ok
( cd /var/git/repositories/$NAME.git && git --bare update-server-info )
ikiwiki --setup /etc/ikiwiki/$NAME.setup
+
+# Set permissions
+chown -R $OWNER.$GROUP $SITE/ikiwiki_src $SITE/ikiwiki /var/git/repositories/$NAME.git