diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2003-07-31 07:44:46 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2003-07-31 07:44:46 +0000 |
commit | 1c8fa932b8353236a15118a2491f738d0285d045 (patch) | |
tree | ef25c7d02b9f36c0a88d870ac2e1907106e5668e | |
parent | c053870134b7b8ea4a308d86ac7d3830a0fd8794 (diff) |
Bye bye GNU gzexe(1).
ok deraadt@
-rw-r--r-- | gnu/usr.bin/gzip/Makefile | 6 | ||||
-rw-r--r-- | gnu/usr.bin/gzip/gzexe | 142 | ||||
-rw-r--r-- | gnu/usr.bin/gzip/gzexe.1 | 44 |
3 files changed, 3 insertions, 189 deletions
diff --git a/gnu/usr.bin/gzip/Makefile b/gnu/usr.bin/gzip/Makefile index d1aff921b01..518401ac837 100644 --- a/gnu/usr.bin/gzip/Makefile +++ b/gnu/usr.bin/gzip/Makefile @@ -1,11 +1,11 @@ -# $OpenBSD: Makefile,v 1.18 2003/07/29 11:54:33 otto Exp $ +# $OpenBSD: Makefile,v 1.19 2003/07/31 07:44:45 otto Exp $ # $NetBSD: Makefile,v 1.17 1995/10/24 22:18:34 jtc Exp $ -MAN= gzexe.1 znew.1 +MAN= znew.1 afterinstall: install -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ - ${.CURDIR}/gzexe ${.CURDIR}/znew \ + ${.CURDIR}/znew \ ${DESTDIR}${BINDIR} .include <bsd.prog.mk> diff --git a/gnu/usr.bin/gzip/gzexe b/gnu/usr.bin/gzip/gzexe deleted file mode 100644 index 65bbf252902..00000000000 --- a/gnu/usr.bin/gzip/gzexe +++ /dev/null @@ -1,142 +0,0 @@ -#!/bin/sh -# gzexe: compressor for Unix executables. -# Use this only for binaries that you do not use frequently. -# -# The compressed version is a shell script which decompresses itself after -# skipping $skip lines of shell commands. We try invoking the compressed -# executable with the original name (for programs looking at their name). -# We also try to retain the original file permissions on the compressed file. -# For safety reasons, gzexe will not create setuid or setgid shell scripts. - -# WARNING: the first line of this file must be either : or #!/bin/sh -# The : is required for some old versions of csh. -# On Ultrix, /bin/sh is too buggy, change the first line to: #!/bin/sh5 -# -# $OpenBSD: gzexe,v 1.7 2003/02/08 10:19:30 pvalchev Exp $ - -x=`basename "$0"` -if test $# = 0; then - echo compress executables. original file foo is renamed to foo~ - echo usage: ${x} [-d] files... - echo " -d decompress the executables" - exit 1 -fi - -decomp=0 -res=0 -test "$x" = "ungzexe" && decomp=1 -if test "x$1" = "x-d"; then - decomp=1 - shift -fi - -tail="" -IFS="${IFS= }"; saveifs="$IFS"; IFS="${IFS}:" -for dir in $PATH; do - test -z "$dir" && dir=. - if test -f $dir/tail; then - tail="$dir/tail" - break - fi -done -IFS="$saveifs" -if test -z "$tail"; then - echo cannot find tail - exit 1 -fi - -for i do - if test ! -f "$i" ; then - echo ${x}: $i not a file - res=1 - continue - fi - if test $decomp -eq 0; then - if sed -e 1d -e 2q "$i" | grep "^skip=[0-9]*$" >/dev/null; then - echo "${x}: $i is already gzexe'd" - continue - fi - fi - if ls -l "$i" | grep '^...[sS]' > /dev/null; then - echo "${x}: $i has setuid permission, unchanged" - continue - fi - if ls -l "$i" | grep '^......[sS]' > /dev/null; then - echo "${x}: $i has setgid permission, unchanged" - continue - fi - case "`basename $i`" in - sh | gzip | tail | chmod | ln | sleep | rm | sed | mktemp) - echo "${x}: $i would depend on itself"; continue ;; - esac - - tmp=`/usr/bin/mktemp gzXXXXXXXXXX` || exit 1 - trap "rm -f $tmp; exit 1" 1 2 3 5 10 13 15 - - cp -p "$i" $tmp 2>/dev/null || cp "$i" $tmp - if test -w $tmp 2>/dev/null; then - writable=1 - else - writable=0 - chmod u+w $tmp 2>/dev/null - fi - if test $decomp -eq 0; then - sed 1q "$0" > $tmp - sed "s|^if tail|if $tail|" >> $tmp <<'EOF' -skip=14 -tmpdir=`/usr/bin/mktemp -d /tmp/gzexeXXXXXXXXXX` || { - rm -f ${tmp} - exit 1 -} -prog="${tmpdir}/`echo \"$0\" | sed 's|^.*/||'`" -if tail +$skip "$0" | gzip -cd > "$prog"; then - chmod 700 "$prog" - trap '/bin/rm -rf $tmpdir exit $res' 0 - "$prog" ${1+"$@"}; res=$? -else - echo Cannot decompress $0 - rm -rf $tmpdir - exit 1 -fi; exit $res -EOF - gzip -cv9 "$i" >> $tmp || { - /bin/rm -f $tmp - echo ${x}: compression not possible for $i, file unchanged. - res=1 - continue - } - - else - # decompression - skip=18 - if sed -e 1d -e 2q "$i" | grep "^skip=[0-9]*$" >/dev/null; then - eval `sed -e 1d -e 2q "$i"` - fi - if tail +$skip "$i" | gzip -cd > $tmp; then - : - else - echo ${x}: $i probably not in gzexe format, file unchanged. - /bin/rm -f $tmp - res=1 - continue - fi - fi - rm -f "$i~" - mv "$i" "$i~" || { - echo ${x}: cannot backup $i as $i~ - /bin/rm -f $tmp - res=1 - continue - } - mv $tmp "$i" || cp -p $tmp "$i" 2>/dev/null || cp $tmp "$i" || { - echo ${x}: cannot create $i - /bin/rm -f $tmp - res=1 - continue - } - /bin/rm -f $tmp - if test $writable -eq 0; then - chmod u-w $i 2>/dev/null - fi -done -exit $res diff --git a/gnu/usr.bin/gzip/gzexe.1 b/gnu/usr.bin/gzip/gzexe.1 deleted file mode 100644 index e5da3cdef0d..00000000000 --- a/gnu/usr.bin/gzip/gzexe.1 +++ /dev/null @@ -1,44 +0,0 @@ -.\" $Id: gzexe.1,v 1.1 1995/10/18 08:40:52 deraadt Exp $ -.TH GZEXE 1 -.SH NAME -gzexe \- compress executable files in place -.SH SYNOPSIS -.B gzexe -[ name ... ] -.SH DESCRIPTION -The -.I gzexe -utility allows you to compress executables in place and have them -automatically uncompress and execute when you run them (at a penalty -in performance). For example if you execute ``gzexe /bin/cat'' it -will create the following two files: -.nf -.br - -r-xr-xr-x 1 root bin 9644 Feb 11 11:16 /bin/cat - -r-xr-xr-x 1 bin bin 24576 Nov 23 13:21 /bin/cat~ -.fi -/bin/cat~ is the original file and /bin/cat is the self-uncompressing -executable file. You can remove /bin/cat~ once you are sure that -/bin/cat works properly. -.PP -This utility is most useful on systems with very small disks. -.SH OPTIONS -.TP -.B \-d -Decompress the given executables instead of compressing them. -.SH "SEE ALSO" -gzip(1), znew(1), zmore(1), zcmp(1), zforce(1) -.SH CAVEATS -The compressed executable is a shell script. This may create some -security holes. In particular, the compressed executable relies -on the PATH environment variable to find -.I gzip -and some other utilities -.I (tail, chmod, ln, sleep). -.SH "BUGS" -.I gzexe -attempts to retain the original file attributes on the compressed executable, -but you may have to fix them manually in some cases, using -.I chmod -or -.I chown. |