implemented upgradehooksh
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Fri, 24 Mar 2006 21:36:37 +0000 (21:36 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Fri, 24 Mar 2006 21:36:37 +0000 (21:36 +0000)
IkiWiki/Render.pm
debian/README.Debian [new file with mode: 0644]
debian/postinst [new file with mode: 0755]
debian/rules
doc/todo/done/upgradehooks.mdwn [moved from doc/todo/upgradehooks.mdwn with 100% similarity]

index 4e2caa6cef31435bc026bf70f9b7573d406e46c1..e6d0bc510bf8a8cfd9ee91e5352293c48143cb44 100644 (file)
@@ -315,9 +315,9 @@ sub check_overwrite ($$) { #{{{
 } #}}}
 
 sub mtime ($) { #{{{
 } #}}}
 
 sub mtime ($) { #{{{
-       my $page=shift;
+       my $file=shift;
        
        
-       return (stat($page))[9];
+       return (stat($file))[9];
 } #}}}
 
 sub findlinks ($$) { #{{{
 } #}}}
 
 sub findlinks ($$) { #{{{
@@ -418,7 +418,8 @@ sub refresh () { #{{{
                        push @add, $file;
                        $links{$page}=[];
                        $pagesources{$page}=$file;
                        push @add, $file;
                        $links{$page}=[];
                        $pagesources{$page}=$file;
-                       $pagectime{$page}=time unless exists $pagectime{$page};
+                       $pagectime{$page}=mtime("$config{srcdir}/$file") 
+                               unless exists $pagectime{$page};
                }
        }
        my @del;
                }
        }
        my @del;
diff --git a/debian/README.Debian b/debian/README.Debian
new file mode 100644 (file)
index 0000000..3bdeb2a
--- /dev/null
@@ -0,0 +1,8 @@
+It's a good idea, and in some cases a requirement, to rebuild your wiki
+when upgrading to a new version of ikiwiki. If you have a lot of different
+wikis on a system, this can be a pain to do by hand, and it's a good idea
+to automate it anyway.
+
+This Debian package of ikiwiki supports rebuilding wikis on upgrade. The
+file /etc/ikiwiki/wikilist lists the setup files of wikis to rebuild, as
+well as the user who owns the wiki.
diff --git a/debian/postinst b/debian/postinst
new file mode 100755 (executable)
index 0000000..e716fb2
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+set -e
+#DEBHELPER#
+
+wikilist=/etc/ikiwiki/wikilist
+
+processline () {
+       user="$1"
+       setup="$2"
+       
+       if [ -z "$user" ] || [ -z "$setup" ]; then
+               echo "parse failure in /etc/ikiwiki/wikilist, line: '$user $setup'" >&2
+               exit 1
+       fi
+       
+       if [ ! -f "$setup" ]; then
+               echo "warning: $setup specified in /etc/ikiwiki/wikilist does not exist, skipping" >&2
+       else
+               echo "Rebuilding $setup as user $user ..."
+               su "$user" -c "ikiwiki -setup $setup"
+       fi
+}
+
+if [ "$1" = configure ] && [ -e $wikilist ]; then
+       grep -v '^#' $wikilist | grep -v '^$' | while read line; do 
+               processline $line
+       done
+fi
index 6ca612c9ee82f72daaf92cdf81165d7eb52abb41..fc703fc9035bc316320966af9e750532efb5b419 100755 (executable)
@@ -23,6 +23,7 @@ binary-indep: build
        dh_clean -k
        $(MAKE) pure_install INSTALLDIRS=vendor \
                PREFIX=$(shell pwd)/debian/ikiwiki/$(shell perl -MConfig -e 'print $$Config{prefix}')
        dh_clean -k
        $(MAKE) pure_install INSTALLDIRS=vendor \
                PREFIX=$(shell pwd)/debian/ikiwiki/$(shell perl -MConfig -e 'print $$Config{prefix}')
+       dh_install debian/wikilist etc/ikiwiki
        dh_installdocs html
        dh_link usr/share/common-licenses/GPL usr/share/doc/ikiwiki/html/GPL
        dh_link usr/share/ikiwiki/basewiki \
        dh_installdocs html
        dh_link usr/share/common-licenses/GPL usr/share/doc/ikiwiki/html/GPL
        dh_link usr/share/ikiwiki/basewiki \