From df27070399c61922ec227823602f0d7f06043726 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Mon, 7 Mar 2011 04:29:48 -0800 Subject: [PATCH] Add output filename parameter to pngcrush.sh. --- makefile | 2 +- pngcrush.sh | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/makefile b/makefile index 4452d64a..03dbebcb 100644 --- a/makefile +++ b/makefile @@ -141,7 +141,7 @@ package: MobileCydia mkdir -p _/DEBIAN ./control.sh _ >_/DEBIAN/control - find _ -name '*.png' -exec ./pngcrush.sh '{}' ';' + find _ -name '*.png' -exec ./pngcrush.sh '{}' '{}' ';' find _ -exec touch -t "$$(date -j -f "%s" +"%Y%m%d%H%M.%S" "$$(git show --format='format:%ct' | head -n 1)")" {} ';' sudo chown -R 0 _ diff --git a/pngcrush.sh b/pngcrush.sh index 69715fbf..aa695764 100755 --- a/pngcrush.sh +++ b/pngcrush.sh @@ -1,6 +1,8 @@ #!/bin/bash png=$1 +out=$2 + steps=() function step() { @@ -11,7 +13,13 @@ function step() { pngcrush=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush -grep CgBI "${png}" &>/dev/null && exit 0 +if grep CgBI "${png}" &>/dev/null; then + if [[ ${png} != ${out} ]]; then + cp -a "${png}" "${out}" + fi + + exit 0 +fi step cp -fa "${png}" __.png @@ -26,7 +34,7 @@ step "${pngcrush}" -q -rem alla -reduce -iphone {,_}_.png #"${pngcrush}" -q -iphone _.png 2.png #ls -la 1.png 2.png -mv -f _.png "${png}" +mv -f _.png "${out}" echo -n "${png##*/} " for ((i = 0; i != ${#steps[@]}; ++i)); do -- 2.45.2