aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2010-07-28 16:34:36 -0300
committerSilvio Rhatto <rhatto@riseup.net>2010-07-28 16:34:36 -0300
commit61bbe6530eaf19bfedb09a923184763e130bf6c9 (patch)
tree4f9075532d9ec4177357358fd1aac8151c2d8e69
parent39a6de3db7edd8e2089de085683dbeb45a684581 (diff)
downloadpuppet-ikiwiki-61bbe6530eaf19bfedb09a923184763e130bf6c9.tar.gz
puppet-ikiwiki-61bbe6530eaf19bfedb09a923184763e130bf6c9.tar.bz2
Making ikiwiki-refresh to call ikiwiki-deploy if needed
-rw-r--r--manifests/init.pp15
-rw-r--r--templates/deploy.sh.erb12
-rw-r--r--templates/refresh.sh.erb5
3 files changed, 18 insertions, 14 deletions
diff --git a/manifests/init.pp b/manifests/init.pp
index a36cc55..e6eeee2 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -47,12 +47,6 @@ class ikiwiki {
command => "/usr/local/sbin/ikiwiki-refresh $name $instance",
user => root,
refreshonly => true,
- onlyif => "/bin/sh -c '[ ! -f ${apache_sites_folder}/${name}/${instance}_src/index.mdwn ]'",
- }
-
- exec { "/usr/local/sbin/ikiwiki-deploy $name $instance":
- creates => "${apache_sites_folder}/${name}/${instance}_src/index.mdwn",
- user => root,
}
if !defined(File["${apache_sites_folder}/${name}/${instance}_src"]) {
@@ -95,10 +89,11 @@ class ikiwiki {
#
file { [ "/var/git/repositories/${name}.git/hooks/post-update",
"${apache_sites_folder}/${name}/${instance}/ikiwiki.cgi" ]:
- ensure => present,
- owner => www-data,
- group => gitosis,
- mode => 6550,
+ ensure => present,
+ owner => www-data,
+ group => gitosis,
+ mode => 6550,
+ require => File["/etc/ikiwiki/$name.setup"],
}
}
'absent': {
diff --git a/templates/deploy.sh.erb b/templates/deploy.sh.erb
index 07760ec..e5bfa92 100644
--- a/templates/deploy.sh.erb
+++ b/templates/deploy.sh.erb
@@ -25,7 +25,8 @@ fi
mkdir -p $SITE/"$INSTANCE"_src/
# Create initial page
-echo > $SITE/"$INSTANCE"_src/index.mdwn <<EOF
+if [ ! -e $SITE/"$INSTANCE"_src/index.mdwn ]; then
+ 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.
@@ -34,11 +35,14 @@ All wikis are supposed to have a [[SandBox]], so this one does too.
This wiki is powered by [ikiwiki](http://ikiwiki.info).
EOF
+fi
# 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 )
+if [ ! -d "$REPO" ]; then
+ ikiwiki-makerepo git $SITE/"$INSTANCE"_src/ $REPO
+ touch $REPO/git-daemon-export-ok
+ ( cd $REPO/$NAME.git && git --bare update-server-info )
+fi
# Refresh the instance
ikiwiki-refresh $NAME $INSTANCE
diff --git a/templates/refresh.sh.erb b/templates/refresh.sh.erb
index bca18e4..6680f23 100644
--- a/templates/refresh.sh.erb
+++ b/templates/refresh.sh.erb
@@ -21,6 +21,11 @@ if [ ! -e "$CONF/$NAME.setup" ]; then
exit 1
fi
+# Deploy if needed
+if [ ! -d "$REPO" ]; then
+ ikiwiki-deploy $NAME $INSTANCE
+fi
+
# Setup
ikiwiki --setup /etc/ikiwiki/$NAME.setup