#!/bin/csh
# ~jhs/public_html/bin/.csh/gzip_bins Uses ~/bin/.csh/test_exec
echo "Compresses all system executables, (make sure you have a kernel with"
echo " pseudo-device gzip"
echo "or this script will trash your system)."
echo "Script must be run as root"
# Limitation: Executables with multiple links do not get compressed.
# Was last run on 3.2 on lapt, only hash out next exit when you're sure !
echo see also man gzexe
exit
mkdir /tmp/tools
foreach i ( mv find grep file test gzip )
cp `which $i` /tmp/tools
end
mkdir /usr/tmp/libexec
(cd /usr/libexec ; tar cf - . ) | ( cd /usr/tmp/libexec ; tar xf - )
foreach i ( /sbin /bin /usr/sbin /usr/bin /usr/tmp/libexec \
/usr/tmp/libexec/aout /modules /usr/local/bin )
# Removed: /usr/games /usr/local/bin /usr/local/sbin
# These did not exist on lapt, which caused a premature break:
# /usr/home/jhs/bin/.FreeBSD
# These should have no executables:
# /usr/home/jhs/bin/ .csh .sh .bash .perl .other
echo Starting $i
pushd $i
find . -type f -print | xargs chflags noschg
find . -type f -print | xargs strip
foreach j (*)
echo examining $i/$j
/tmp/tools/find $j -type f -links 1 -exec /tmp/tools/test \
\-x {} \; -exec /usr/home/jhs/bin/.csh/test_exec {} \; \
-exec /tmp/tools/gzip {} \;
( /tmp/tools/mv -f $j.gz $j ) # fails on /usr/tmp/libexec/aout
echo done $i/$j
end
popd
echo Done $i
end
# Un-necessary for 3.2 {
? # Overlay to discard my compressing for ld.so & rlogind
# (cd /usr/libexec ; tar cf - ld.so rlogind ) | ( cd /usr/tmp/libexec ; tar xf - )mv /usr/libexec /usr/libexec.no_gzip
# }
/tmp/tools/mv /usr/libexec /usr/libexec.old ; /tmp/tools/mv /usr/tmp/libexec /usr/libexec
#un-necessary for 3.2 {
# To avoid failure of: file -z `which file` (for which I've sent a send-pr 1.99)
# mv /usr/bin/file /usr/bin/file.gz ; gzip -d /usr/bin/file.gz
# }
rm -rf /tmp/tools
# Assume we are running on lapt, & strip un-necessary X servers:
cd /usr/local/bin ; rm -f XF86_3DLabs XF86_8514 XF86_AGX XF86_I128 XF86_Mach32 \
XF86_Mach64 XF86_Mach8 XF86_P9000 XF86_S3 XF86_S3V XF86_W32
cd /usr/share
rm -rf calendar/hr_HR.ISO_8859-2
gzip dict/*
rm -rf games
( cd locale ; rm -rf da_DK.ISO_8859-1 de_AT.ISO_8859-1 de_CH.ISO_8859-1 \
en_AU.ISO_8859-1 en_CA.ISO_8859-1 es_ES.ISO_8859-1 fi_FI.ISO_8859-1 \
fr_BE.ISO_8859-1 fr_CA.ISO_8859-1 fr_CH.ISO_8859-1 fr_FR.ISO_8859-1 \
hr_HR.ISO_8859-2 hu_HU.ISO_8859-2 is_IS.ISO_8859-1 it_CH.ISO_8859-1 \
it_IT.ISO_8859-1 ja_JP.EUC ja_JP.SJIS ko_KR.EUC nl_BE.ISO_8859-1 \
nl_NL.ISO_8859-1 no_NO.ISO_8859-1 pl_PL.ISO_8859-2 pt_PT.ISO_8859-1 \
sl_SI.ISO_8859-2 sv_SE.ISO_8859-1 )
(cd nls ; rm -rf da_DK.ISO_8859-1 de_AT.ISO_8859-1 de_CH.ISO_8859-1 \
en_AU.ISO_8859-1 en_CA.ISO_8859-1 es_ES.ISO_8859-1 fi_FI.ISO_8859-1 \
fr_BE.ISO_8859-1 fr_CA.ISO_8859-1 fr_CH.ISO_8859-1 fr_FR.ISO_8859-1 \
hr_HR.ISO_8859-2 hu_HU.ISO_8859-2 is_IS.ISO_8859-1 it_CH.ISO_8859-1 \
it_IT.ISO_8859-1 ja_JP.EUC ja_JP.SJIS ko_KR.EUC nl_BE.ISO_8859-1 \
nl_NL.ISO_8859-1 no_NO.ISO_8859-1 pl_PL.ISO_8859-2 pt_PT.ISO_8859-1 \
sl_SI.ISO_8859-2 sv_SE.ISO_8859-1 )
(cd zoneinfo ; rm -rf Africa America/Indiana Antarctica Arctic Asia Indian \
Pacific )