|
Elliot Lee |
03bb291 |
#!/bin/sh
|
|
Elliot Lee |
03bb291 |
|
|
Elliot Lee |
03bb291 |
# If using normal root, avoid changing anything.
|
|
Elliot Lee |
03bb291 |
if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
|
|
Elliot Lee |
03bb291 |
exit 0
|
|
Elliot Lee |
03bb291 |
fi
|
|
Elliot Lee |
03bb291 |
|
|
Elliot Lee |
03bb291 |
cd $RPM_BUILD_ROOT
|
|
Elliot Lee |
03bb291 |
|
|
Elliot Lee |
03bb291 |
# Compress man pages
|
|
Elliot Lee |
ff150bb |
COMPRESS="gzip -9 -n"
|
|
Elliot Lee |
03bb291 |
COMPRESS_EXT=.gz
|
|
Elliot Lee |
03bb291 |
|
|
Elliot Lee |
03bb291 |
for d in ./usr/man/man* ./usr/man/*/man* ./usr/info \
|
|
Elliot Lee |
03bb291 |
./usr/share/man/man* ./usr/share/man/*/man* ./usr/share/info \
|
|
Elliot Lee |
03bb291 |
./usr/kerberos/man ./usr/X11R6/man/man* ./usr/lib/perl5/man/man* \
|
|
Elliot Lee |
03bb291 |
./usr/share/doc/*/man/man* ./usr/lib/*/man/man*
|
|
Elliot Lee |
03bb291 |
do
|
|
Elliot Lee |
03bb291 |
[ -d $d ] || continue
|
|
Elliot Lee |
03bb291 |
for f in `find $d -type f`
|
|
Elliot Lee |
03bb291 |
do
|
|
Elliot Lee |
03bb291 |
[ -f "$f" ] || continue
|
|
Elliot Lee |
03bb291 |
[ "`basename $f`" = "dir" ] && continue
|
|
Elliot Lee |
03bb291 |
|
|
Elliot Lee |
03bb291 |
case "$f" in
|
|
Adrian Havill |
84b5678 |
*.Z) gunzip -f $f; b=`echo $f | sed -e 's/\.Z$//'`;;
|
|
Adrian Havill |
84b5678 |
*.gz) gunzip -f $f; b=`echo $f | sed -e 's/\.gz$//'`;;
|
|
Adrian Havill |
84b5678 |
*.bz2) bunzip2 -f $f; b=`echo $f | sed -e 's/\.bz2$//'`;;
|
|
Elliot Lee |
03bb291 |
*) b=$f;;
|
|
Elliot Lee |
03bb291 |
esac
|
|
Elliot Lee |
03bb291 |
|
|
Elliot Lee |
03bb291 |
$COMPRESS $b </dev/null 2>/dev/null || {
|
|
Elliot Lee |
03bb291 |
inode=`ls -i $b | awk '{ print $1 }'`
|
|
Elliot Lee |
03bb291 |
others=`find $d -type f -inum $inode`
|
|
Elliot Lee |
03bb291 |
if [ -n "$others" ]; then
|
|
Elliot Lee |
03bb291 |
for afile in $others ; do
|
|
Elliot Lee |
03bb291 |
[ "$afile" != "$b" ] && rm -f $afile
|
|
Elliot Lee |
03bb291 |
done
|
|
Elliot Lee |
03bb291 |
$COMPRESS -f $b
|
|
Elliot Lee |
03bb291 |
for afile in $others ; do
|
|
Elliot Lee |
03bb291 |
[ "$afile" != "$b" ] && ln $b$COMPRESS_EXT $afile$COMPRESS_EXT
|
|
Elliot Lee |
03bb291 |
done
|
|
Elliot Lee |
03bb291 |
else
|
|
Elliot Lee |
03bb291 |
$COMPRESS -f $b
|
|
Elliot Lee |
03bb291 |
fi
|
|
Elliot Lee |
03bb291 |
}
|
|
Elliot Lee |
03bb291 |
done
|
|
Elliot Lee |
03bb291 |
|
|
Elliot Lee |
03bb291 |
for f in `find $d -type l`
|
|
Elliot Lee |
03bb291 |
do
|
|
Elliot Lee |
03bb291 |
l=`ls -l $f | sed -e 's/.* -> //' -e 's/\.gz$//' -e 's/\.bz2$//' -e 's/\.Z$//'`
|
|
Elliot Lee |
03bb291 |
rm -f $f
|
|
Elliot Lee |
03bb291 |
b=`echo $f | sed -e 's/\.gz$//' -e 's/\.bz2$//' -e 's/\.Z$//'`
|
|
Elliot Lee |
03bb291 |
ln -sf $l$COMPRESS_EXT $b$COMPRESS_EXT
|
|
Elliot Lee |
03bb291 |
done
|
|
Elliot Lee |
03bb291 |
done
|