2002-10-01 02:37:53 +00:00
|
|
|
#! /bin/bash
|
2001-01-09 22:49:14 +00:00
|
|
|
# create pak files with gzipped internals
|
2001-01-09 05:58:40 +00:00
|
|
|
|
|
|
|
if [ $# -eq 0 ]; then
|
2001-01-09 23:51:55 +00:00
|
|
|
echo "usage: $0 <pakfile> ..."
|
2001-01-09 05:58:40 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2002-10-01 02:37:53 +00:00
|
|
|
tmpdir=/var/tmp/zpak.$$
|
|
|
|
|
2001-01-09 05:58:40 +00:00
|
|
|
for pakfile in $*; do
|
2002-10-01 02:37:53 +00:00
|
|
|
[ ! -f ${pakfile} ] && echo "${pakfile} not found" && continue
|
|
|
|
[ "${pakfile#/}" = "${pakfile}" ] && pakfile=${PWD}/${pakfile}
|
|
|
|
|
|
|
|
mkdir ${tmpdir}
|
|
|
|
cd ${tmpdir}
|
|
|
|
pak -vxf ${pakfile}
|
2001-01-09 05:58:40 +00:00
|
|
|
|
2002-10-01 02:37:53 +00:00
|
|
|
# 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 {} \;
|
2001-01-09 05:58:40 +00:00
|
|
|
|
|
|
|
mv ${pakfile} ${pakfile}.bak
|
2002-10-01 02:37:53 +00:00
|
|
|
pak -vcf ${pakfile} $(find * -type f | sort)
|
|
|
|
|
2001-01-09 05:58:40 +00:00
|
|
|
cd -
|
2002-10-01 02:37:53 +00:00
|
|
|
rm -rf ${tmpdir}
|
2001-01-09 05:58:40 +00:00
|
|
|
done
|