formatting
[ikiwiki] / ikiwiki-mass-rebuild
1 #!/bin/sh
2 set -e
3
4 action="$@"
5
6 wikilist=/etc/ikiwiki/wikilist
7
8 processline () {
9         user="$1"
10         setup="$2"
11         
12         if [ -z "$user" ] || [ -z "$setup" ]; then
13                 echo "parse failure in /etc/ikiwiki/wikilist, line: '$user $setup'" >&2
14                 exit 1
15         fi
16         
17         if [ ! -f "$setup" ]; then
18                 echo "warning: $setup specified in /etc/ikiwiki/wikilist does not exist, skipping" >&2
19         else
20                 echo "Processing $setup as user $user ..."
21                 su "$user" -c "ikiwiki -setup $setup $action"
22         fi
23 }
24
25 if [ -e "$wikilist" ]; then
26         grep -v '^#' $wikilist | grep -v '^$' | while read line; do 
27                 processline $line
28         done
29 fi