source: scripts/patches/mktemp-1.5-add_tempfile-1.patch@ 5bd60e2

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 5bd60e2 was 7f65c0e, checked in by Jim Gifford <clfs@…>, 19 years ago

r625@server (orig r623): jim | 2005-10-31 12:43:24 -0800
Final Move

  • Property mode set to 100644
File size: 2.7 KB
RevLine 
[f5aa871]1Submitted By: Tushar Teredesai <tushar@linuxfromscratch.org>
2Date: 2003-10-02
3Initial Package Version: 1.5
4Origin: http://archive.linuxfromscratch.org/mail-archives/lfs-dev/2003-April/033602.html
5 http://archive.linuxfromscratch.org/mail-archives/lfs-dev/2003-June/035234.html
6Description: Add tempfile wrapper script. Use "make install-tempfile" to install it.
7diff -Nur mktemp-1.5.orig/Makefile.in mktemp-1.5/Makefile.in
8--- mktemp-1.5.orig/Makefile.in 2003-03-23 19:09:56.000000000 -0600
9+++ mktemp-1.5/Makefile.in 2003-10-02 13:53:19.000000000 -0500
10@@ -113,6 +113,9 @@
11 install-man:
12 $(INSTALL) -m 0444 $(srcdir)/$(PROG).$(mantype) $(mandir)/man1/$(PROG).1
13
14+install-tempfile: tempfile
15+ $(INSTALL) -m 0555 tempfile $(bindir)/tempfile
16+
17 check:
18 @echo nothing to check
19
20diff -Nur mktemp-1.5.orig/tempfile mktemp-1.5/tempfile
21--- mktemp-1.5.orig/tempfile 1969-12-31 18:00:00.000000000 -0600
22+++ mktemp-1.5/tempfile 2003-10-02 13:52:35.000000000 -0500
23@@ -0,0 +1,71 @@
24+#!/bin/bash
25+# A tempfile wrapper for mktemp
26+# Note: If you can, avoid using tempfile and use mktemp instead.
27+# This wrapper is provided for compatibility since some scripts use
28+# tempfile. If possible, the best solution is to patch the scripts
29+# to use mktemp.
30+# --Tushar Teredesai <tushar@linuxfromscratch.org>
31+
32+# Usage info
33+usage()
34+{
35+ echo "Usage: tempfile [OPTION]"
36+ echo
37+ echo "Create a temporary file in a safe manner."
38+ echo "This version is a wrapper that invokes mktemp."
39+ echo "NOTE: Do not use tempfile in your scripts."
40+ echo " Use mktemp instead."
41+ echo
42+ echo "[-d|--directory] DIR -> place temporary file in DIR"
43+ echo "[-p|--prefix] PREFIX -> ignored"
44+ echo "[-s|--suffix] SUFFIX -> ignored"
45+ echo "[-n|--name] NAME -> ignored"
46+ echo "[-m|--mode] MODE -> ignored"
47+ echo "--version -> output version information and exit"
48+}
49+
50+# parse all arguments
51+while [ $# != 0 ]
52+do
53+ case "$1" in
54+ # -d for tempfile is equivalent to -p for mktemp
55+ -d|--directory)
56+ dir="$2"
57+ shift 2
58+ ;;
59+ --directory=*)
60+ dir="${1#--directory=}"
61+ shift 1
62+ ;;
63+ -d*)
64+ dir="${1#-d}"
65+ shift 1
66+ ;;
67+ # The following switches are ignored.
68+ -p|--prefix|-s|--suffix|-n|--name|-m|--mode)
69+ shift 2
70+ ;;
71+ -p*|--prefix=*|-s*|--suffix=*|-n*|--name=*|-m*|--mode=*)
72+ shift 1
73+ ;;
74+ # --version for tempfile is equivalent to -V for mktemp
75+ --version)
76+ echo "tempfile 1.0 (`mktemp -V 2>/dev/null`)"
77+ exit 0
78+ ;;
79+ # Unknown switch
80+ *)
81+ usage
82+ exit 1
83+ ;;
84+ esac
85+done
86+
87+# Use the dir if $TMPDIR is not set.
88+if [ -z "$TMPDIR" -a ! -z "$dir" ]
89+then
90+ export TMPDIR="$dir"
91+fi
92+# Execute mktemp with proper arguments
93+# the -t behaviour of mktemp is the default for tempfile
94+exec mktemp -t
Note: See TracBrowser for help on using the repository browser.