Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addon: handle mounting of {product,vendor} on A only devices #879

Merged
merged 1 commit into from
Sep 5, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 27 additions & 1 deletion scripts/bkup_tail.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
EOF
}

mount_generic() {
local active_slot=$(getprop ro.boot.slot_suffix)
local partitions="$*"
if [ -z "$active_slot" ]; then
# We're on an A only device
local partition
for partition in $partitions; do
if [ "$(getprop ro.boot.dynamic_partitions)" = "true" ]; then
mount -o ro -t auto /dev/block/mapper/"$partition" /"$partition" 2> /dev/null
blockdev --setrw /dev/block/mapper/"$partition" 2> /dev/null
mount -o rw,remount -t auto /dev/block/mapper/"$partition" /"$partition" 2> /dev/null
else
mount -o ro -t auto /"$partition" 2> /dev/null
mount -o rw,remount -t auto /"$partition" 2> /dev/null
fi
done
fi
}

# Backup/Restore using /sdcard if the installed GApps size plus a buffer for other addon.d backups (204800=200MB) is larger than /tmp
installed_gapps_size_kb=$(grep "^installed_gapps_size_kb" $TMP/gapps.prop | cut -d '=' -f 2)
if [ ! "$installed_gapps_size_kb" ]; then
Expand Down Expand Up @@ -31,6 +50,8 @@ case "$1" in
list_files | while read -r FILE DUMMY; do
backup_file "$S"/"$FILE"
done

umount /product /vendor 2> /dev/null
;;
restore)
list_files | while read -r FILE REPLACEMENT; do
Expand All @@ -40,12 +61,14 @@ case "$1" in
done
;;
pre-backup)
# Stub
mount_generic product vendor
;;
post-backup)
# Stub
;;
pre-restore)
mount_generic product vendor

# Remove Stock/AOSP apps (from GApps Installer)

# Remove 'other' apps (per installer.data)
Expand Down Expand Up @@ -81,6 +104,9 @@ case "$1" in
*/overlay/*) chcon -h u:object_r:vendor_overlay_file:s0 "$SYS/$i";;
esac
done

umount /product /vendor 2> /dev/null

if [ "$rom_build_sdk" -ge "26" ]; then # Android 8.0+ uses 0600 for its permission on build.prop
chmod 600 "$SYS/build.prop"
fi
Expand Down