[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

r10317 - in /man-cgi/extractor: config generate-manpages-archive.sh



Author: jfs
Date: Tue Nov  5 00:22:52 2013
New Revision: 10317

URL: http://svn.debian.org/wsvn/?sc=1&rev=10317
Log:
Do not use TMPDIR, but use TEMPDIR instead and check in the mainscript if the
temporary directory exists (create it if required).

Also ensure the script works when called with an absolute path


Modified:
    man-cgi/extractor/config
    man-cgi/extractor/generate-manpages-archive.sh

Modified: man-cgi/extractor/config
URL: http://svn.debian.org/wsvn/man-cgi/extractor/config?rev=10317&op=diff
==============================================================================
--- man-cgi/extractor/config	(original)
+++ man-cgi/extractor/config	Tue Nov  5 00:22:52 2013
@@ -14,5 +14,5 @@
 MANDIR=$EXTRACTORDIR/manpages-dists/
 
 # Define tmpdir to prevent creating cruft in /tmp (default TMPDIR)
-TMPDIR=$EXTRACTORDIR/work
+TEMPDIR=$EXTRACTORDIR/work
 

Modified: man-cgi/extractor/generate-manpages-archive.sh
URL: http://svn.debian.org/wsvn/man-cgi/extractor/generate-manpages-archive.sh?rev=10317&op=diff
==============================================================================
--- man-cgi/extractor/generate-manpages-archive.sh	(original)
+++ man-cgi/extractor/generate-manpages-archive.sh	Tue Nov  5 00:22:52 2013
@@ -7,8 +7,27 @@
 
 
 # Source the configuration file
-. ./config
-export TMPDIR
+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


Reply to: