summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlocalikiwikirefreshsite66
1 files changed, 66 insertions, 0 deletions
diff --git a/localikiwikirefreshsite b/localikiwikirefreshsite
new file mode 100755
index 0000000..fdb3773
--- /dev/null
+++ b/localikiwikirefreshsite
@@ -0,0 +1,66 @@
+#!/bin/sh
+#
+# /usr/local/bin/localikiwikirefreshsite
+# Copyright 2008 Jonas Smedegaard <dr@jones.dk>
+#
+# $Id: localikiwikirefreshsite,v 1.1 2008-06-03 12:05:01 jonas Exp $
+#
+# Refresh multipart ikiwiki site, aggregating only main part
+#
+
+set -e
+
+PRG=$(basename "$0")
+
+TEMP=$(getopt -s sh -o h -l help -n "$PRG" -- "$@")
+if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
+eval set -- "$TEMP"
+
+showhelp() {
+ cat <<EOF
+Usage: $PRG PROJECT [MAIN [ADDON ...]]
+
+Examples:
+ $PRG wiki
+ $PRG wiki admin "" dev admin.dev
+EOF
+}
+
+exit1() {
+ echo >&2 "Error: $1"
+ echo >&2 "Exiting..."
+ exit 1
+}
+
+ikiwikirefresh() {
+ part="$1"
+ shift || exit1 "Internal error: part not supplied!"
+
+ case "$part" in
+ ""|.) cfgpath=$CFGDIR/ikiwiki.setup;;
+ *) cfgpath=$CFGDIR/ikiwiki.$part.setup;;
+ esac
+ ikiwiki --setup $cfgpath "$@"
+}
+
+while true ; do
+ case "$1" in
+ -h|--help) showhelp; exit 0;;
+ --) shift; break;;
+ *) exit1 "Internal error!";;
+ esac
+done
+
+project="$1"
+[ -n "$project" ] || exit1 "Project name must be supplied!"
+shift
+
+mainpart="$1"
+shift || exit1 "Main part must be supplied (use \"\" if unnamed)!"
+
+CFGDIR=~/private_webdata/$project
+
+ikiwikirefresh "$mainpart" --aggregate --refresh
+for part in "$@"; do
+ ikiwikirefresh "$part" --refresh
+done