]> icculus.org git repositories - icculus/iodoom3.git/blob - neo/sys/linux/pk4/updatepaks.sh
Various Mac OS X tweaks to get this to build. Probably breaking things.
[icculus/iodoom3.git] / neo / sys / linux / pk4 / updatepaks.sh
1 #!/bin/sh
2
3 echo "current pak files:       $1"
4 echo "expanded updated source: $2"
5 echo "new pak file:            $3"
6 echo "press a key"
7 read
8
9 TMPDIR=`mktemp -d -t`
10
11 ls "$1/"*.pk4 | while read i ; do unzip -l $i | cut -b 29- | tee $TMPDIR/`basename $i`.log ; done
12
13 ls $TMPDIR/*.log | while read i ; do lines=`cat $i | wc -l` ; tail +4 $i | head -$(( $lines - 5 )) | tee $TMPDIR/`basename $i`.2 ; done
14
15 # check cutting off
16 #ls $TMPDIR/*.log | while read i ; do diff $i $i.2 ; done
17
18 cat $TMPDIR/*.log.2 | sort -u | tee $TMPDIR/sorted-unique.log
19
20 # now the magical zip command
21 cd $2
22 rm $3
23 cat $TMPDIR/sorted-unique.log | zip -b $TMPDIR $3 -@ 1>/dev/null
24
25 md5sum $3
26 echo "done."
27