Skip to content

Commit

Permalink
Merge pull request #139 from chenxiaolong/rm
Browse files Browse the repository at this point in the history
update-binary: Explicitly remount as writable; Ignore cleanup failures due to ENOENT
  • Loading branch information
chenxiaolong authored Oct 3, 2022
2 parents 75d2912 + 0f332cc commit ff971bb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/magisk/update-binary
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ if [ -f /sbin/recovery ] || [ -f /system/bin/recovery ]; then

ui_print 'Mounting system'
if mount /system_root; then
mount -o remount,rw /system_root
root_dir=/system_root
else
mount /system
mount -o remount,rw /system
root_dir=/
fi

Expand All @@ -26,7 +28,9 @@ if [ -f /sbin/recovery ] || [ -f /system/bin/recovery ]; then
# Just overwriting isn't sufficient because the apk filenames are different
# between debug and release builds
app_id=$(unzip -p "${ZIPFILE}" module.prop | grep '^id=' | cut -d= -f2)
rm -rf "${root_dir}/system/priv-app/${app_id}"

# rm on some custom recoveries doesn't exit with 0 on ENOENT, even with -f
rm -rf "${root_dir}/system/priv-app/${app_id}" || :

unzip -o "${ZIPFILE}" 'system/*' -d "${root_dir}"

Expand Down

0 comments on commit ff971bb

Please sign in to comment.