2000-01-08 01:32:27 +08:00
|
|
|
#!/bin/sh
|
2000-05-23 01:33:32 +08:00
|
|
|
|
2000-01-08 01:32:27 +08:00
|
|
|
# If using normal root, avoid changing anything.
|
|
|
|
if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd $RPM_BUILD_ROOT
|
|
|
|
|
|
|
|
# Compress man pages
|
2004-10-18 02:49:52 +08:00
|
|
|
COMPRESS="gzip -9 -n"
|
2000-02-07 02:07:12 +08:00
|
|
|
COMPRESS_EXT=.gz
|
2000-01-08 01:32:27 +08:00
|
|
|
|
2000-06-21 05:45:50 +08:00
|
|
|
for d in ./usr/man/man* ./usr/man/*/man* ./usr/info \
|
|
|
|
./usr/share/man/man* ./usr/share/man/*/man* ./usr/share/info \
|
2000-07-22 22:06:32 +08:00
|
|
|
./usr/kerberos/man ./usr/X11R6/man/man* ./usr/lib/perl5/man/man* \
|
2000-07-22 22:14:07 +08:00
|
|
|
./usr/share/doc/*/man/man* ./usr/lib/*/man/man*
|
2000-01-08 01:32:27 +08:00
|
|
|
do
|
|
|
|
[ -d $d ] || continue
|
2000-02-07 02:07:12 +08:00
|
|
|
for f in `find $d -type f`
|
2000-01-08 01:32:27 +08:00
|
|
|
do
|
2000-06-21 05:45:50 +08:00
|
|
|
[ -f "$f" ] || continue
|
|
|
|
[ "`basename $f`" = "dir" ] && continue
|
|
|
|
|
|
|
|
case "$f" in
|
2009-08-04 05:34:31 +08:00
|
|
|
*.gz|*.Z) gunzip $f; b=`echo $f | sed -e 's/\.\(gz\|Z\)$//'`;;
|
|
|
|
*.bz2) bunzip2 $f; b=`echo $f | sed -e 's/\.bz2$//'`;;
|
|
|
|
*.xz|*.lzma) unxz $f; b=`echo $f | sed -e 's/\.\(xz\|lzma\)$//'`;;
|
2000-06-21 05:45:50 +08:00
|
|
|
*) b=$f;;
|
|
|
|
esac
|
|
|
|
|
2000-12-03 05:53:44 +08:00
|
|
|
$COMPRESS $b </dev/null 2>/dev/null || {
|
2000-06-21 05:45:50 +08:00
|
|
|
inode=`ls -i $b | awk '{ print $1 }'`
|
|
|
|
others=`find $d -type f -inum $inode`
|
|
|
|
if [ -n "$others" ]; then
|
|
|
|
for afile in $others ; do
|
|
|
|
[ "$afile" != "$b" ] && rm -f $afile
|
|
|
|
done
|
|
|
|
$COMPRESS -f $b
|
|
|
|
for afile in $others ; do
|
|
|
|
[ "$afile" != "$b" ] && ln $b$COMPRESS_EXT $afile$COMPRESS_EXT
|
|
|
|
done
|
|
|
|
else
|
|
|
|
$COMPRESS -f $b
|
|
|
|
fi
|
|
|
|
}
|
2000-02-07 02:07:12 +08:00
|
|
|
done
|
2000-06-21 05:45:50 +08:00
|
|
|
|
2000-02-07 02:07:12 +08:00
|
|
|
for f in `find $d -type l`
|
|
|
|
do
|
2009-08-04 05:34:31 +08:00
|
|
|
l=`ls -l $f | sed -e 's/.* -> //' -e 's/\.\(gz\|Z\|bz2\|xz\|lzma\)$//'`
|
2000-02-07 02:07:12 +08:00
|
|
|
rm -f $f
|
2009-08-04 05:34:31 +08:00
|
|
|
b=`echo $f | sed -e 's/\.\(gz\|Z\|bz2\|xz\|lzma\)$//'`
|
2000-02-07 02:07:12 +08:00
|
|
|
ln -sf $l$COMPRESS_EXT $b$COMPRESS_EXT
|
2000-01-08 01:32:27 +08:00
|
|
|
done
|
|
|
|
done
|