try to simplify logic for AB devices mixing separate product/system_ext and symlink flavour

This commit is contained in:
Guillaume Castagnino 2021-06-17 15:51:37 +02:00
parent 67b2f33579
commit 784b5644df
17 changed files with 130 additions and 148 deletions

View file

@ -59,6 +59,11 @@ find_block() {
fi
}
get_output_path() {
# In recovery we mounted all partitions in the right place, so we can rely on symlinks
echo "$1"
}
cd /tmp
unzip -o "$3"

View file

@ -8,23 +8,17 @@
# we partially use the script at install, if so, $SYSTEM, $PRODUCT, $SYSTEM_EXT are defined
if [ -z $SYSTEM ]; then
. /tmp/backuptool.functions
# build missing $PRODUCT and $SYSTEM_EXT from $S
if [ -z $backuptool_ab ]; then
SYS=$S
PRODUCT="$S/product"
SYSTEM_EXT="$S/system_ext"
TMP="/tmp"
else
SYS="/postinstall/$S"
PRODUCT="/postinstall/$PRODUCT"
SYSTEM_EXT="/postinstall/$SYSTEM_EXT"
TMP="/postinstall/tmp"
fi
# build missing $PRODUCT and $SYSTEM_EXT from $S. Keep them inside system, real path is computed after using the get_output_path function
# see https://github.com/LineageOS/android_vendor_lineage/commit/c63fa8441bb5ad1fc4fb68155a5e5166aa25cac0#diff-9cf467ef8562a8e65ef885b33fe3f29cee408bb251fb05aed28661f08bfe0c64
SYS=$S
PRODUCT="$S/product"
SYSTEM_EXT="$S/system_ext"
else
# install in recovery, script assume $S and $SYS defined
S=$SYSTEM
SYS=$SYSTEM
# PRODUCT AND SYSTEM_EXT defined from recovery
# get_output_path is no-op function defined from recovery
fi
# path is needed when running from recovery (at install)
@ -71,15 +65,16 @@ case "$1" in
;;
post-restore)
# update fonts.xml
cp -p "$SYS/etc/fonts.xml" "$SYS/etc/fonts.xml.bak"
cp -p $(get_output_path "$SYS/etc/fonts.xml") $(get_output_path "$SYS/etc/fonts.xml").bak
sed -i \
-e "s/Roboto-/NotoSans-/g" \
"$SYS/etc/fonts.xml"
$(get_output_path "$SYS/etc/fonts.xml")
# Fix ownership/permissions
for i in $(list_files); do
chown root:root "$SYS/$i"
chmod 644 "$SYS/$i"
chmod 755 "$(dirname "$SYS/$i")"
f=$(get_output_path "$SYS/$i")
chown root:root $f
chmod 644 $f
chmod 755 $(dirname $f)
done
;;
esac

View file

@ -8,23 +8,17 @@
# we partially use the script at install, if so, $SYSTEM, $PRODUCT, $SYSTEM_EXT are defined
if [ -z $SYSTEM ]; then
. /tmp/backuptool.functions
# build missing $PRODUCT and $SYSTEM_EXT from $S
if [ -z $backuptool_ab ]; then
SYS=$S
PRODUCT="$S/product"
SYSTEM_EXT="$S/system_ext"
TMP="/tmp"
else
SYS="/postinstall/$S"
PRODUCT="/postinstall/$PRODUCT"
SYSTEM_EXT="/postinstall/$SYSTEM_EXT"
TMP="/postinstall/tmp"
fi
# build missing $PRODUCT and $SYSTEM_EXT from $S. Keep them inside system, real path is computed after using the get_output_path function
# see https://github.com/LineageOS/android_vendor_lineage/commit/c63fa8441bb5ad1fc4fb68155a5e5166aa25cac0#diff-9cf467ef8562a8e65ef885b33fe3f29cee408bb251fb05aed28661f08bfe0c64
SYS=$S
PRODUCT="$S/product"
SYSTEM_EXT="$S/system_ext"
else
# install in recovery, script assume $S and $SYS defined
S=$SYSTEM
SYS=$SYSTEM
# PRODUCT AND SYSTEM_EXT defined from recovery
# get_output_path is no-op function defined from recovery
fi
# path is needed when running from recovery (at install)
@ -48,10 +42,10 @@ case "$1" in
;;
post-restore)
# remove google bloat from pico opengapps
rm -rf $SYS/app/GoogleContactsSyncAdapter
rm -rf $SYS/app/GoogleCalendarSyncAdapter
rm -rf $(get_output_path $SYS/app/GoogleContactsSyncAdapter)
rm -rf $(get_output_path $SYS/app/GoogleCalendarSyncAdapter)
# mindthegapps
rm -rf $PRODUCT/app/GoogleContactsSyncAdapter
rm -rf $PRODUCT/app/GoogleCalendarSyncAdapter
rm -rf $(get_output_path $PRODUCT/app/GoogleContactsSyncAdapter)
rm -rf $(get_output_path $PRODUCT/app/GoogleCalendarSyncAdapter)
;;
esac

View file

@ -8,23 +8,17 @@
# we partially use the script at install, if so, $SYSTEM, $PRODUCT, $SYSTEM_EXT are defined
if [ -z $SYSTEM ]; then
. /tmp/backuptool.functions
# build missing $PRODUCT and $SYSTEM_EXT from $S
if [ -z $backuptool_ab ]; then
SYS=$S
PRODUCT="$S/product"
SYSTEM_EXT="$S/system_ext"
TMP="/tmp"
else
SYS="/postinstall/$S"
PRODUCT="/postinstall/$PRODUCT"
SYSTEM_EXT="/postinstall/$SYSTEM_EXT"
TMP="/postinstall/tmp"
fi
# build missing $PRODUCT and $SYSTEM_EXT from $S. Keep them inside system, real path is computed after using the get_output_path function
# see https://github.com/LineageOS/android_vendor_lineage/commit/c63fa8441bb5ad1fc4fb68155a5e5166aa25cac0#diff-9cf467ef8562a8e65ef885b33fe3f29cee408bb251fb05aed28661f08bfe0c64
SYS=$S
PRODUCT="$S/product"
SYSTEM_EXT="$S/system_ext"
else
# install in recovery, script assume $S and $SYS defined
S=$SYSTEM
SYS=$SYSTEM
# PRODUCT AND SYSTEM_EXT defined from recovery
# get_output_path is no-op function defined from recovery
fi
# path is needed when running from recovery (at install)
@ -48,26 +42,26 @@ case "$1" in
;;
post-restore)
# remove google bloat from pico opengapps
rm -rf $SYS/priv-app/GoogleBackupTransport
rm -rf $SYS/priv-app/GoogleFeedback
rm -rf $SYS/priv-app/GooglePartnerSetup
rm -rf $SYS/priv-app/GooglePackageInstaller
#rm -rf $SYS/priv-app/SetupWizard
#rm -rf $SYS/app/GoogleTTS
rm -rf $SYS/app/SoundPickerPrebuilt
rm -f $SYS/etc/permissions/com.google.android.dialer.support.xml
rm -f $SYS/framework/com.google.android.dialer.support.jar
rm -rf $(get_output_path $SYS/priv-app/GoogleBackupTransport)
rm -rf $(get_output_path $SYS/priv-app/GoogleFeedback)
rm -rf $(get_output_path $SYS/priv-app/GooglePartnerSetup)
rm -rf $(get_output_path $SYS/priv-app/GooglePackageInstaller)
#rm -rf $(get_output_path $SYS/priv-app/SetupWizard)
#rm -rf $(get_output_path $SYS/app/GoogleTTS)
rm -rf $(get_output_path $SYS/app/SoundPickerPrebuilt)
rm -f $(get_output_path $SYS/etc/permissions/com.google.android.dialer.support.xml)
rm -f $(get_output_path $SYS/framework/com.google.android.dialer.support.jar)
# MindTheGapps
rm -rf $PRODUCT/app/PrebuiltExchange3Google
rm -rf $PRODUCT/app/MarkupGoogle
rm -rf $PRODUCT/app/talkback
rm -rf $PRODUCT/app/Tycho
rm -rf $PRODUCT/priv-app/AndroidMigratePrebuilt
rm -rf $PRODUCT/priv-app/SetupWizardPrebuilt
rm -rf $PRODUCT/priv-app/CarrierServices
rm -rf $PRODUCT/priv-app/DevicePersonalizationPrebuiltPixel4
rm -rf $PRODUCT/priv-app/SCONE
rm -rf $PRODUCT/priv-app/Velvet
rm -rf $SYSTEM_EXT/priv-app/GoogleFeedback
rm -rf $(get_output_path $PRODUCT/app/PrebuiltExchange3Google)
rm -rf $(get_output_path $PRODUCT/app/MarkupGoogle)
rm -rf $(get_output_path $PRODUCT/app/talkback)
rm -rf $(get_output_path $PRODUCT/app/Tycho)
rm -rf $(get_output_path $PRODUCT/priv-app/AndroidMigratePrebuilt)
rm -rf $(get_output_path $PRODUCT/priv-app/SetupWizardPrebuilt)
rm -rf $(get_output_path $PRODUCT/priv-app/CarrierServices)
rm -rf $(get_output_path $PRODUCT/priv-app/DevicePersonalizationPrebuiltPixel4)
rm -rf $(get_output_path $PRODUCT/priv-app/SCONE)
rm -rf $(get_output_path $PRODUCT/priv-app/Velvet)
rm -rf $(get_output_path $SYSTEM_EXT/priv-app/GoogleFeedback)
;;
esac

View file

@ -8,23 +8,17 @@
# we partially use the script at install, if so, $SYSTEM, $PRODUCT, $SYSTEM_EXT are defined
if [ -z $SYSTEM ]; then
. /tmp/backuptool.functions
# build missing $PRODUCT and $SYSTEM_EXT from $S
if [ -z $backuptool_ab ]; then
SYS=$S
PRODUCT="$S/product"
SYSTEM_EXT="$S/system_ext"
TMP="/tmp"
else
SYS="/postinstall/$S"
PRODUCT="/postinstall/$PRODUCT"
SYSTEM_EXT="/postinstall/$SYSTEM_EXT"
TMP="/postinstall/tmp"
fi
# build missing $PRODUCT and $SYSTEM_EXT from $S. Keep them inside system, real path is computed after using the get_output_path function
# see https://github.com/LineageOS/android_vendor_lineage/commit/c63fa8441bb5ad1fc4fb68155a5e5166aa25cac0#diff-9cf467ef8562a8e65ef885b33fe3f29cee408bb251fb05aed28661f08bfe0c64
SYS=$S
PRODUCT="$S/product"
SYSTEM_EXT="$S/system_ext"
else
# install in recovery, script assume $S and $SYS defined
S=$SYSTEM
SYS=$SYSTEM
# PRODUCT AND SYSTEM_EXT defined from recovery
# get_output_path is no-op function defined from recovery
fi
# path is needed when running from recovery (at install)
@ -60,88 +54,88 @@ case "$1" in
;;
post-restore)
# mute camera
chmod 000 $SYS/media/audio/ui/camera_*.ogg
chmod 000 $PRODUCT/media/audio/ui/camera_*.ogg
chmod 000 $PRODUCT/media/audio/ui/Video*.ogg
chmod 000 $(get_output_path $SYS/media/audio/ui/camera_*.ogg)
chmod 000 $(get_output_path $PRODUCT/media/audio/ui/camera_*.ogg)
chmod 000 $(get_output_path $PRODUCT/media/audio/ui/Video*.ogg)
# remove bloat
rm -rf $SYS/priv-app/AudioFX
rm -rf $SYS/priv-app/CMAccount
rm -rf $SYS/priv-app/CMBugReport
rm -rf $SYS/priv-app/CMUpdater
#rm -rf $SYS/priv-app/Updater
rm -rf $SYS/priv-app/LiveLockScreenService
rm -rf $SYS/priv-app/ThemeChooser
rm -rf $SYS/priv-app/ThemesProvider
rm -rf $SYS/priv-app/Trebuchet
rm -rf $SYS/priv-app/TrebuchetQuickStep
rm -rf $SYS/app/BasicDreams
rm -rf $SYS/app/CMWallpapers
rm -rf $SYS/app/Camera2
rm -rf $SYS/app/Email
rm -rf $SYS/app/Exchange2
rm -rf $SYS/app/Galaxy4
rm -rf $SYS/app/HoloSpiralWallpaper
rm -rf $SYS/app/HexoLibre
rm -rf $SYS/app/Jelly
rm -rf $SYS/app/LiveWallpapers
rm -rf $SYS/app/LiveWallpapersPicker
rm -rf $SYS/app/LockClock
rm -rf $SYS/app/NoiseField
rm -rf $SYS/app/PhaseBeam
rm -rf $SYS/app/PhotoPhase
rm -rf $SYS/app/PhotoTable
rm -rf $SYS/app/Profiles
rm -rf $SYS/app/Stk
rm -rf $SYS/app/Terminal
rm -rf $SYS/app/TimeService
rm -rf $SYS/app/VisualizationWallpapers
rm -rf $SYS/app/WAPPushManager
rm -rf $SYS/app/WhisperPush
rm -rf $(get_output_path $SYS/priv-app/AudioFX)
rm -rf $(get_output_path $SYS/priv-app/CMAccount)
rm -rf $(get_output_path $SYS/priv-app/CMBugReport)
rm -rf $(get_output_path $SYS/priv-app/CMUpdater)
rm -rf $(get_output_path $SYS/priv-app/LiveLockScreenService)
rm -rf $(get_output_path $SYS/priv-app/ThemeChooser)
rm -rf $(get_output_path $SYS/priv-app/ThemesProvider)
rm -rf $(get_output_path $SYS/priv-app/Trebuchet)
rm -rf $(get_output_path $SYS/priv-app/TrebuchetQuickStep)
rm -rf $(get_output_path $SYS/app/BasicDreams)
rm -rf $(get_output_path $SYS/app/CMWallpapers)
rm -rf $(get_output_path $SYS/app/Camera2)
rm -rf $(get_output_path $SYS/app/Email)
rm -rf $(get_output_path $SYS/app/Exchange2)
rm -rf $(get_output_path $SYS/app/Galaxy4)
rm -rf $(get_output_path $SYS/app/HoloSpiralWallpaper)
rm -rf $(get_output_path $SYS/app/HexoLibre)
rm -rf $(get_output_path $SYS/app/Jelly)
rm -rf $(get_output_path $SYS/app/LiveWallpapers)
rm -rf $(get_output_path $SYS/app/LiveWallpapersPicker)
rm -rf $(get_output_path $SYS/app/LockClock)
rm -rf $(get_output_path $SYS/app/NoiseField)
rm -rf $(get_output_path $SYS/app/PhaseBeam)
rm -rf $(get_output_path $SYS/app/PhotoPhase)
rm -rf $(get_output_path $SYS/app/PhotoTable)
rm -rf $(get_output_path $SYS/app/Profiles)
rm -rf $(get_output_path $SYS/app/Stk)
rm -rf $(get_output_path $SYS/app/Terminal)
rm -rf $(get_output_path $SYS/app/TimeService)
rm -rf $(get_output_path $SYS/app/VisualizationWallpapers)
rm -rf $(get_output_path $SYS/app/WAPPushManager)
rm -rf $(get_output_path $SYS/app/WhisperPush)
# lineageos 17
rm -rf $PRODUCT/priv-app/Eleven
rm -rf $PRODUCT/priv-app/Gallery2
rm -rf $PRODUCT/app/Email
rm -rf $PRODUCT/app/Exchange2
rm -rf $PRODUCT/app/Jelly
rm -rf $PRODUCT/app/PhotoTable
rm -rf $PRODUCT/app/Recorder
rm -rf $(get_output_path $PRODUCT/priv-app/Eleven)
rm -rf $(get_output_path $PRODUCT/priv-app/Gallery2)
rm -rf $(get_output_path $PRODUCT/app/Email)
rm -rf $(get_output_path $PRODUCT/app/Exchange2)
rm -rf $(get_output_path $PRODUCT/app/Jelly)
rm -rf $(get_output_path $PRODUCT/app/PhotoTable)
rm -rf $(get_output_path $PRODUCT/app/Recorder)
# lineageos 18
rm -rf $SYSTEM_EXT/priv-app/Gallery2
rm -rf $(get_output_path $SYSTEM_EXT/priv-app/Gallery2)
# omnirom
rm -rf $SYS/priv-app/Launcher3
rm -rf $SYS/priv-app/OmniBrain
rm -rf $SYS/priv-app/OmniStyle
rm -rf $SYS/priv-app/OmniSwitch
rm -rf $SYS/priv-app/MatLog
rm -rf $SYS/priv-app/OpenDelta
rm -rf $SYS/app/OmniTorch
rm -rf $SYS/app/OmniJaws
rm -rf $SYS/app/OmniClockOSS
rm -rf $SYS/app/OmniChange
rm -rf $SYS/app/Chromium
rm -rf $SYS/app/MusicFX
rm -rf $SYS/app/EggGame
rm -rf $SYS/app/EasterEgg
rm -rf $SYS/app/MonthCalendarWidget
rm -rf $(get_output_path $SYS/priv-app/Launcher3)
rm -rf $(get_output_path $SYS/priv-app/OmniBrain)
rm -rf $(get_output_path $SYS/priv-app/OmniStyle)
rm -rf $(get_output_path $SYS/priv-app/OmniSwitch)
rm -rf $(get_output_path $SYS/priv-app/MatLog)
rm -rf $(get_output_path $SYS/priv-app/OpenDelta)
rm -rf $(get_output_path $SYS/app/OmniTorch)
rm -rf $(get_output_path $SYS/app/OmniJaws)
rm -rf $(get_output_path $SYS/app/OmniClockOSS)
rm -rf $(get_output_path $SYS/app/OmniChange)
rm -rf $(get_output_path $SYS/app/Chromium)
rm -rf $(get_output_path $SYS/app/MusicFX)
rm -rf $(get_output_path $SYS/app/EggGame)
rm -rf $(get_output_path $SYS/app/EasterEgg)
rm -rf $(get_output_path $SYS/app/MonthCalendarWidget)
# omnirom sustratum stuff
rm -rf $SYS/overlay
rm -rf $(get_output_path $SYS/overlay)
# arrow
rm -rf $SYS/priv-app/AsusCamera
rm -rf $SYS/priv-app/Camera2
rm -rf $SYS/app/Browser
rm -rf $SYS/app/Simple-Gallery
rm -rf $SYS/app/SoundPickerPrebuilt
rm -rf $SYS/vendor/app/DTVPlayer
rm -rf $SYS/vendor/app/DTVService
rm -rf $(get_output_path $SYS/priv-app/AsusCamera)
rm -rf $(get_output_path $SYS/priv-app/Camera2)
rm -rf $(get_output_path $SYS/app/Browser)
rm -rf $(get_output_path $SYS/app/Simple-Gallery)
rm -rf $(get_output_path $SYS/app/SoundPickerPrebuilt)
rm -rf $(get_output_path $SYS/vendor/app/DTVPlayer)
rm -rf $(get_output_path $SYS/vendor/app/DTVService)
# qualcomm service tha constantly monitor 3/4G and wifi
# https://www.qualcomm.com/news/onq/2013/07/02/qualcomms-cne-bringing-smarts-3g4g-wi-fi-seamless-interworking
# smart is crap
rm -rf $SYS/priv-app/CNEService
rm -rf $(get_output_path $SYS/priv-app/CNEService)
# Fix ownership/permissions
for i in $(list_files); do
chown root:root "$SYS/$i"
chmod 644 "$SYS/$i"
chmod 755 "$(dirname "$SYS/$i")"
f=$(get_output_path "$SYS/$i")
chown root:root $f
chmod 644 $f
chmod 755 $(dirname $f)
done
;;
esac