squisher: fix OS X darwin compatibility
Number of processors: use sysctl on darwin.
xargs: fix incompatible arguments.
sed: use gsed on darwin because -i option is not compatible.
Change-Id: Ic3885db592e9588f01b69843add0e287ad35d4e9
diff --git a/tools/squisher b/tools/squisher
index 9629fa8..2f2c1a8 100755
--- a/tools/squisher
+++ b/tools/squisher
@@ -9,9 +9,13 @@
then
OUT_TARGET_HOST=linux-x86
MD5=md5sum
+ XARGS="xargs --max-args=1 --max-procs `grep 'processor' /proc/cpuinfo|wc -l`"
+ SED=sed
else
OUT_TARGET_HOST=darwin-x86
MD5=md5
+ XARGS="xargs -n 1 -P `sysctl hw.ncpu | awk '{print $2}'`"
+ SED=gsed
fi
if [ -z "$OUT" -o ! -d "$OUT" ]; then
@@ -76,7 +80,7 @@
cd $REPACK/ota/system/framework
$OPTICHARGER framework-res.apk
cd $REPACK/ota/system/app
-find ./ -name \*.apk | xargs --max-args=1 --max-procs=`grep 'processor' /proc/cpuinfo | wc -l` $OPTICHARGER
+find ./ -name \*.apk | $XARGS $OPTICHARGER
)
@@ -105,12 +109,12 @@
chmod 444 $REPACK/ota/system/xbin/xbin.sqf
# Remove xbin stuff and fix up updater-script
- sed -i -e's,system/xbin/su,system/bin/su,g' -e'/xbin/d' $updater
+ $SED -i -e's,system/xbin/su,system/bin/su,g' -e'/xbin/d' $updater
fi
# Fix build.prop
-sed -i \
+$SED -i \
-e '/ro\.kernel\.android\.checkjni/d' \
-e '/ro\.build\.type/s/eng/user/' \
$REPACK/ota/system/build.prop