]> git.rm.cloudns.org Git - xonotic/xonotic.git/commitdiff
add hacky script to losslessly compress pk3s using flif and squashfs.
authorMatthias Krüger <matthias.krueger@famsik.de>
Thu, 29 Dec 2016 15:07:31 +0000 (16:07 +0100)
committerMatthias Krüger <matthias.krueger@famsik.de>
Thu, 29 Dec 2016 15:07:31 +0000 (16:07 +0100)
compress_pk3.sh [new file with mode: 0755]

diff --git a/compress_pk3.sh b/compress_pk3.sh
new file mode 100755 (executable)
index 0000000..8ef719a
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/bash
+inputPk3 = $1
+
+echo "Extracting"
+unzip -d extractDir $1
+cd extractDir
+
+echo "Converting"
+for file in `find . | grep "\.tga"`; do # in theory we could make this parallel
+       convert ${file} "${file%.tga}.png" # tga -> png
+       $FLIF -e "${file%.tga}.png" "${file%.tga}.flif" # png -> flif
+       rm $file # rm tga
+       rm ${file%.tga}.png # rm png
+done
+
+echo "Compressing"
+mksquashfs * ../${1}.sqfs -comp xz -Xdict-size "100%"
+cd .. # clean up
+rm -r extractDir