3 # Compresses files and makes sure that symlinks pointing to the
4 # compressed files get fixed.
6 PATH=debian:$PATH:/usr/lib/debhelper
9 for PACKAGE in $DH_DOPACKAGES; do
13 # Run the file name gatering commands from within the directory
14 # structure that will be effected.
18 if [ -f debian/${EXT}compress ]; then
19 # The config file is a sh script that outputs the files to be compressed
20 # (typically using find).
21 files=`sh debian/${EXT}compress 2>/dev/null`
23 # By default fall back on what the policy manual says to compress.
25 find usr/info usr/man usr/X11*/man -type f 2>/dev/null ;
26 find usr/doc -type f \( -size +4k -or -name "changelog*" \) \
27 ! -name "*.htm*" ! -name "*.gif" \
28 ! -name "copyright" 2>/dev/null
33 # This is just a cosmetic fix.
34 files=`echo $files | tr "\n" " "`
36 doit "gzip -9 $files" || true
39 # Change back to old pwd.
42 # Fix up symlinks that were pointing to the uncompressed files.
43 for file in `find $TMP -type l`; do
44 DIRECTORY=`expr $file : "\(.*\)/[^/]*"`
45 NAME=`expr $file : ".*/\([^/]*\)"`
46 LINKVAL=`ls -l $DIRECTORY/$NAME | awk '{ print $11;}'`
47 if [ ! -e $DIRECTORY/$LINKVAL -a -f $DIRECTORY/$LINKVAL.gz ]; then
48 doit "rm $DIRECTORY/$NAME"
49 doit "ln -s $LINKVAL.gz $DIRECTORY/$NAME.gz"