note about perl version
[ikiwiki] / ikiwiki-mass-rebuild
1 #!/bin/sh
2 set -e
3
4 action=""
5 if [ -n "$1" ]; then
6         action="$1"
7 fi
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 "Processing $setup as user $user ..."
24                 su "$user" -c "ikiwiki -setup $setup $action"
25         fi
26 }
27
28 if [ -e "$wikilist" ]; then
29         grep -v '^#' $wikilist | grep -v '^$' | while read line; do 
30                 processline $line
31         done
32 fi