Shrinksafe script fixed to workaround Linux vs BSD stat packages.
Under MacOSX (BSD) the format for stat needs "-f" switch, while
under Linux stat needs "-c". Changed to use ls and awk, which
seem to be cross compatible.
--- a/scripts/shrinksafe.sh Thu Sep 17 14:41:15 2009 +0530
+++ b/scripts/shrinksafe.sh Thu Sep 17 17:15:10 2009 +0200
@@ -14,7 +14,7 @@
for dir in $(find $SOURCE_DIR -type d); do
for i in $(find $dir/*.js -type f); do
echo "SHRINKSAFE: Processing $i"
- CURRENT_SOURCE_FILE_SIZE=$(stat -c%s "$i")
+ CURRENT_SOURCE_FILE_SIZE=$(ls -l "$i" | awk '{print $5}')
let SOURCE_FILE_SIZES=$SOURCE_FILE_SIZES+$CURRENT_SOURCE_FILE_SIZE
mv $i $i.old.js
java -jar $SHRINKSAFE $i.old.js > $i
@@ -23,7 +23,7 @@
cp $i.old.js $i
fi
rm $i.old.js
- CURRENT_DEST_FILE_SIZE=$(stat -c%s "$i")
+ CURRENT_DEST_FILE_SIZE=$(ls -l "$i" | awk '{print $5}')
let DEST_FILE_SIZES=$DEST_FILE_SIZES+$CURRENT_DEST_FILE_SIZE
done
done