r10333 - in /man-cgi/static-repository/bin: fetch-man-pages.sh generate-static-archive.sh
Author: jfs
Date: Wed Nov 6 21:09:51 2013
New Revision: 10333
URL: http://svn.debian.org/wsvn/?sc=1&rev=10333
Log:
- Add a script to generate the archive
- Do not define TMPDIR, do it in the main archive generation script instead
Added:
man-cgi/static-repository/bin/generate-static-archive.sh (with props)
Modified:
man-cgi/static-repository/bin/fetch-man-pages.sh
Modified: man-cgi/static-repository/bin/fetch-man-pages.sh
URL: http://svn.debian.org/wsvn/man-cgi/static-repository/bin/fetch-man-pages.sh?rev=10333&op=diff
==============================================================================
--- man-cgi/static-repository/bin/fetch-man-pages.sh (original)
+++ man-cgi/static-repository/bin/fetch-man-pages.sh Wed Nov 6 21:09:51 2013
@@ -54,8 +54,6 @@
src_pkg=`dpkg -I "$DEB" | egrep "^ Package: |^ Source: " | tail -n1 | sed "s/^.*: //"`
[ -n "$DEBUG" ] && printf "%s\n" "INFO: Extracting manpages from [$DEB]"
-TMPDIR=$TEMPDIR
-export TMPDIR
EXTRACTDIR=`mktemp -d -t manpages-XXXXXX`
trap "rm -rf $EXTRACTDIR 2>/dev/null || true" EXIT HUP INT QUIT TERM
Added: man-cgi/static-repository/bin/generate-static-archive.sh
URL: http://svn.debian.org/wsvn/man-cgi/static-repository/bin/generate-static-archive.sh?rev=10333&op=file
==============================================================================
--- man-cgi/static-repository/bin/generate-static-archive.sh (added)
+++ man-cgi/static-repository/bin/generate-static-archive.sh Wed Nov 6 21:09:51 2013
@@ -0,0 +1,64 @@
+#!/bin/sh -e
+
+# This program uses the extractor files to (re)generate the manpages
+# archive to be used by man.cgi
+#
+# It can be setup as a cron script at the system where man.cgi is installed
+
+
+# Source the configuration file
+ME=$0
+MYDIR="`dirname $ME`"
+
+. ${MYDIR}/config
+# Setup temporary dir
+if [ -n "$TEMPDIR" ] ; then
+ mkdir -p $TEMPDIR
+ if [ ! -e "$TEMPDIR" ] ; then
+ printf "%s\n" "ERROR: Cannot create temporary directory $TEMPDIR"
+ exit 1
+ fi
+ if [ ! -w "$TEMPDIR" ] ; then
+ printf "%s\n" "ERROR: Temporary directory $TEMPDIR is not writable"
+ exit 1
+ fi
+ TMPDIR="$TEMPDIR"
+ export TMPDIR
+fi
+
+# Setup directory for scripts
+[ -z "$EXTRACTORDIR" ] && EXTRACTORDIR=$MYDIR
+
+if [ ! -d "$EXTRACTORDIR" ] ; then
+ echo "Cannot find the directory $EXTRACTORDIR with the scripts!" >&2
+ exit 1
+fi
+if [ ! -d "$DEBDIR" ] || [ ! -d "$DEBDIR/pool" ] ; then
+ echo "Cannot find a Debian mirror archive at $DEBDIR!" >&2
+ exit 1
+fi
+if [ ! -d "$EXTRACTORDIR/logs" ] ; then
+ mkdir "${EXTRACTORDIR}/logs" || { echo "ERROR: Cannot create ${EXTRACTORDIR}/logs " >&2; exit 1; }
+fi
+if [ ! -d "$EXTRACTORDIR/work" ] ; then
+ mkdir "${EXTRACTORDIR}/work"
+ mkdir "${EXTRACTORDIR}/work" || { echo "ERROR: Cannot create ${EXTRACTORDIR}/work " >&2; exit 1; }
+fi
+
+DIR=`pwd`
+
+
+cd $EXTRACTORDIR
+
+# Rotate previous logs if they exist
+for log in extractor.err extractor.log ; do
+ [ -e "logs/$log" ] && savelog -m 640 -c 7 "logs/$log"
+done
+
+echo -n "Extracting manpages from ${DEBDIR}.."
+sh make-manpage-repo.sh >$LOGDIR/extractor.log 2>$LOGDIR/extractor.err
+
+
+
+cd $DIR
+exit 0
Propchange: man-cgi/static-repository/bin/generate-static-archive.sh
------------------------------------------------------------------------------
svn:executable = *
Reply to: