From d1f35c217fcb3e0da2191770c72898fe7a395a2a Mon Sep 17 00:00:00 2001 From: Griffin Millender Date: Fri, 13 Nov 2015 00:00:17 -0600 Subject: [PATCH] vendor/slim: cleanup for marshmallow Change-Id: I639b2745933119786940d18e860760bafee1cc54 --- config/common.mk | 9 +- prebuilt/common/bin/99-backup.sh | 63 -------- prebuilt/common/etc/backup.conf | 1 - prebuilt/common/etc/init.d/00banner | 2 +- tools/opticharger | 149 ------------------- tools/squisher | 217 ---------------------------- 6 files changed, 2 insertions(+), 439 deletions(-) delete mode 100755 prebuilt/common/bin/99-backup.sh delete mode 100755 prebuilt/common/etc/backup.conf delete mode 100755 tools/opticharger delete mode 100755 tools/squisher diff --git a/config/common.mk b/config/common.mk index 405df0d2a..a0c7346df 100644 --- a/config/common.mk +++ b/config/common.mk @@ -28,9 +28,7 @@ PRODUCT_PROPERTY_OVERRIDES += \ PRODUCT_COPY_FILES += \ vendor/slim/prebuilt/common/bin/backuptool.sh:install/bin/backuptool.sh \ vendor/slim/prebuilt/common/bin/backuptool.functions:install/bin/backuptool.functions \ - vendor/slim/prebuilt/common/bin/50-slim.sh:system/addon.d/50-slim.sh \ - vendor/slim/prebuilt/common/bin/99-backup.sh:system/addon.d/99-backup.sh \ - vendor/slim/prebuilt/common/etc/backup.conf:system/etc/backup.conf + vendor/slim/prebuilt/common/bin/50-slim.sh:system/addon.d/50-slim.sh # Signature compatibility validation PRODUCT_COPY_FILES += \ @@ -62,15 +60,11 @@ PRODUCT_COPY_FILES += \ vendor/slim/prebuilt/common/etc/init.d/90userinit:system/etc/init.d/90userinit \ vendor/slim/prebuilt/common/bin/sysinit:system/bin/sysinit -# Embed SuperUser -SUPERUSER_EMBEDDED := true - # Required packages PRODUCT_PACKAGES += \ CellBroadcastReceiver \ Development \ SpareParts \ - Superuser \ su # Optional packages @@ -90,7 +84,6 @@ PRODUCT_PACKAGES += \ # Extra Optional packages PRODUCT_PACKAGES += \ - SlimCenter \ SlimLauncher \ LatinIME \ BluetoothExt \ diff --git a/prebuilt/common/bin/99-backup.sh b/prebuilt/common/bin/99-backup.sh deleted file mode 100755 index 50ad9e3ee..000000000 --- a/prebuilt/common/bin/99-backup.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/sbin/sh - -propfile="/system/etc/backup.conf" -backupfile="/tmp/backup/backup.conf" -backuppath="/tmp/backup" -mkdir -p $backuppath -propbackuppath="$backuppath/prop" -mkdir -p $propbackuppath - -persist_lcd_density=1 - -load_prop() { - if [ -f "$1" ]; then - source "$1" - fi -} - -backup_prop() { - cp "/system/build.prop" "$propbackuppath/build.prop" -} - -restore_prop() { - if [ "$persist_lcd_density" = "1" ]; then - if [ -f "$propbackuppath/build.prop" ]; then - local USERLCD=`sed -n -e'/ro\.sf\.lcd_density/s/^.*=//p' $propbackuppath/build.prop` - busybox sed -i "s|ro.sf.lcd_density=.*|ro.sf.lcd_density=$USERLCD|" /system/build.prop - fi - fi -} - -backup_file() { - if [ -f "$propfile" ]; then - cp "$propfile" "$backupfile" - fi -} - -restore_file() { - if [ -f "$backupfile" ]; then - cp "$backupfile" "$propfile" - fi -} - -case "$1" in - backup) - backup_file - load_prop "$backupfile" - backup_prop - ;; - restore) - restore_file - load_prop "$backupfile" - restore_prop - ;; - pre-backup) - ;; - post-backup) - ;; - pre-restore) - ;; - post-restore) - ;; -esac -exit 0 diff --git a/prebuilt/common/etc/backup.conf b/prebuilt/common/etc/backup.conf deleted file mode 100755 index 3cb71901e..000000000 --- a/prebuilt/common/etc/backup.conf +++ /dev/null @@ -1 +0,0 @@ -persist_lcd_density=1 diff --git a/prebuilt/common/etc/init.d/00banner b/prebuilt/common/etc/init.d/00banner index c52d9ad39..a7b28fd7a 100644 --- a/prebuilt/common/etc/init.d/00banner +++ b/prebuilt/common/etc/init.d/00banner @@ -4,4 +4,4 @@ # L="log -p i -t slim" -$L "Welcome to Android `getprop ro.build.version.release` / SlimKat `getprop ro.slim.version`"; +$L "Welcome to Android `getprop ro.build.version.release` / SlimRoms `getprop ro.slim.version`"; diff --git a/tools/opticharger b/tools/opticharger deleted file mode 100755 index a3d7adeed..000000000 --- a/tools/opticharger +++ /dev/null @@ -1,149 +0,0 @@ -#!/bin/sh -# -# Super-mega opticharger of doom -# Shrinks apks by running pngcrush or optipng or pngout on png images -# -# Point APKCERTS at the full path to a generated apkcerts.txt file, such as: -# /home/shade/dev/sources/android-cm-eclair/out/target/product/dream_sapphire/obj/PACKAGING/target_files_intermediates/cyanogen_dream_sapphire-target_files-eng.shade/META/apkcerts.txt -# -# cyanogen - shade@chemlab.org -# ChrisSoyars - me@ctso.me - -set -e -QUIET=1 -BASE=`pwd` -BRUTECRUSH="-brute" -TMPDIR=/tmp/opticharge-$$ - -if [ -z "$BRUTE_PNGCRUSH" ] -then - BRUTECRUSH="" -fi - -if [ "$APKCERTS" = "" ]; -then - if [ "$TARGET_BUILD_VARIANT" = "userdebug" ]; then - TARGET_BUILD_VARIANT="eng" - elif [ "$TARGET_BUILD_VARIANT" = "user" ]; then - TARGET_BUILD_VARIANT="eng" - fi - - 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" - exit 1; - fi -fi - -if [ ! -f "$APKCERTS" ]; -then - echo "Invalid path to apkcerts.txt, set APKCERTS to the correct path." -fi - -if [ "$(which pngcrush)" != "" ]; -then - optimize_png () { - pngcrush -q ${BRUTECRUSH} $1 ${1}.out 1> /dev/null 2> /dev/null - mv ${1}.out ${1} - } -elif [ "$(which optipng)" != "" ]; -then - optimize_png () { - optipng -o7 -quiet $1 1> /dev/null 2> /dev/null - } -elif [ "$(which pngout-static)" != "" ]; -then - optimize_png () { - pngout-static $1 - } -elif [ "$(which pngout)" != "" ]; -then - optimize_png () { - pngout $1 - } -else - echo "Please install pngcrush, optipng, or pngout" - exit 1; -fi - -if [ "`which aapt`" = "" ]; -then - echo "Please ensure aapt is in your \$PATH" - exit 1; -fi - -if [ "`which zipalign`" = "" ]; -then - echo "Please ensure zipalign is in your \$PATH" - exit 1; -fi - -if [ -e "$1" ]; -then - NAME=`basename $1`; - echo "Optimizing $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!"; - exit 1; - fi - else - APKINFO=`grep "name=\"$NAME\"" $APKCERTS`; - [ $QUIET ] || echo "APKINFO: $APKINFO"; - if [ "$APKINFO" = "" ]; - then - echo "No apk info for $NAME"; - 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" - exit 1; - fi - if [ "$CERT" = "PRESIGNED" ]; - then - echo "$NAME is presigned, skipping" - exit 1; - fi - fi - - [ $QUIET ] || echo "Certificate: $CERT"; - - [ -d $TMPDIR/$NAME ] && rm -rf $TMPDIR/$NAME - mkdir -p $TMPDIR/$NAME - trap "rm -rf $TMPDIR; exit" INT TERM EXIT - cd $TMPDIR/$NAME - unzip -q $BASE/$1 - for x in `find . -name "*.png" | grep -v "\.9.png$" | tr "\n" " "` - do - [ $QUIET ] || echo "Crushing $x" - optimize_png $x - done - cp $BASE/$1 $BASE/$1.old - - [ $QUIET ] || echo "Repacking apk.." - aapt p -0 .dat -0 .dict -0 .arsc -F $NAME . - - [ $QUIET ] || echo "Resigning with cert: `echo $CERT`" - - [ $QUIET ] || echo java -jar $ANDROID_HOST_OUT/framework/signapk.jar $ANDROID_BUILD_TOP/$CERT $ANDROID_BUILD_TOP/$KEY $NAME signed_$NAME - java -jar $ANDROID_HOST_OUT/framework/signapk.jar $ANDROID_BUILD_TOP/$CERT $ANDROID_BUILD_TOP/$KEY $NAME signed_$NAME - [ $QUIET ] || echo "Zipalign.." - zipalign -f 4 signed_$NAME $BASE/$1 - if [ ! $QUIET ]; then - ls -l $BASE/$1.old - ls -l $BASE/$1 - fi - rm $BASE/$1.old -else - echo "Usage: $0 [apk file]" -fi - diff --git a/tools/squisher b/tools/squisher deleted file mode 100755 index c984b81fa..000000000 --- a/tools/squisher +++ /dev/null @@ -1,217 +0,0 @@ -#!/bin/sh -# -# Squish a CM otapackage for distribution -# cyanogen -# - -OUT_TARGET_HOST=`uname -a | grep Darwin` -if [ -z "$OUT_TARGET_HOST" ] -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 - echo "ERROR: $0 only works with a full build environment. $OUT should exist." - exit 1 -fi - -if [ "$TARGET_BUILD_TYPE" = "debug" ]; then - OTAPACKAGE=$OUT/${TARGET_PRODUCT}_debug-ota-$TARGET_BUILD_VARIANT.$USER.zip -elif [ "$TARGET_BUILD_VARIANT" = "userdebug" ]; then - OTAPACKAGE=$OUT/$TARGET_PRODUCT-ota-eng.$USER.zip -elif [ "$TARGET_BUILD_VARIANT" = "user" ]; then - OTAPACKAGE=$OUT/$TARGET_PRODUCT-ota-eng.$USER.zip -else - OTAPACKAGE=$OUT/$TARGET_PRODUCT-ota-$TARGET_BUILD_VARIANT.$USER.zip -fi -if [ ! -f "$OTAPACKAGE" ]; then - echo "$OTAPACKAGE doesn't exist!"; - exit 1 -fi - -OPTICHARGER=$ANDROID_BUILD_TOP/vendor/slim/tools/opticharger -QUIET=-q -DELETE_BINS="applypatch applypatch_static check_prereq recovery updater" -DELETE_MEDIA="*.qmg" -DELETE_APKS="LiveWallpapers.apk SpeechRecorder.apk VideoEditor.apk HoloSpiralWallpaper.apk MagicSmokeWallpapers.apk NoiseField.apk Galaxy4.apk OpenWnn.apk PinyinIME.apk" -DELETE_PRIV_APKS="VoiceDialer.apk" -DELETE_GALLERY="Gallery2.apk" -DELETE_FONTS="MTLmr3m.ttf" - -REPACK=$OUT/repack.d -printf "Sanitizing environment..." -rm -rf $REPACK -mkdir -p $REPACK -echo - - -# Unpack the otapackage and opticharge all apks -mkdir $REPACK/ota -( -cd $REPACK/ota -printf "Unpacking $OTAPACKAGE..." -unzip $QUIET $OTAPACKAGE -echo - -# Move all apks to the same directory so xargs can -# use also with framework-res.apk. This allow process -# framework-res.apk in parallel with other apks -mkdir -p $REPACK/parallel -cd $REPACK/parallel -cp $REPACK/ota/system/framework/framework-res.apk . -cp $REPACK/ota/system/app/*.apk . -for f in $REPACK/ota/system/priv-app/*.apk; do - cp $f ./priv-app-$(basename $f) -done - - -# Do optimization in parallel -find ./ -name \*.apk | $XARGS $OPTICHARGER - -# Move optimized apks to repack directory -mv -f $REPACK/parallel/framework-res.apk $REPACK/ota/system/framework/framework-res.apk -for f in $REPACK/parallel/priv-app*.apk; do - mv $f $REPACK/ota/system/priv-app/$(basename $f | cut -d'-' -f3) -done -mv -f $REPACK/parallel/*.apk $REPACK/ota/system/app/ - -# Return to directory -cd $REPACK/ota -rm -rf $REPACK/parallel -) - -# Fix build.prop -$SED -i \ - -e '/ro\.kernel\.android\.checkjni/d' \ - -e '/ro\.build\.type/s/eng/user/' \ - $REPACK/ota/system/build.prop - - -# Delete unnecessary binaries -( cd $REPACK/ota/system/bin; echo $DELETE_BINS | xargs rm -f; ) - -# Delete Offline charging mode files -( cd $REPACK/ota/system/media; echo $DELETE_MEDIA | xargs rm -f; ) - -# Delete Home Apk's -( cd $REPACK/ota/system/app; echo $DELETE_APKS | xargs rm -f; ) - -# Delete priv-app Apk's -( cd $REPACK/ota/system/priv-app; echo $DELETE_PRIV_APKS | xargs rm -f; ) - -# No need for modem.bin -rm -f $REPACK/ota/modem.bin - -# No need for media/video -rm -rf $REPACK/ota/system/media/video - -# Delete Unnecessary Fonts -( cd $REPACK/ota/system/fonts; echo $DELETE_FONTS | xargs rm -f; ) - -# Delete compiled fonts -#rm -rf $REPACK/ota/system/fonts - -#make dir for fonts again -#mkdir $REPACK/ota/system/fonts - -# Add precompiled fonts -#mv -f $REPACK/ota/system/sfont/*.ttf $REPACK/ota/system/fonts/ - -# No need for tts -rm -rf $REPACK/ota/system/tts - -# No need for srec -rm -rf $REPACK/ota/system/usr/srec - -# No need for recovery -rm -rf $REPACK/ota/recovery -rm -rf $REPACK/ota/system/etc/recovery-resource.dat - -# Strip modules -[ -d $REPACK/ota/system/lib/modules ] && \ - find $REPACK/ota/system/lib/modules -name "*.ko" -print0 | xargs -0 arm-eabi-strip --strip-unneeded - -# Fix LCD Density for slim -DEVICELCD=`sed -n -e'/ro\.sf\.lcd_density/s/^.*=//p' $OUT/system/build.prop` -if [ "$DEVICELCD" = "240" ]; then - sed -i 's/ro.sf.lcd_density=240/ro.sf.lcd_density=182/g' $OUT/system/build.prop -elif [ "$DEVICELCD" = "320" ]; then - sed -i 's/ro.sf.lcd_density=320/ro.sf.lcd_density=245/g' $OUT/system/build.prop -elif [ "$DEVICELCD" = "480" ]; then - sed -i 's/ro.sf.lcd_density=480/ro.sf.lcd_density=370/g' $OUT/system/build.prop -elif [ "$DEVICELCD" = "213" ]; then - sed -i 's/ro.sf.lcd_density=213/ro.sf.lcd_density=182/g' $OUT/system/build.prop -fi - -# Device specific LCD Density fix -DEVICEID=`sed -n -e'/ro\.product\.device/s/^.*=//p' $OUT/system/build.prop` -if [ "$DEVICEID" = "SGH-I717" ]; then - sed -i 's/ro.sf.lcd_density=245/ro.sf.lcd_density=268/g' $OUT/system/build.prop -elif [ "$DEVICEID" = "GT-N7000" ]; then - sed -i 's/ro.sf.lcd_density=245/ro.sf.lcd_density=268/g' $OUT/system/build.prop -elif [ "$DEVICEID" = "mako" ]; then - sed -i 's/ro.sf.lcd_density=245/ro.sf.lcd_density=268/g' $OUT/system/build.prop -elif [ "$DEVICEID" = "flo" ]; then - sed -i 's/ro.sf.lcd_density=245/ro.sf.lcd_density=286/g' $OUT/system/build.prop -elif [ "$DEVICEID" = "deb" ]; then - sed -i 's/ro.sf.lcd_density=245/ro.sf.lcd_density=286/g' $OUT/system/build.prop -elif [ "$DEVICEID" = "amami" ]; then - sed -i 's/ro.sf.lcd_density=245/ro.sf.lcd_density=286/g' $OUT/system/build.prop -elif [ "$DEVICEID" = "togari" ]; then - sed -i 's/ro.sf.lcd_density=245/ro.sf.lcd_density=300/g' $OUT/system/build.prop -fi -cp -f $OUT/system/build.prop $REPACK/ota/system/build.prop - -# Delete Gallery2 for 5MP cameras -CAMERARESOLUTION=`sed -n -e'/ro\.camera\.res/s/^.*=//p' $REPACK/ota/system/build.prop` -#if [ "$CAMERARESOLUTION" = "5MP" ];then -# rm -f $REPACK/ota/system/app/Gallery2.apk -#fi - -# Swap boot.img -PREBUILTKERNEL=$OUT/system/slimkernel/boot.img -if [ -e "$PREBUILTKERNEL" ];then - rm -f $REPACK/ota/boot.img - mv -f $REPACK/ota/system/slimkernel/boot.img $REPACK/ota/boot.img -fi - -# Determine what to name the new signed package -MODVERSION=`sed -n -e'/ro\.modversion/s/^.*=//p' $REPACK/ota/system/build.prop` -OUTFILE=$OUT/$MODVERSION.zip -echo MODVERSION: $MODVERSION - -# Pack it up and sign -printf "Zipping package..." -( cd $REPACK/ota; zip $QUIET -r $REPACK/update.zip . ) -echo -printf "Signing package..." -SECURITYDIR=$ANDROID_BUILD_TOP/build/target/product/security -java -Xmx1024m \ - -jar $OUT/../../../host/$OUT_TARGET_HOST/framework/signapk.jar \ - -w $SECURITYDIR/testkey.x509.pem $SECURITYDIR/testkey.pk8 \ - $REPACK/update.zip $OUTFILE -echo -printf "Cleaning up..." -rm -rf $REPACK -echo - -# Create a md5 checksum image of the repacked package -( -img=`basename $OUTFILE` -cd `dirname $OUTFILE` -$MD5 $img >$img.md5sum -echo -echo "Package complete: $OUTFILE" -cat $img.md5sum -echo -) - -exit 0