#!/bin/sh set -u # root directory of the cryptobox development environment ROOT_DIR="$(dirname $(dirname $0))" # retrieve these pages from the wiki PAGES="CryptoBox CryptoBoxDev CryptoBoxKonzept CryptoBoxEn" # base URL WIKI_HOST="https://systemausfall.org" # the trailing slash is important WIKI_URL="/wikis/howto/" # header and footer HEADER_FILE="$ROOT_DIR/tools/doc_header.inc" FOOTER_FILE="$ROOT_DIR/tools/doc_footer.inc" CBOX_CGI="/cryptobox?action=doc\&page=" DEST_DIR="$ROOT_DIR/cbox-tree.d/usr/share/doc/cryptobox/html" IMAGE_DIR="$ROOT_DIR/cbox-tree.d/var/www/cryptobox-img" TMP_DIR=/tmp/$(basename $0)-$$.d [ ! -e "$DEST_DIR" ] && echo "$DEST_DIR does not exist" && exit 1 for PAGE in $PAGES; do PAGE_SRC="$WIKI_HOST$WIKI_URL$PAGE" echo "Importing $PAGE:" TMP_FILE=$TMP_DIR/${PAGE}.html mkdir -p "$TMP_DIR" echo " downloading the page ..." wget --quiet --output-document="$TMP_FILE" "$PAGE_SRC" || { echo "Downloading ($PAGE_SRC) failed!"; exit 1; } echo " removing header and footer ..." # break lines before start of content sed -i 's#
]* id="content" [^>]*>#_END_OF_HEADER_\n#' "$TMP_FILE" sed -i 's#