]> gitweb.fluxo.info Git - puppet-ikiwiki.git/commitdiff
Making ikiwiki-refresh to call ikiwiki-deploy if needed
authorSilvio Rhatto <rhatto@riseup.net>
Wed, 28 Jul 2010 19:34:36 +0000 (16:34 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Wed, 28 Jul 2010 19:34:36 +0000 (16:34 -0300)
manifests/init.pp
templates/deploy.sh.erb
templates/refresh.sh.erb

index a36cc5558759746268a28cd7228e92c9a4852105..e6eeee20e6fba31708763de28313c26a6c595bd7 100644 (file)
@@ -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': {
index 07760ec55d5bbc812782124d269c3eb2890ef8e4..e5bfa92a09f86953b26ed925c09e3366f5b62f87 100644 (file)
@@ -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
index bca18e40e26ea38e3094906d513124607509795d..6680f23050ef13f198c2c9adfda8042c3575ac42 100644 (file)
@@ -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