mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

155 lines
4.4 KiB

--- gzip-1.3.5/znew.in.owl-tmp 2002-09-27 08:17:09.000000000 +0200
+++ gzip-1.3.5/znew.in 2005-03-21 18:15:37.956717675 +0100
@@ -14,29 +14,27 @@
# block is the disk block size (best guess, need not be exact)
warn="(does not preserve modes and timestamp)"
-tmp=/tmp/zfoo.$$
-set -C
-echo hi > $tmp.1
-echo hi > $tmp.2
-if test -z "`(${CPMOD-cpmod} $tmp.1 $tmp.2) 2>&1`"; then
- cpmod=${CPMOD-cpmod}
+cpmod=
+cpmodarg=
+if type ${CPMOD:-cpmod} 2>/dev/null; then
+ cpmod=${CPMOD:-cpmod}
warn=""
fi
-if test -z "$cpmod" && ${TOUCH-touch} -r $tmp.1 $tmp.2 2>/dev/null; then
- cpmod="${TOUCH-touch}"
+if test -z "$cpmod"; then
+ cpmod=touch
cpmodarg="-r"
warn="(does not preserve file modes)"
fi
-# check if GZIP env. variable uses -S or --suffix
-gzip -q $tmp.1
-ext=`echo $tmp.1* | sed "s|$tmp.1||"`
-rm -f $tmp.[12]*
-if test -z "$ext"; then
- echo znew: error determining gzip extension
- exit 1
-fi
+case "$GZIP" in
+ *-S*) ext=`echo "$GZIP" | sed 's/^.*-S[[:space:]]*\([^[:space:]]*\).*$/\1/'`
+ ;;
+ *-suffix*) ext=`echo "$GZIP" | sed 's/^.*--suffix=\([^[:space:]]*\).*$/\1/'`
+ ;;
+ *) ext='.gz'
+ ;;
+esac
if test "$ext" = ".Z"; then
echo znew: cannot use .Z as gzip extension.
exit 1
--- gzip-1.3.5/gzexe.in.owl-tmp 2002-09-28 08:18:11.000000000 +0200
+++ gzip-1.3.5/gzexe.in 2005-03-21 18:25:32.932597213 +0100
@@ -34,7 +34,7 @@
PATH="BINDIR:$PATH"
-x=`basename $0`
+x=`basename "$0"`
if test $# = 0; then
echo compress executables. original file foo is renamed to foo~
echo usage: ${x} [-d] files...
@@ -42,8 +42,9 @@
exit 1
fi
-tmp=gz$$
-trap "rm -f $tmp; exit 1" 1 2 3 5 10 13 15
+tmp=`/bin/mktemp ${TMPDIR:-/tmp}/gzexe.XXXXXXXXXX` || exit 1
+trap "rm -f $tmp; exit 1" HUP INT QUIT PIPE TERM
+trap "rm -f $tmp; exit 0" EXIT
decomp=0
res=0
@@ -53,12 +54,10 @@
shift
fi
-echo hi > zfoo1$$
-echo hi > zfoo2$$
-if test -z "`(${CPMOD-cpmod} zfoo1$$ zfoo2$$) 2>&1`"; then
- cpmod=${CPMOD-cpmod}
+cpmod=
+if type ${CPMOD:-cpmod} 2>/dev/null; then
+ cpmod=${CPMOD:-cpmod}
fi
-rm -f zfoo[12]$$
tail=""
IFS="${IFS= }"; saveifs="$IFS"; IFS="${IFS}:"
@@ -99,7 +98,7 @@
continue
fi
case "`basename $i`" in
- gzip | tail | sed | chmod | ln | sleep | rm)
+ bash | chmod | gzip | ln | mktemp | rm | sed | sh | tail)
echo "${x}: $i would depend on itself"; continue ;;
esac
if test -z "$cpmod"; then
@@ -112,27 +111,19 @@
fi
fi
if test $decomp -eq 0; then
- sed 1q $0 > $tmp
+ sed 1q "$0" > $tmp
sed "s|^if tail|if $tail|" >> $tmp <<'EOF'
-skip=22
-set -C
-umask=`umask`
-umask 77
-if tail +$skip "$0" | "BINDIR"/gzip -cd > /tmp/gztmp$$; then
- umask $umask
- /bin/chmod 700 /tmp/gztmp$$
- prog="`echo $0 | /bin/sed 's|^.*/||'`"
- if /bin/ln /tmp/gztmp$$ "/tmp/$prog" 2>/dev/null; then
- trap '/bin/rm -f /tmp/gztmp$$ "/tmp/$prog"; exit $res' 0
- (/bin/sleep 5; /bin/rm -f /tmp/gztmp$$ "/tmp/$prog") 2>/dev/null &
- /tmp/"$prog" ${1+"$@"}; res=$?
- else
- trap '/bin/rm -f /tmp/gztmp$$; exit $res' 0
- (/bin/sleep 5; /bin/rm -f /tmp/gztmp$$) 2>/dev/null &
- /tmp/gztmp$$ ${1+"$@"}; res=$?
- fi
+skip=14
+tmpdir=`/bin/mktemp -d ${TMPDIR:-/tmp}/gzexe.XXXXXXXXXX` || exit 1
+prog="${tmpdir}/`echo \"$0\" | sed 's|^.*/||'`"
+if tail +$skip "$0" | "BINDIR"/gzip -cd > "$prog"; then
+ /bin/chmod 700 "$prog"
+ trap '/bin/rm -rf $tmpdir; exit $res' EXIT
+ "$prog" ${1+"$@"}; res=$?
else
- echo Cannot decompress $0; exit 1
+ echo "Cannot decompress $0"
+ /bin/rm -rf $tmpdir
+ exit 1
fi; exit $res
EOF
gzip -cv9 "$i" >> $tmp || {
--- gzip-1.3.5/zdiff.in.owl-tmp 2002-09-26 10:33:24.000000000 +0200
+++ gzip-1.3.5/zdiff.in 2005-03-21 18:35:36.669875653 +0100
@@ -46,13 +46,13 @@
case "$2" in
*[-.]gz* | *[-.][zZ] | *.t[ga]z)
F=`echo "$2" | sed 's|.*/||;s|[-.][zZtga]*||'`
- set -C
- trap 'rm -f /tmp/"$F".$$; exit 2' HUP INT PIPE TERM 0
- gzip -cdfq "$2" > /tmp/"$F".$$ || exit
- gzip -cdfq "$1" | $comp $OPTIONS - /tmp/"$F".$$
+ TF=`/bin/mktemp ${TMPDIR:-/tmp}/"$F".XXXXXXXXXX` || exit 1
+ trap 'rm -f "$TF"; exit 2' EXIT HUP INT PIPE TERM
+ gzip -cdfq "$2" > "$TF" || exit
+ gzip -cdfq "$1" | $comp $OPTIONS - "$TF"
STAT="$?"
- /bin/rm -f /tmp/"$F".$$ || STAT=2
- trap - HUP INT PIPE TERM 0
+ rm -f "$TF" || STAT=2
+ trap - EXIT HUP INT PIPE TERM
exit $STAT;;
*) gzip -cdfq "$1" | $comp $OPTIONS - "$2";;