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

  1. --- gzip-1.3.5/znew.in.owl-tmp 2002-09-27 08:17:09.000000000 +0200
  2. +++ gzip-1.3.5/znew.in 2005-03-21 18:15:37.956717675 +0100
  3. @@ -14,29 +14,27 @@
  4. # block is the disk block size (best guess, need not be exact)
  5. warn="(does not preserve modes and timestamp)"
  6. -tmp=/tmp/zfoo.$$
  7. -set -C
  8. -echo hi > $tmp.1
  9. -echo hi > $tmp.2
  10. -if test -z "`(${CPMOD-cpmod} $tmp.1 $tmp.2) 2>&1`"; then
  11. - cpmod=${CPMOD-cpmod}
  12. +cpmod=
  13. +cpmodarg=
  14. +if type ${CPMOD:-cpmod} 2>/dev/null; then
  15. + cpmod=${CPMOD:-cpmod}
  16. warn=""
  17. fi
  18. -if test -z "$cpmod" && ${TOUCH-touch} -r $tmp.1 $tmp.2 2>/dev/null; then
  19. - cpmod="${TOUCH-touch}"
  20. +if test -z "$cpmod"; then
  21. + cpmod=touch
  22. cpmodarg="-r"
  23. warn="(does not preserve file modes)"
  24. fi
  25. -# check if GZIP env. variable uses -S or --suffix
  26. -gzip -q $tmp.1
  27. -ext=`echo $tmp.1* | sed "s|$tmp.1||"`
  28. -rm -f $tmp.[12]*
  29. -if test -z "$ext"; then
  30. - echo znew: error determining gzip extension
  31. - exit 1
  32. -fi
  33. +case "$GZIP" in
  34. + *-S*) ext=`echo "$GZIP" | sed 's/^.*-S[[:space:]]*\([^[:space:]]*\).*$/\1/'`
  35. + ;;
  36. + *-suffix*) ext=`echo "$GZIP" | sed 's/^.*--suffix=\([^[:space:]]*\).*$/\1/'`
  37. + ;;
  38. + *) ext='.gz'
  39. + ;;
  40. +esac
  41. if test "$ext" = ".Z"; then
  42. echo znew: cannot use .Z as gzip extension.
  43. exit 1
  44. --- gzip-1.3.5/gzexe.in.owl-tmp 2002-09-28 08:18:11.000000000 +0200
  45. +++ gzip-1.3.5/gzexe.in 2005-03-21 18:25:32.932597213 +0100
  46. @@ -34,7 +34,7 @@
  47. PATH="BINDIR:$PATH"
  48. -x=`basename $0`
  49. +x=`basename "$0"`
  50. if test $# = 0; then
  51. echo compress executables. original file foo is renamed to foo~
  52. echo usage: ${x} [-d] files...
  53. @@ -42,8 +42,9 @@
  54. exit 1
  55. fi
  56. -tmp=gz$$
  57. -trap "rm -f $tmp; exit 1" 1 2 3 5 10 13 15
  58. +tmp=`/bin/mktemp ${TMPDIR:-/tmp}/gzexe.XXXXXXXXXX` || exit 1
  59. +trap "rm -f $tmp; exit 1" HUP INT QUIT PIPE TERM
  60. +trap "rm -f $tmp; exit 0" EXIT
  61. decomp=0
  62. res=0
  63. @@ -53,12 +54,10 @@
  64. shift
  65. fi
  66. -echo hi > zfoo1$$
  67. -echo hi > zfoo2$$
  68. -if test -z "`(${CPMOD-cpmod} zfoo1$$ zfoo2$$) 2>&1`"; then
  69. - cpmod=${CPMOD-cpmod}
  70. +cpmod=
  71. +if type ${CPMOD:-cpmod} 2>/dev/null; then
  72. + cpmod=${CPMOD:-cpmod}
  73. fi
  74. -rm -f zfoo[12]$$
  75. tail=""
  76. IFS="${IFS= }"; saveifs="$IFS"; IFS="${IFS}:"
  77. @@ -99,7 +98,7 @@
  78. continue
  79. fi
  80. case "`basename $i`" in
  81. - gzip | tail | sed | chmod | ln | sleep | rm)
  82. + bash | chmod | gzip | ln | mktemp | rm | sed | sh | tail)
  83. echo "${x}: $i would depend on itself"; continue ;;
  84. esac
  85. if test -z "$cpmod"; then
  86. @@ -112,27 +111,19 @@
  87. fi
  88. fi
  89. if test $decomp -eq 0; then
  90. - sed 1q $0 > $tmp
  91. + sed 1q "$0" > $tmp
  92. sed "s|^if tail|if $tail|" >> $tmp <<'EOF'
  93. -skip=22
  94. -set -C
  95. -umask=`umask`
  96. -umask 77
  97. -if tail +$skip "$0" | "BINDIR"/gzip -cd > /tmp/gztmp$$; then
  98. - umask $umask
  99. - /bin/chmod 700 /tmp/gztmp$$
  100. - prog="`echo $0 | /bin/sed 's|^.*/||'`"
  101. - if /bin/ln /tmp/gztmp$$ "/tmp/$prog" 2>/dev/null; then
  102. - trap '/bin/rm -f /tmp/gztmp$$ "/tmp/$prog"; exit $res' 0
  103. - (/bin/sleep 5; /bin/rm -f /tmp/gztmp$$ "/tmp/$prog") 2>/dev/null &
  104. - /tmp/"$prog" ${1+"$@"}; res=$?
  105. - else
  106. - trap '/bin/rm -f /tmp/gztmp$$; exit $res' 0
  107. - (/bin/sleep 5; /bin/rm -f /tmp/gztmp$$) 2>/dev/null &
  108. - /tmp/gztmp$$ ${1+"$@"}; res=$?
  109. - fi
  110. +skip=14
  111. +tmpdir=`/bin/mktemp -d ${TMPDIR:-/tmp}/gzexe.XXXXXXXXXX` || exit 1
  112. +prog="${tmpdir}/`echo \"$0\" | sed 's|^.*/||'`"
  113. +if tail +$skip "$0" | "BINDIR"/gzip -cd > "$prog"; then
  114. + /bin/chmod 700 "$prog"
  115. + trap '/bin/rm -rf $tmpdir; exit $res' EXIT
  116. + "$prog" ${1+"$@"}; res=$?
  117. else
  118. - echo Cannot decompress $0; exit 1
  119. + echo "Cannot decompress $0"
  120. + /bin/rm -rf $tmpdir
  121. + exit 1
  122. fi; exit $res
  123. EOF
  124. gzip -cv9 "$i" >> $tmp || {
  125. --- gzip-1.3.5/zdiff.in.owl-tmp 2002-09-26 10:33:24.000000000 +0200
  126. +++ gzip-1.3.5/zdiff.in 2005-03-21 18:35:36.669875653 +0100
  127. @@ -46,13 +46,13 @@
  128. case "$2" in
  129. *[-.]gz* | *[-.][zZ] | *.t[ga]z)
  130. F=`echo "$2" | sed 's|.*/||;s|[-.][zZtga]*||'`
  131. - set -C
  132. - trap 'rm -f /tmp/"$F".$$; exit 2' HUP INT PIPE TERM 0
  133. - gzip -cdfq "$2" > /tmp/"$F".$$ || exit
  134. - gzip -cdfq "$1" | $comp $OPTIONS - /tmp/"$F".$$
  135. + TF=`/bin/mktemp ${TMPDIR:-/tmp}/"$F".XXXXXXXXXX` || exit 1
  136. + trap 'rm -f "$TF"; exit 2' EXIT HUP INT PIPE TERM
  137. + gzip -cdfq "$2" > "$TF" || exit
  138. + gzip -cdfq "$1" | $comp $OPTIONS - "$TF"
  139. STAT="$?"
  140. - /bin/rm -f /tmp/"$F".$$ || STAT=2
  141. - trap - HUP INT PIPE TERM 0
  142. + rm -f "$TF" || STAT=2
  143. + trap - EXIT HUP INT PIPE TERM
  144. exit $STAT;;
  145. *) gzip -cdfq "$1" | $comp $OPTIONS - "$2";;