r988 - trunk/mktemp

tushar at linuxfromscratch.org tushar at linuxfromscratch.org
Fri Jun 24 12:56:45 PDT 2005


Author: tushar
Date: 2005-06-24 13:56:45 -0600 (Fri, 24 Jun 2005)
New Revision: 988

Added:
   trunk/mktemp/mktemp-1.5-add_tempfile-2.patch
Log:
Added patch: mktemp-1.5-add_tempfile-2.patch

Added: trunk/mktemp/mktemp-1.5-add_tempfile-2.patch
===================================================================
--- trunk/mktemp/mktemp-1.5-add_tempfile-2.patch	2005-06-24 15:09:43 UTC (rev 987)
+++ trunk/mktemp/mktemp-1.5-add_tempfile-2.patch	2005-06-24 19:56:45 UTC (rev 988)
@@ -0,0 +1,95 @@
+Submitted By: Tushar Teredesai <tushar at linuxfromscratch.org>
+Date: 2005-06-24
+Initial Package Version: 1.5
+Origin: http://archive.linuxfromscratch.org/mail-archives/lfs-dev/2003-April/033602.html
+        http://archive.linuxfromscratch.org/mail-archives/lfs-dev/2003-June/035234.html
+		http://linuxfromscratch.org/pipermail/lfs-dev/2005-June/051908.html
+Description: Add tempfile wrapper script. Use "make install-tempfile" to install it.
+diff -Nur mktemp-1.5.orig/Makefile.in mktemp-1.5/Makefile.in
+--- mktemp-1.5.orig/Makefile.in	2003-03-23 19:09:56.000000000 -0600
++++ mktemp-1.5/Makefile.in	2003-10-02 13:53:19.000000000 -0500
+@@ -113,6 +113,9 @@
+ install-man:
+ 	$(INSTALL) -m 0444 $(srcdir)/$(PROG).$(mantype) $(mandir)/man1/$(PROG).1
+ 
++install-tempfile: $(srcdir)/tempfile
++	$(INSTALL) -m 0555 $(srcdir)/tempfile $(bindir)/tempfile
++
+ check:
+ 	@echo nothing to check
+ 
+diff -Nur mktemp-1.5.orig/tempfile mktemp-1.5/tempfile
+--- mktemp-1.5.orig/tempfile	1969-12-31 18:00:00.000000000 -0600
++++ mktemp-1.5/tempfile	2003-10-02 13:52:35.000000000 -0500
+@@ -0,0 +1,71 @@
++#!/bin/bash
++# A tempfile wrapper for mktemp
++# Note: If you can, avoid using tempfile and use mktemp instead.
++#       This wrapper is provided for compatibility since some scripts use
++#       tempfile. If possible, the best solution is to patch the scripts
++#       to use mktemp.
++# --Tushar Teredesai <tushar at linuxfromscratch.org>
++
++# Usage info
++usage()
++{
++	echo "Usage: tempfile [OPTION]"
++	echo
++	echo "Create a temporary file in a safe manner."
++	echo "This version is a wrapper that invokes mktemp."
++	echo "NOTE: Do not use tempfile in your scripts."
++	echo "      Use mktemp instead."
++	echo
++	echo "[-d|--directory] DIR -> place temporary file in DIR"
++	echo "[-p|--prefix] PREFIX -> ignored"
++	echo "[-s|--suffix] SUFFIX -> ignored"
++	echo "[-n|--name] NAME -> ignored"
++	echo "[-m|--mode] MODE -> ignored"
++	echo "--version -> output version information and exit"
++}
++
++# parse all arguments
++while [ $# != 0 ]
++do
++	case "$1" in
++	# -d for tempfile is equivalent to -p for mktemp
++	-d|--directory)
++		dir="$2"
++		shift 2
++	;;
++	--directory=*)
++		dir="${1#--directory=}"
++		shift 1
++	;;
++	-d*)
++		dir="${1#-d}"
++		shift 1
++	;;
++	# The following switches are ignored.
++	-p|--prefix|-s|--suffix|-n|--name|-m|--mode)
++		shift 2
++	;;
++	-p*|--prefix=*|-s*|--suffix=*|-n*|--name=*|-m*|--mode=*)
++		shift 1
++	;;
++	# --version for tempfile is equivalent to -V for mktemp
++	--version)
++		echo "tempfile 1.0 (`mktemp -V 2>/dev/null`)"
++		exit 0
++	;;
++	# Unknown switch
++	*)
++		usage
++		exit 1
++	;;
++	esac
++done
++
++# Use the dir if $TMPDIR is not set.
++if [ -z "$TMPDIR" -a ! -z "$dir" ]
++then
++	export TMPDIR="$dir"
++fi
++# Execute mktemp with proper arguments
++# the -t behaviour of mktemp is the default for tempfile
++exec mktemp -t




More information about the patches mailing list