summaryrefslogtreecommitdiff
path: root/localikiwikirefreshsite
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2008-06-03 12:05:01 +0000
committerJonas Smedegaard <dr@jones.dk>2008-06-03 12:05:01 +0000
commit2650ad9f360e1ecea9d1f396886909a95f2b52c1 (patch)
treed8573dfe5843351a907c85145879704fc5bb1220 /localikiwikirefreshsite
parent2d65dacc4f8c8ae34245d0f7a3d941b4f3f88be2 (diff)
New script to refresh multipart ikiwiki sites needing aggregation.
Diffstat (limited to 'localikiwikirefreshsite')
-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