dd7a3814 |
1 | #!/bin/sh |
2 | set -e |
3 | |
ccd3a7e2 |
4 | action="$@" |
c20c4066 |
5 | |
dd7a3814 |
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 |
c20c4066 |
20 | echo "Processing $setup as user $user ..." |
21 | su "$user" -c "ikiwiki -setup $setup $action" |
dd7a3814 |
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 |