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"]) {
#
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': {
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.
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