summaryrefslogtreecommitdiff
path: root/localikiwikirefreshsite
blob: fdb37739309bcdc4335f19f81163a3cb73b4073c (plain)
  1. #!/bin/sh
  2. #
  3. # /usr/local/bin/localikiwikirefreshsite
  4. # Copyright 2008 Jonas Smedegaard <dr@jones.dk>
  5. #
  6. # $Id: localikiwikirefreshsite,v 1.1 2008-06-03 12:05:01 jonas Exp $
  7. #
  8. # Refresh multipart ikiwiki site, aggregating only main part
  9. #
  10. set -e
  11. PRG=$(basename "$0")
  12. TEMP=$(getopt -s sh -o h -l help -n "$PRG" -- "$@")
  13. if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
  14. eval set -- "$TEMP"
  15. showhelp() {
  16. cat <<EOF
  17. Usage: $PRG PROJECT [MAIN [ADDON ...]]
  18. Examples:
  19. $PRG wiki
  20. $PRG wiki admin "" dev admin.dev
  21. EOF
  22. }
  23. exit1() {
  24. echo >&2 "Error: $1"
  25. echo >&2 "Exiting..."
  26. exit 1
  27. }
  28. ikiwikirefresh() {
  29. part="$1"
  30. shift || exit1 "Internal error: part not supplied!"
  31. case "$part" in
  32. ""|.) cfgpath=$CFGDIR/ikiwiki.setup;;
  33. *) cfgpath=$CFGDIR/ikiwiki.$part.setup;;
  34. esac
  35. ikiwiki --setup $cfgpath "$@"
  36. }
  37. while true ; do
  38. case "$1" in
  39. -h|--help) showhelp; exit 0;;
  40. --) shift; break;;
  41. *) exit1 "Internal error!";;
  42. esac
  43. done
  44. project="$1"
  45. [ -n "$project" ] || exit1 "Project name must be supplied!"
  46. shift
  47. mainpart="$1"
  48. shift || exit1 "Main part must be supplied (use \"\" if unnamed)!"
  49. CFGDIR=~/private_webdata/$project
  50. ikiwikirefresh "$mainpart" --aggregate --refresh
  51. for part in "$@"; do
  52. ikiwikirefresh "$part" --refresh
  53. done