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