diff options
-rw-r--r-- | manifests/init.pp | 15 | ||||
-rw-r--r-- | templates/deploy.sh.erb | 12 | ||||
-rw-r--r-- | templates/refresh.sh.erb | 5 |
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 |