fix A/B /system root
authorGuillaume Castagnino <casta@xwing.info>
Wed, 17 Apr 2019 14:28:39 +0000 (16:28 +0200)
committerGuillaume Castagnino <casta@xwing.info>
Wed, 17 Apr 2019 14:28:39 +0000 (16:28 +0200)
dist-google-more/cm.sh
dist-google/cm-data/99-perso-google-clean.sh.addon
dist-google/cm.sh
dist-std/cm-data/99-perso.sh.addon
dist-std/cm.sh

index 59af33e758812a6772e1980e671beab2ca4d3879..7d23c46dca18e04c8e495612ff88a20e5ff84119 100755 (executable)
@@ -2,18 +2,37 @@
 
 set -e
 
+# _____________________________________________________________________________________________________________________
+#                      Detect A/B partition layout https://source.android.com/devices/tech/ota/ab_updates
+#                      and system-as-root https://source.android.com/devices/bootloader/system-as-root
+if [ -n "$(cat /proc/cmdline | grep slot_suffix)" ];
+then
+  device_abpartition=true
+  SYSTEM=/system/system
+  VENDOR=/vendor/vendor
+elif [ -n "$(cat /proc/mounts | grep /system_root)" ];
+then
+  device_abpartition=true
+  SYSTEM=/system_root/system
+  VENDOR=/vendor
+else
+  device_abpartition=false
+  SYSTEM=/system
+  VENDOR=/vendor
+fi
+
 cd "$(dirname $0)"
 
-export PATH="${PATH}:/system/bin:/system/xbin"
+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
+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
+${SYSTEM}/addon.d/99-perso-google-clean-more.sh post-restore
 
 echo "Done"
 echo "Do not forget to WIPE Cache/Dalvik"
index 8de0a30e2a611bc2dedf04afc6877ff89c048a9a..e8da135e31423e354ab8df17b4e4b631a33e0de0 100755 (executable)
@@ -37,7 +37,9 @@ case "$1" in
     rm -rf $S/priv-app/GoogleFeedback
     rm -rf $S/priv-app/GooglePartnerSetup
     rm -rf $S/priv-app/GooglePackageInstaller
+    #rm -rf $S/priv-app/SetupWizard
     #rm -rf $S/app/GoogleTTS
+    rm -rf $S/app/SoundPickerPrebuilt
     rm -f $S/etc/permissions/com.google.android.dialer.support.xml
     rm -f $S/framework/com.google.android.dialer.support.jar
   ;;
index 78331aea4a4b92eaf30d710aca10718fd716f085..e9db2a8ff82b1286069825d7647ec618b586e34b 100755 (executable)
@@ -2,18 +2,37 @@
 
 set -e
 
+# _____________________________________________________________________________________________________________________
+#                      Detect A/B partition layout https://source.android.com/devices/tech/ota/ab_updates
+#                      and system-as-root https://source.android.com/devices/bootloader/system-as-root
+if [ -n "$(cat /proc/cmdline | grep slot_suffix)" ];
+then
+  device_abpartition=true
+  SYSTEM=/system/system
+  VENDOR=/vendor/vendor
+elif [ -n "$(cat /proc/mounts | grep /system_root)" ];
+then
+  device_abpartition=true
+  SYSTEM=/system_root/system
+  VENDOR=/vendor
+else
+  device_abpartition=false
+  SYSTEM=/system
+  VENDOR=/vendor
+fi
+
 cd "$(dirname $0)"
 
-export PATH="${PATH}:/system/bin:/system/xbin"
+export PATH="${PATH}:${SYSTEM}/bin:${SYSTEM}/xbin"
 
 # install restore script
 echo "Installing restore script"
-cp cm-data/99-perso-google-clean.sh.addon /system/addon.d/99-perso-google-clean.sh
-chown root:root /system/addon.d/99-perso-google-clean.sh
-chmod 755 /system/addon.d/99-perso-google-clean.sh
+cp cm-data/99-perso-google-clean.sh.addon ${SYSTEM}/addon.d/99-perso-google-clean.sh
+chown root:root ${SYSTEM}/addon.d/99-perso-google-clean.sh
+chmod 755 ${SYSTEM}/addon.d/99-perso-google-clean.sh
 
 # call restore script post to remove bloat
-/system/addon.d/99-perso-google-clean.sh post-restore
+${SYSTEM}/addon.d/99-perso-google-clean.sh post-restore
 
 echo "Done"
 echo "Do not forget to WIPE Cache/Dalvik"
index 812486d56b2c6f931139c7ee4cee956cff7dddf6..881e592a316bba9e4f4de8a19cd7abaa3a9652b8 100755 (executable)
@@ -99,6 +99,7 @@ case "$1" in
     # omnirom sustratum stuff
     rm -rf $S/overlay
     # arrow
+    rm -rf $S/priv-app/AsusCamera
     rm -rf $S/priv-app/Camera2
     rm -rf $S/priv-app/Launcher3QuickStep
     rm -rf $S/app/Browser
index c687a6836158b89ad2955869b505ba0b13437e46..e264b24dd2d7731d2debc5544bc5570162d132ad 100755 (executable)
@@ -2,9 +2,28 @@
 
 set -e
 
+# _____________________________________________________________________________________________________________________
+#                      Detect A/B partition layout https://source.android.com/devices/tech/ota/ab_updates
+#                      and system-as-root https://source.android.com/devices/bootloader/system-as-root
+if [ -n "$(cat /proc/cmdline | grep slot_suffix)" ];
+then
+  device_abpartition=true
+  SYSTEM=/system/system
+  VENDOR=/vendor/vendor
+elif [ -n "$(cat /proc/mounts | grep /system_root)" ];
+then
+  device_abpartition=true
+  SYSTEM=/system_root/system
+  VENDOR=/vendor
+else
+  device_abpartition=false
+  SYSTEM=/system
+  VENDOR=/vendor
+fi
+
 cd "$(dirname $0)"
 
-export PATH="${PATH}:/system/bin:/system/xbin"
+export PATH="${PATH}:${SYSTEM}/bin:${SYSTEM}/xbin"
 
 # install setup script
 echo "Installing setup script"
@@ -14,18 +33,18 @@ chmod 750 /sdcard/system-setup-runonce.sh
 
 # install iptables script
 echo "Installing iptables script"
-cp cm-data/oem-iptables-init.sh /system/bin/oem-iptables-init.sh
-chown root:root /system/bin/oem-iptables-init.sh
-chmod 750 /system/bin/oem-iptables-init.sh
+cp cm-data/oem-iptables-init.sh ${SYSTEM}/bin/oem-iptables-init.sh
+chown root:root ${SYSTEM}/bin/oem-iptables-init.sh
+chmod 750 ${SYSTEM}/bin/oem-iptables-init.sh
 
 # install restore script
 echo "Installing restore script"
-cp cm-data/99-perso.sh.addon /system/addon.d/99-perso.sh
-chown root:root /system/addon.d/99-perso.sh
-chmod 755 /system/addon.d/99-perso.sh
+cp cm-data/99-perso.sh.addon ${SYSTEM}/addon.d/99-perso.sh
+chown root:root ${SYSTEM}/addon.d/99-perso.sh
+chmod 755 ${SYSTEM}/addon.d/99-perso.sh
 
 # call restore script post to remove bloat
-/system/addon.d/99-perso.sh post-restore
+${SYSTEM}/addon.d/99-perso.sh post-restore
 
 echo "Done"
 echo "Do not forget to WIPE Cache/Dalvik"