split google clean
authorGuillaume Castagnino <casta@xwing.info>
Wed, 12 Jul 2017 08:09:35 +0000 (10:09 +0200)
committerGuillaume Castagnino <casta@xwing.info>
Wed, 12 Jul 2017 08:09:35 +0000 (10:09 +0200)
Makefile
dist-google-more/Makefile [new file with mode: 0644]
dist-google-more/cm-data/99-perso-google-clean-more.sh.addon [new file with mode: 0755]
dist-google-more/cm.sh [new file with mode: 0755]
dist-google/cm-data/99-perso-google-clean.sh.addon

index 019837dba0b4e921d9395f83db7d1de4bfbc542e..a222f40f4a74d19ff7513a0ff7f349c48396c533 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,11 +2,14 @@ ZIPFILE = cm-custom.zip
 ZIPFILE_SIGNED = cm-custom-signed.zip
 ZIPFILE_GOOGLE = cm-custom-google.zip
 ZIPFILE_GOOGLE_SIGNED = cm-custom-google-signed.zip
+ZIPFILE_GOOGLE_MORE = cm-custom-google-more.zip
+ZIPFILE_GOOGLE_MORE_SIGNED = cm-custom-google-more-signed.zip
 PRIVKEY = tools/testkey.pk8
 PUBKEY = tools/testkey.x509.pem
 
 STD = dist-std
 GOOGLE = dist-google
+GOOGLE_MORE = dist-google-more
 FILES_COMMON = $(shell find META-INF -type f)
 
 .PHONY: clean
@@ -16,12 +19,15 @@ all: zip
 zip: $(ZIPFILE) $(ZIPFILE_GOOGLE) sign
 
 clean:
-       rm -f "$(ZIPFILE)" "$(ZIPFILE_SIGNED)" "$(ZIPFILE_GOOGLE)" "$(ZIPFILE_GOOGLE_SIGNED)"
+       rm -f "$(ZIPFILE)" "$(ZIPFILE_SIGNED)" \
+               "$(ZIPFILE_GOOGLE)" "$(ZIPFILE_GOOGLE_SIGNED)" \
+               "$(ZIPFILE_GOOGLE_MORE)" "$(ZIPFILE_GOOGLE_MORE_SIGNED)"
 
-sign: $(ZIPFILE) $(ZIPFILE_GOOGLE)
+sign: $(ZIPFILE) $(ZIPFILE_GOOGLE) $(ZIPFILE_GOOGLE_MORE)
        java -jar tools/SignApk.jar -w -a 4 $(PUBKEY) $(PRIVKEY) $(ZIPFILE) $(ZIPFILE_SIGNED)
        java -jar tools/SignApk.jar -w -a 4 $(PUBKEY) $(PRIVKEY) $(ZIPFILE_GOOGLE) $(ZIPFILE_GOOGLE_SIGNED)
-       @echo "$(ZIPFILE_SIGNED) and $(ZIPFILE_GOOGLE_SIGNED) are ready"
+       java -jar tools/SignApk.jar -w -a 4 $(PUBKEY) $(PRIVKEY) $(ZIPFILE_GOOGLE_MORE) $(ZIPFILE_GOOGLE_MORE_SIGNED)
+       @echo "$? are ready"
 
 $(ZIPFILE): clean $(STD)
        @echo "$(ZIPFILE) is ready"
@@ -29,13 +35,20 @@ $(ZIPFILE): clean $(STD)
 $(ZIPFILE_GOOGLE): clean $(GOOGLE)
        @echo "$(ZIPFILE_GOOGLE) is ready"
 
+$(ZIPFILE_GOOGLE_MORE): clean $(GOOGLE_MORE)
+       @echo "$(ZIPFILE_GOOGLE_MORE) is ready"
+
 $(FILES_COMMON:%=%.zipped): %.zipped : %
        @echo "Zipping common files"
        @zip "$(ZIPFILE)" "$<"
        @zip "$(ZIPFILE_GOOGLE)" "$<"
+       @zip "$(ZIPFILE_GOOGLE_MORE)" "$<"
 
 $(STD): $(FILES_COMMON:%=%.zipped)
-       make -C $(STD) ZIPFILE=$(ZIPFILE)
+       make -C $@ ZIPFILE=$(ZIPFILE)
 
 $(GOOGLE): $(FILES_COMMON:%=%.zipped)
-       make -C $(GOOGLE) ZIPFILE=$(ZIPFILE_GOOGLE)
+       make -C $@ ZIPFILE=$(ZIPFILE_GOOGLE)
+
+$(GOOGLE_MORE): $(FILES_COMMON:%=%.zipped)
+       make -C $@ ZIPFILE=$(ZIPFILE_GOOGLE_MORE)
diff --git a/dist-google-more/Makefile b/dist-google-more/Makefile
new file mode 100644 (file)
index 0000000..3a3bd3a
--- /dev/null
@@ -0,0 +1,7 @@
+FILES = $(shell find -type f ! -name Makefile)
+
+all: $(FILES:%=%.zipped)
+
+$(FILES:%=%.zipped): %.zipped : %
+       @echo "Zipping standard files"
+       @zip "../$(ZIPFILE)" "$<"
diff --git a/dist-google-more/cm-data/99-perso-google-clean-more.sh.addon b/dist-google-more/cm-data/99-perso-google-clean-more.sh.addon
new file mode 100755 (executable)
index 0000000..0f4d1fd
--- /dev/null
@@ -0,0 +1,39 @@
+#!/sbin/sh
+#
+# $S/addon.d/99-perso-google-clean-more.sh
+#
+
+# we partially use the script at install, we need to have some fallback
+# if backuptool functions are not present
+if [ -e /tmp/backuptool.functions ]
+then
+  . /tmp/backuptool.functions
+else
+  S=/system
+fi
+
+# path is needed when running from recovery (at install)
+export PATH="${PATH}:$S/bin:$S/xbin"
+
+case "$1" in
+  backup)
+    # Stub
+  ;;
+  restore)
+    # Stub
+  ;;
+  pre-backup)
+    # Stub
+  ;;
+  post-backup)
+    # Stub
+  ;;
+  pre-restore)
+    # Stub
+  ;;
+  post-restore)
+    # remove google bloat from pico opengapps
+    rm -rf $S/app/GoogleContactsSyncAdapter
+    rm -rf $S/app/GoogleCalendarSyncAdapter
+  ;;
+esac
diff --git a/dist-google-more/cm.sh b/dist-google-more/cm.sh
new file mode 100755 (executable)
index 0000000..59af33e
--- /dev/null
@@ -0,0 +1,20 @@
+#!/sbin/sh
+
+set -e
+
+cd "$(dirname $0)"
+
+export PATH="${PATH}:/system/bin:/system/xbin"
+
+# install restore script
+echo "Installing restore script"
+cp cm-data/99-perso-google-clean-more.sh.addon /system/addon.d/99-perso-google-clean-more.sh
+chown root:root /system/addon.d/99-perso-google-clean-more.sh
+chmod 755 /system/addon.d/99-perso-google-clean-more.sh
+
+# call restore script post to remove bloat
+/system/addon.d/99-perso-google-clean-more.sh post-restore
+
+echo "Done"
+echo "Do not forget to WIPE Cache/Dalvik"
+
index 7b2043ca093aa0a84d2df51b1e5182ef0e8f6c81..1536e16437c4fed7b710286f156591713d9b5401 100755 (executable)
@@ -37,8 +37,6 @@ case "$1" in
     rm -rf $S/priv-app/GoogleFeedback
     rm -rf $S/priv-app/GooglePartnerSetup
     rm -rf $S/priv-app/GooglePackageInstaller
-    rm -rf $S/app/GoogleContactsSyncAdapter
-    rm -rf $S/app/GoogleCalendarSyncAdapter
     rm -rf $S/app/GoogleTTS
     rm -f $S/etc/permissions/com.google.android.dialer.support.xml
     rm -f $S/framework/com.google.android.dialer.support.jar