quakeforge/tools/zpak

33 lines
676 B
Text
Raw Normal View History

#! /bin/sh
2001-01-09 22:49:14 +00:00
# create pak files with gzipped internals
if [ $# -eq 0 ]; then
2001-01-09 23:51:55 +00:00
echo "usage: $0 <pakfile> ..."
exit 1
fi
tmpdir=/var/tmp/zpak.$$
for pakfile in $*; do
[ ! -f ${pakfile} ] && echo "${pakfile} not found" && continue
[ "${pakfile#/}" = "${pakfile}" ] && pakfile=${PWD}/${pakfile}
mkdir ${tmpdir}
cd ${tmpdir}
pak -vxf ${pakfile}
# cosmetic (gzip preserves timestamps.. could come in handy)
find * -type f \
-exec touch -r ${pakfile} {} \;
find * -type f \
! -name '*.gz' ! -name '*.jpg' ! -name '*.ogg' ! -name '*.png' \
-exec gzip -v9 {} \;
mv ${pakfile} ${pakfile}.bak
pak -vcf ${pakfile} $(find * -type f | sort)
cd -
rm -rf ${tmpdir}
done