Permalink
Browse files

Merge "tools: Colorize squisher and opticharger" into jb

  • Loading branch information...
2 parents 21a448a + 8d67fec commit 3c91e28206d90862990e035af6106aa54d2fb9c7 @KhasMek KhasMek committed with Gerrit Code Review Oct 30, 2012
Showing with 43 additions and 27 deletions.
  1. +11 −0 tools/colors
  2. +17 −15 tools/opticharger
  3. +15 −12 tools/squisher
View
11 tools/colors
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+if [ ! "$BUILD_WITH_COLORS" = "0" ]; then
+ CL_RED="\033[31m"
+ CL_GRN="\033[32m"
+ CL_YLW="\033[33m"
+ CL_BLU="\033[34m"
+ CL_MAG="\033[35m"
+ CL_CYN="\033[36m"
+ CL_RST="\033[0m"
+fi
View
32 tools/opticharger
@@ -17,6 +17,8 @@ else
OUT_TARGET_HOST=darwin-x86
fi
+. $ANDROID_BUILD_TOP/vendor/aokp/tools/colors
+
set -e
QUIET=1
BASE=`pwd`
@@ -37,14 +39,14 @@ then
APKCERTS=$OUT/obj/PACKAGING/target_files_intermediates/$TARGET_PRODUCT-target_files-$TARGET_BUILD_VARIANT.$USER/META/apkcerts.txt
if [ ! -f "$APKCERTS" ];
then
- echo "Set APKCERTS to the path to your apkcerts.txt file"
+ echo $CL_RED"Set APKCERTS to the path to your apkcerts.txt file"$CL_RST
exit 1;
fi
fi
if [ ! -f "$APKCERTS" ];
then
- echo "Invalid path to apkcerts.txt, set APKCERTS to the correct path."
+ echo $CL_RED"Invalid path to apkcerts.txt, set APKCERTS to the correct path."$CL_RST
fi
if [ "$(which pngcrush)" != "" ];
@@ -69,59 +71,59 @@ then
pngout $1
}
else
- echo "Please install pngcrush, optipng, or pngout"
+ echo $CL_RED"Please install pngcrush, optipng, or pngout"$CL_RST
exit 1;
fi
if [ "`which aapt`" = "" ];
then
- echo "Please ensure aapt is in your \$PATH"
+ echo $CL_RED"Please ensure aapt is in your \$PATH"$CL_RST
exit 1;
fi
if [ "`which zipalign`" = "" ];
then
- echo "Please ensure zipalign is in your \$PATH"
+ echo $CL_RED"Please ensure zipalign is in your \$PATH"$CL_RST
exit 1;
fi
if [ -e "$1" ];
then
NAME=`basename $1`;
- echo "Optimizing $NAME...";
+ echo $CL_CYN"Optimizing"$CL_RST" $NAME...";
if [ "$2" != "" ];
then
CERT=build/target/product/security/$2.x509.pem
KEY=build/target/product/security/$2.pk8
if [ ! -f "$ANDROID_BUILD_TOP/$CERT" ];
then
- echo "$CERT does not exist!";
+ echo $CL_RED"$CERT does not exist!";$CL_RST
exit 1;
fi
else
APKINFO=`grep "name=\"$NAME\"" $APKCERTS`;
[ $QUIET ] || echo "APKINFO: $APKINFO";
if [ "$APKINFO" = "" ];
then
- echo "No apk info for $NAME";
+ echo $CL_RED"No apk info for $NAME";$CL_RST
exit 1;
fi
CERT=`echo $APKINFO | awk {'print $2'} | cut -f 2 -d "=" | tr -d "\""`;
KEY=`echo $APKINFO | awk {'print $3'} | cut -f 2 -d "=" | tr -d "\""`;
if [ "$CERT" = "" ];
then
- echo "Unable to find certificate for $NAME"
+ echo $CL_RED"Unable to find certificate for $NAME"$CL_RST
exit 1;
fi
if [ "$CERT" = "PRESIGNED" ];
then
- echo "$NAME is presigned, skipping"
+ echo $CL_GRN"$NAME is presigned, skipping"$CL_RST
exit 1;
fi
fi
- [ $QUIET ] || echo "Certificate: $CERT";
+ [ $QUIET ] || echo $CL_YLW"Certificate:"$CL_RST" $CERT";
[ -d $TMPDIR/$NAME ] && rm -rf $TMPDIR/$NAME
mkdir -p $TMPDIR/$NAME
@@ -130,19 +132,19 @@ then
unzip -q $BASE/$1
for x in `find . -name "*.png" | grep -v "\.9.png$" | tr "\n" " "`
do
- [ $QUIET ] || echo "Crushing $x"
+ [ $QUIET ] || echo $CL_GRN"Crushing $x"$CL_RST
optimize_png $x
done
cp $BASE/$1 $BASE/$1.old
- [ $QUIET ] || echo "Repacking apk.."
+ [ $QUIET ] || echo $CL_GRN"Repacking apk.."$CL_RST
aapt p -0 .dat -0 .dict -0 .arsc -F $NAME .
- [ $QUIET ] || echo "Resigning with cert: `echo $CERT`"
+ [ $QUIET ] || echo $CL_YLW"Resigning with cert: `echo $CERT`"$CL_RST
[ $QUIET ] || echo java -jar $ANDROID_BUILD_TOP/out/host/$OUT_TARGET_HOST/framework/signapk.jar $ANDROID_BUILD_TOP/$CERT $ANDROID_BUILD_TOP/$KEY $NAME signed_$NAME
java -jar $ANDROID_BUILD_TOP/out/host/$OUT_TARGET_HOST/framework/signapk.jar $ANDROID_BUILD_TOP/$CERT $ANDROID_BUILD_TOP/$KEY $NAME signed_$NAME
- [ $QUIET ] || echo "Zipalign.."
+ [ $QUIET ] || echo $CL_GRN"Zipalign.."$CL_RST
zipalign -f 4 signed_$NAME $BASE/$1
if [ ! $QUIET ]; then
ls -l $BASE/$1.old
View
27 tools/squisher
@@ -1,8 +1,11 @@
#!/bin/sh
#
# Squish a CM otapackage for distribution
-# cyanogen
#
+# cyanogen
+# AOKP
+
+. $ANDROID_BUILD_TOP/vendor/aokp/tools/colors
OUT_TARGET_HOST=`uname -a | grep Darwin`
if [ -z "$OUT_TARGET_HOST" ]
@@ -52,25 +55,25 @@ if [ "$WANT_SQUASHFS" -eq 1 ]; then
if type mksquashfs >/dev/null 2>&1; then
if mksquashfs -version | grep -q "version $MKSQUASHFS_VER_REQ"; then :; else
echo
- echo "ERROR: mksquashfs must be at least version $MKSQUASHFS_VER_REQ for this build."
+ echo $CL_RED"ERROR: mksquashfs must be at least version $MKSQUASHFS_VER_REQ for this build."$CL_RST
fatal=1
fi
else
echo
- echo "ERROR: $TARGET_PRODUCT requires mksquashfs."
+ echo $CL_RED"ERROR: $TARGET_PRODUCT requires mksquashfs."$CL_RST
fatal=1
fi
if [ "$fatal" -ne 0 ]; then
echo
- echo " Unoptimized package is still available at"
- echo " $OTAPACKAGE"
+ echo $CL_YLW" Unoptimized package is still available at"
+ echo " $OTAPACKAGE"$CL_RST
exit $fatal
fi
fi
REPACK=$OUT/repack.d
-printf "Sanitizing environment..."
+echo $CL_CYN"Sanitizing environment..."$CL_RST
rm -rf $REPACK
mkdir -p $REPACK
echo
@@ -80,7 +83,7 @@ echo
mkdir $REPACK/ota
(
cd $REPACK/ota
-printf "Unpacking $OTAPACKAGE..."
+echo $CL_CYN"Unpacking $OTAPACKAGE..."$CL_RST
unzip $QUIET $OTAPACKAGE
echo
@@ -116,7 +119,7 @@ if [ "$WANT_SQUASHFS" -eq 1 ]; then
chmod -R 555 $REPACK/_xbin/*
# Create symlinks for su and busybox (since updater-script can't work on the squashfs filesystem).
- # Forgive me for the regex hell here.
+ # Forgive me for the regex hell here.
ln -s ../bin/su $REPACK/_xbin/su
for link in `sed -n -e's/,//g' -e'/symlink(.*busybox/,/xbin.*);/p' $updater | tr '"' '\n' | sed -n -e'\,/system/xbin/,s,/system/xbin/,,p'`
do
@@ -162,17 +165,17 @@ MODVERSION="$VERSION"
OUTFILE=$OUT/$MODVERSION.zip
# Pack it up and sign
-printf "Zipping package..."
+echo $CL_CYN"Zipping package..."$CL_RST
( cd $REPACK/ota; zip $QUIET -r $REPACK/update.zip . )
echo
-printf "Signing package..."
+echo $CL_CYN"Signing package..."$CL_RST
SECURITYDIR=$ANDROID_BUILD_TOP/build/target/product/security
java -Xmx1024m \
-jar $ANDROID_BUILD_TOP/out/host/$OUT_TARGET_HOST/framework/signapk.jar \
-w $SECURITYDIR/testkey.x509.pem $SECURITYDIR/testkey.pk8 \
$REPACK/update.zip $OUTFILE
echo
-printf "Cleaning up..."
+echo $CL_CYN"Cleaning up..."$CL_RST
rm -rf $REPACK
echo
@@ -182,7 +185,7 @@ img=`basename $OUTFILE`
cd `dirname $OUTFILE`
$MD5 $img >$img.md5sum
echo
-echo "Package complete: $OUTFILE"
+echo $CL_CYN"Package complete:"$CL_MAG" $OUTFILE"$CL_RST
cat $img.md5sum
echo
)

0 comments on commit 3c91e28

Please sign in to comment.