3 # Compresses files and makes sure that symlinks pointing to the
4 # compressed files get fixed.
6 PATH=debian:$PATH:/usr/lib/debhelper
9 # The config file is a sh script that outputs the files to be compressed
10 # (typically using find).
11 if [ -f debian/compress ]; then
12 files=`sh debian/compress 2>/dev/null`
14 # By default fall back on what the policy manual says to compress.
16 find debian/tmp/usr/info debian/tmp/usr/man \
17 debian/tmp/usr/X11*/man -type f 2>/dev/null ;
18 find debian/tmp/usr/doc -type f -size +4k \
19 ! -name "*.htm*" ! -name "*.gif" \
20 ! -name "debian/tmp/usr/doc/*/copyright" 2>/dev/null
25 # This is just a cosmetic fix.
26 files=`echo $files | tr "\n" " "`
28 doit "gzip -9 $files" || true
31 # Fix up symlinks that were pointing to the uncompressed files.
32 for file in `find debian/tmp -type l`; do
33 DIRECTORY=`expr $file : "\(.*\)/[^/]*"`
34 NAME=`expr $file : ".*/\([^/]*\)"`
35 LINKVAL=`ls -l $DIRECTORY/$NAME | awk '{ print $11;}'`
36 if [ ! -e $DIRECTORY/$LINKVAL -a -f $DIRECTORY/$LINKVAL.gz ]; then
37 doit "rm $DIRECTORY/$NAME"
38 doit "ln -s $LINKVAL.gz $DIRECTORY/$NAME.gz"