updatepaks.sh 701 B

12345678910111213141516171819202122232425262728
  1. #!/bin/sh
  2. echo "current pak files: $1"
  3. echo "expanded updated source: $2"
  4. echo "new pak file: $3"
  5. echo "press a key"
  6. read
  7. TMPDIR=`mktemp -d -t`
  8. ls "$1/"*.pk4 | while read i ; do unzip -l $i | cut -b 29- | tee $TMPDIR/`basename $i`.log ; done
  9. ls $TMPDIR/*.log | while read i ; do lines=`cat $i | wc -l` ; tail +4 $i | head -$(( $lines - 5 )) | tee $TMPDIR/`basename $i`.2 ; done
  10. # check cutting off
  11. #ls $TMPDIR/*.log | while read i ; do diff $i $i.2 ; done
  12. cat $TMPDIR/*.log.2 | sort -u | tee $TMPDIR/sorted-unique.log
  13. # now the magical zip command
  14. cd $2
  15. rm $3
  16. cat $TMPDIR/sorted-unique.log | zip -b $TMPDIR $3 -@ 1>/dev/null
  17. md5sum $3
  18. echo "done."