#!/bin/bash
cd /usr/src/gzip-*/ ||exit

patch -p 1 <../gzip-1.3.5-security_fixes-1.patch

#gzexe has the location of gzip hard-wired into it, but we change it:
sed -i 's@BINDIR@/bin@g' gzexe.in


./configure --prefix=/usr &&
make &&
make install &&
mv /usr/bin/gzip /bin &&
rm -f /usr/bin/{z{{e,f}grep,cmp,cat},gunzip,compress}
ln -sf gzip /bin/gunzip &&
ln -sf gzip /bin/zcat &&
ln -sf zgrep /usr/bin/zegrep &&
ln -sf zgrep /usr/bin/zfgrep &&
ln -sf gzip /bin/compress &&
ln -sf gunzip /bin/uncompress
