]> git.xonotic.org Git - xonotic/xonotic.git/blob - compress_pk3.sh
add hacky script to losslessly compress pk3s using flif and squashfs.
[xonotic/xonotic.git] / compress_pk3.sh
1 #!/bin/bash
2 inputPk3 = $1
3
4 echo "Extracting"
5 unzip -d extractDir $1
6 cd extractDir
7
8 echo "Converting"
9 for file in `find . | grep "\.tga"`; do # in theory we could make this parallel
10         convert ${file} "${file%.tga}.png" # tga -> png
11         $FLIF -e "${file%.tga}.png" "${file%.tga}.flif" # png -> flif
12         rm $file # rm tga
13         rm ${file%.tga}.png # rm png
14 done
15
16 echo "Compressing"
17 mksquashfs * ../${1}.sqfs -comp xz -Xdict-size "100%"
18 cd .. # clean up
19 rm -r extractDir