summaryrefslogtreecommitdiff
path: root/ikiwiki-mass-rebuild
blob: dac54cb8ee5d2fa00864543d4a5cb29effefe9a9 (plain)
  1. #!/bin/sh
  2. set -e
  3. action=""
  4. if [ -n "$1" ]; then
  5. action="$1"
  6. fi
  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 "Processing $setup as user $user ..."
  19. su "$user" -c "ikiwiki -setup $setup $action"
  20. fi
  21. }
  22. if [ -e "$wikilist" ]; then
  23. grep -v '^#' $wikilist | grep -v '^$' | while read line; do
  24. processline $line
  25. done
  26. fi