doc pages served by the CGI again (as until rev 164) URLs of images in stylesheet are absolute now moved 'partition_info' layout to stylesheet file CGI: file handling now done with perl instead of shell utilities CGI: removed warning for 'crypto not mounted' after 'poweroff' or 'reboot' CGI: warning, if unmount-crypto failed CGI: warning, if configuration of any value failed silently texts for 'ConfigTimeOutFailed', 'ConfigLanguageFailed' and 'ConfigIPFailed' added to language file cbox-manage.sh: syntax info updated cbox-manage.sh: action 'crypto-(u)mount' renamed to 'crypto-up/down'
67 lines
2.2 KiB
Bash
Executable file
67 lines
2.2 KiB
Bash
Executable file
#!/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#<div [^>]* id="content" [^>]*>#_END_OF_HEADER_\n#' "$TMP_FILE"
|
|
sed -i 's#<div id="footer">#\n_START_OF_FOOTER_#' "$TMP_FILE"
|
|
# remove all lines before and after "body"
|
|
sed -i '1,/_END_OF_HEADER_/d; /_START_OF_FOOTER_/,$d' "$TMP_FILE"
|
|
|
|
#echo " adding header and footer ..."
|
|
#[ -e "${TMP_FILE}.0" ] && rm "${TMP_FILE}.0"
|
|
#mv "$TMP_FILE" "${TMP_FILE}.0"
|
|
#cat "$HEADER_FILE" "${TMP_FILE}.0" "$FOOTER_FILE" >"$TMP_FILE"
|
|
#rm "${TMP_FILE}.0"
|
|
|
|
echo " downloading requisites ..."
|
|
wget --quiet --ignore-tags=a --no-clobber --page-requisites --convert-links --no-parent --no-directories --base="$WIKI_HOST$WIKI_URL" --directory-prefix="$TMP_DIR" --html-extension --force-html --input-file="$TMP_FILE" || { echo "Downloading requisites for ($PAGE_SRC) failed!"; exit 1; }
|
|
|
|
echo " adjusting links for requisites ..."
|
|
find "$TMP_DIR" -type f | grep -v '\.html$' | while read a
|
|
do fname=$(basename "$a")
|
|
sed -i "s#=\"[^\"]*/$fname\"#=\"/cryptobox-img/$fname\"#g" "$TMP_FILE"
|
|
done
|
|
|
|
echo " adjusting wiki links ..."
|
|
# redirect wiki links to cryptobox cgi
|
|
sed -i "s#=\"$WIKI_URL\([^\.]*\)\"#=\"$CBOX_CGI\1\"#g" "$TMP_FILE"
|
|
|
|
echo " finished!"
|
|
done
|
|
|
|
mv "$TMP_DIR"/*.html "$DEST_DIR"
|
|
mv "$TMP_DIR"/* "$IMAGE_DIR"
|
|
rmdir "$TMP_DIR"
|