mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-29 15:41:59 +00:00
smarter gzipping thanks to alphageek (whew, slipped in at last moment:)
This commit is contained in:
parent
eff63a6fe4
commit
a2cf42c8fd
1 changed files with 19 additions and 10 deletions
29
tools/zpak
29
tools/zpak
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#! /bin/bash
|
||||
# create pak files with gzipped internals
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
|
@ -6,18 +6,27 @@ if [ $# -eq 0 ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
tmpdir=/var/tmp/zpak.$$
|
||||
|
||||
for pakfile in $*; do
|
||||
if [ ! -f ${pakfile} ]; then echo ${pakfile} not found; continue; fi
|
||||
[ "${pakfile#/}" = "${pakfile}" ] && pakfile=`pwd`/${pakfile}
|
||||
[ ! -f ${pakfile} ] && echo "${pakfile} not found" && continue
|
||||
[ "${pakfile#/}" = "${pakfile}" ] && pakfile=${PWD}/${pakfile}
|
||||
|
||||
tmp=/var/tmp/zpak.$$
|
||||
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 {} \;
|
||||
|
||||
mkdir ${tmp}
|
||||
cd ${tmp}
|
||||
pak -vxf ${pakfile} | sed -e 's/$/.gz/' > pakfile.lst
|
||||
mv ${pakfile} ${pakfile}.bak
|
||||
gzip -rv9 *
|
||||
pak -vcf ${pakfile} `zcat pakfile.lst.gz`
|
||||
pak -vcf ${pakfile} $(find * -type f | sort)
|
||||
|
||||
cd -
|
||||
rm -rf ${tmp}
|
||||
rm -rf ${tmpdir}
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue