* Rename inlinepage to depends, so that it can be used to refer to more
[ikiwiki.git] / debian / postinst
1 #!/bin/sh
2 set -e
3 #DEBHELPER#
4
5 # Change this when some incompatible change is made that requires
6 # rebuilding all wikis.
7 firstcompat=1.1
8
9 wikilist=/etc/ikiwiki/wikilist
10
11 processline () {
12         user="$1"
13         setup="$2"
14         
15         if [ -z "$user" ] || [ -z "$setup" ]; then
16                 echo "parse failure in /etc/ikiwiki/wikilist, line: '$user $setup'" >&2
17                 exit 1
18         fi
19         
20         if [ ! -f "$setup" ]; then
21                 echo "warning: $setup specified in /etc/ikiwiki/wikilist does not exist, skipping" >&2
22         else
23                 echo "Rebuilding $setup as user $user ..."
24                 su "$user" -c "ikiwiki -setup $setup"
25         fi
26 }
27
28 if [ "$1" = configure ] && [ -e $wikilist ] && \
29    dpkg --compare-versions "$2" lt "$firstcompat"; then
30         grep -v '^#' $wikilist | grep -v '^$' | while read line; do 
31                 processline $line
32         done
33 fi