source:
scripts/patches/mktemp-1.5-add_tempfile-1.patch@
76a1d35
Last change on this file since 76a1d35 was 7f65c0e, checked in by , 19 years ago | |
---|---|
|
|
File size: 2.7 KB |
-
Makefile.in
Submitted By: Tushar Teredesai <tushar@linuxfromscratch.org> Date: 2003-10-02 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 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
old new 113 113 install-man: 114 114 $(INSTALL) -m 0444 $(srcdir)/$(PROG).$(mantype) $(mandir)/man1/$(PROG).1 115 115 116 install-tempfile: tempfile 117 $(INSTALL) -m 0555 tempfile $(bindir)/tempfile 118 116 119 check: 117 120 @echo nothing to check 118 121 -
mktemp-1.5
diff -Nur mktemp-1.5.orig/tempfile mktemp-1.5/tempfile
old new 1 #!/bin/bash 2 # A tempfile wrapper for mktemp 3 # Note: If you can, avoid using tempfile and use mktemp instead. 4 # This wrapper is provided for compatibility since some scripts use 5 # tempfile. If possible, the best solution is to patch the scripts 6 # to use mktemp. 7 # --Tushar Teredesai <tushar@linuxfromscratch.org> 8 9 # Usage info 10 usage() 11 { 12 echo "Usage: tempfile [OPTION]" 13 echo 14 echo "Create a temporary file in a safe manner." 15 echo "This version is a wrapper that invokes mktemp." 16 echo "NOTE: Do not use tempfile in your scripts." 17 echo " Use mktemp instead." 18 echo 19 echo "[-d|--directory] DIR -> place temporary file in DIR" 20 echo "[-p|--prefix] PREFIX -> ignored" 21 echo "[-s|--suffix] SUFFIX -> ignored" 22 echo "[-n|--name] NAME -> ignored" 23 echo "[-m|--mode] MODE -> ignored" 24 echo "--version -> output version information and exit" 25 } 26 27 # parse all arguments 28 while [ $# != 0 ] 29 do 30 case "$1" in 31 # -d for tempfile is equivalent to -p for mktemp 32 -d|--directory) 33 dir="$2" 34 shift 2 35 ;; 36 --directory=*) 37 dir="${1#--directory=}" 38 shift 1 39 ;; 40 -d*) 41 dir="${1#-d}" 42 shift 1 43 ;; 44 # The following switches are ignored. 45 -p|--prefix|-s|--suffix|-n|--name|-m|--mode) 46 shift 2 47 ;; 48 -p*|--prefix=*|-s*|--suffix=*|-n*|--name=*|-m*|--mode=*) 49 shift 1 50 ;; 51 # --version for tempfile is equivalent to -V for mktemp 52 --version) 53 echo "tempfile 1.0 (`mktemp -V 2>/dev/null`)" 54 exit 0 55 ;; 56 # Unknown switch 57 *) 58 usage 59 exit 1 60 ;; 61 esac 62 done 63 64 # Use the dir if $TMPDIR is not set. 65 if [ -z "$TMPDIR" -a ! -z "$dir" ] 66 then 67 export TMPDIR="$dir" 68 fi 69 # Execute mktemp with proper arguments 70 # the -t behaviour of mktemp is the default for tempfile 71 exec mktemp -t
Note:
See TracBrowser
for help on using the repository browser.