mirror of
https://gitlab.com/Nanolx/NanoDroid
synced 2024-10-31 09:20:23 +00:00
all modules: improve bootmode (Magisk Manager) flashing support
This commit is contained in:
parent
8adc71b1b5
commit
4d3d14337e
@ -24,7 +24,7 @@ show_banner
|
||||
set_progress 0.1
|
||||
|
||||
unpack_zip
|
||||
mount_partitions
|
||||
${BOOTMODE} || mount_partitions
|
||||
|
||||
detect_arch
|
||||
setup_busybox
|
||||
|
@ -94,11 +94,11 @@ ui_print() {
|
||||
}
|
||||
|
||||
show_progress() {
|
||||
echo "progress ${1} ${2}" >> /proc/self/fd/${OUTFD}
|
||||
${BOOTMODE} || echo "progress ${1} ${2}" >> /proc/self/fd/${OUTFD}
|
||||
}
|
||||
|
||||
set_progress() {
|
||||
echo "set_progress ${1}" >> /proc/self/fd/${OUTFD}
|
||||
${BOOTMODE} || echo "set_progress ${1}" >> /proc/self/fd/${OUTFD}
|
||||
}
|
||||
|
||||
grep_prop() {
|
||||
@ -359,6 +359,27 @@ mount_partitions () {
|
||||
[ -d /system/apex ] && mount_apex
|
||||
}
|
||||
|
||||
umount_partitions () {
|
||||
umount -l /system_root 2>/dev/null
|
||||
umount -l /system 2>/dev/null
|
||||
umount -l /system/vendor 2>/dev/null
|
||||
umount -l /vendor 2>/dev/null
|
||||
umount -l /dev/random 2>/dev/null
|
||||
|
||||
mount | awk '/ \/apex/{print $3}' | while read apex_mount; do
|
||||
umount -l "${apex_mount}" 2>/dev/null
|
||||
done
|
||||
|
||||
mount | awk '/ \/apex/{print $1}' | while read apex_loop; do
|
||||
losetup -d "${apex_loop}" 2>/dev/null
|
||||
done
|
||||
|
||||
rm -rf /apex
|
||||
|
||||
unset ANDROID_RUNTIME_ROOT
|
||||
unset ANDROID_TZDATA_ROOT
|
||||
}
|
||||
|
||||
detect_mode () {
|
||||
case "${nanodroid_forcesystem}" in
|
||||
1 )
|
||||
@ -513,27 +534,7 @@ nanodroid_finalize () {
|
||||
ui_print " Thanks for using NanoDroid "
|
||||
ui_print " "
|
||||
|
||||
if ! ${BOOTMODE}; then
|
||||
umount -l /system_root 2>/dev/null
|
||||
umount -l /system 2>/dev/null
|
||||
umount -l /system/vendor 2>/dev/null
|
||||
umount -l /vendor 2>/dev/null
|
||||
umount -l /dev/random 2>/dev/null
|
||||
|
||||
mount | awk '/ \/apex/{print $3}' | while read apex_mount; do
|
||||
umount -l "${apex_mount}" 2>/dev/null
|
||||
done
|
||||
|
||||
mount | awk '/ \/apex/{print $1}' | while read apex_loop; do
|
||||
losetup -d "${apex_loop}" 2>/dev/null
|
||||
done
|
||||
|
||||
rm -rf ${APEX_TMP}/apex
|
||||
rm -rf /apex
|
||||
|
||||
unset ANDROID_RUNTIME_ROOT
|
||||
unset ANDROID_TZDATA_ROOT
|
||||
fi
|
||||
${BOOTMODE} || umount_partitions
|
||||
|
||||
rm -rf ${INSTALLER}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ show_banner
|
||||
set_progress 0.1
|
||||
|
||||
unpack_zip
|
||||
mount_partitions
|
||||
${BOOTMODE} || mount_partitions
|
||||
|
||||
detect_arch
|
||||
setup_busybox
|
||||
|
@ -25,7 +25,7 @@ show_banner
|
||||
set_progress 0.1
|
||||
|
||||
unpack_zip
|
||||
mount_partitions
|
||||
${BOOTMODE} || mount_partitions
|
||||
|
||||
detect_arch
|
||||
setup_busybox
|
||||
|
@ -25,7 +25,7 @@ show_banner
|
||||
set_progress 0.1
|
||||
|
||||
unpack_zip
|
||||
mount_partitions
|
||||
${BOOTMODE} || mount_partitions
|
||||
|
||||
detect_arch
|
||||
setup_busybox
|
||||
|
@ -24,7 +24,7 @@ show_banner
|
||||
set_progress 0.1
|
||||
|
||||
unpack_zip
|
||||
mount_partitions
|
||||
${BOOTMODE} || mount_partitions
|
||||
|
||||
detect_arch
|
||||
setup_busybox
|
||||
|
@ -24,7 +24,7 @@ show_banner
|
||||
set_progress 0.1
|
||||
|
||||
unpack_zip
|
||||
mount_partitions
|
||||
${BOOTMODE} || mount_partitions
|
||||
|
||||
detect_arch
|
||||
setup_busybox
|
||||
|
@ -191,7 +191,6 @@ umount_partitions () {
|
||||
unset ANDROID_TZDATA_ROOT
|
||||
unset BOOTCLASSPATH
|
||||
|
||||
rm -rf ${APEX_TMP}/apex
|
||||
rm -rf /apex
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ detect_outfd
|
||||
|
||||
show_banner
|
||||
|
||||
mount_partitions
|
||||
${BOOTMODE} || mount_partitions
|
||||
|
||||
if [ -f /data/adb/NanoDroid_Patched ]; then
|
||||
ui_print " !! /data/adb/NanoDroid_Patched exists"
|
||||
@ -45,7 +45,7 @@ patch_services
|
||||
install_services
|
||||
install_addond
|
||||
|
||||
! ${BOOTMODE} && umount_partitions
|
||||
${BOOTMODE} || umount_partitions
|
||||
|
||||
ui_print " "
|
||||
ui_print " > Done!"
|
||||
|
@ -19,33 +19,17 @@ detect_outfd
|
||||
show_banner
|
||||
|
||||
ui_print " || performing tests"
|
||||
|
||||
ui_print " "
|
||||
ui_print " || storing results in $(dirname ${LOGFILE}):"
|
||||
ui_print " || as $(basename ${LOGFILE})"
|
||||
ui_print " "
|
||||
|
||||
mount_partitions
|
||||
${BOOTMODE} || mount_partitions
|
||||
|
||||
system_test
|
||||
store_results
|
||||
|
||||
if ! ${BOOTMODE} ; then
|
||||
umount -l /system_root 2>/dev/null
|
||||
umount -l /system 2>/dev/null
|
||||
umount -l /vendor 2>/dev/null
|
||||
umount -l /dev/random 2>/dev/null
|
||||
|
||||
mount | awk '/ \/apex/{print $3}' | while read apex_mount; do
|
||||
umount -l "${apex_mount}" 2>/dev/null
|
||||
done
|
||||
|
||||
mount | awk '/ \/apex/{print $1}' | while read apex_loop; do
|
||||
losetup -d "${apex_loop}" 2>/dev/null
|
||||
done
|
||||
|
||||
rm -rf ${APEX_TMP}/apex
|
||||
rm -rf /apex
|
||||
fi
|
||||
${BOOTMODE} || umount_partitions
|
||||
|
||||
ui_print " > Done!"
|
||||
ui_print " "
|
||||
|
@ -166,6 +166,23 @@ mount_partitions () {
|
||||
[ -d /system/apex ] && mount_apex
|
||||
}
|
||||
|
||||
umount_partitions () {
|
||||
umount -l /system_root 2>/dev/null
|
||||
umount -l /system 2>/dev/null
|
||||
umount -l /vendor 2>/dev/null
|
||||
umount -l /dev/random 2>/dev/null
|
||||
|
||||
mount | awk '/ \/apex/{print $3}' | while read apex_mount; do
|
||||
umount -l "${apex_mount}" 2>/dev/null
|
||||
done
|
||||
|
||||
mount | awk '/ \/apex/{print $1}' | while read apex_loop; do
|
||||
losetup -d "${apex_loop}" 2>/dev/null
|
||||
done
|
||||
|
||||
rm -rf /apex
|
||||
}
|
||||
|
||||
error () {
|
||||
ui_print " "
|
||||
ui_print " !! ${@}"
|
||||
|
@ -6,11 +6,9 @@ BACKUP_DIR="/data/media/0/nanodroid_backups"
|
||||
VERSION=22.6.91.99999999
|
||||
|
||||
detect_bootmode () {
|
||||
[ -z ${BOOTMODE} ] && ps | grep zygote | grep -qv grep && BOOTMODE=true
|
||||
[ -z ${BOOTMODE} ] && ps -A 2>/dev/null | grep zygote | grep -qv grep && BOOTMODE=true
|
||||
[ -z ${BOOTMODE} ] && BOOTMODE=false
|
||||
${BOOTMODE} || ps | grep zygote | grep -qv grep && BOOTMODE=true
|
||||
${BOOTMODE} || ps -A 2>/dev/null | grep zygote | grep -qv grep && BOOTMODE=true
|
||||
|
||||
${BOOTMODE} && error "NanoDroid Uninstaller can't be run from Magisk Manager!"
|
||||
}
|
||||
|
||||
ui_print() {
|
||||
@ -239,7 +237,27 @@ mount_partitions () {
|
||||
|
||||
[ -z "${build_props}" ] && error "failed to mount /system (unsupported A/B device?)"
|
||||
|
||||
mount_apex
|
||||
[ -d /system/apex ] && mount_apex
|
||||
}
|
||||
|
||||
umount_partitions () {
|
||||
umount -l /system_root 2>/dev/null
|
||||
umount -l /system 2>/dev/null
|
||||
umount -l /vendor 2>/dev/null
|
||||
umount -l /dev/random 2>/dev/null
|
||||
|
||||
mount | awk '/ \/apex/{print $3}' | while read apex_mount; do
|
||||
umount -l "${apex_mount}" 2>/dev/null
|
||||
done
|
||||
|
||||
mount | awk '/ \/apex/{print $1}' | while read apex_loop; do
|
||||
losetup -d "${apex_loop}" 2>/dev/null
|
||||
done
|
||||
|
||||
unset ANDROID_RUNTIME_ROOT
|
||||
unset ANDROID_TZDATA_ROOT
|
||||
|
||||
rm -rf /apex
|
||||
}
|
||||
|
||||
# check for configuration files
|
||||
@ -381,7 +399,7 @@ ui_print "**********************"
|
||||
ui_print " "
|
||||
|
||||
detect_bootmode
|
||||
mount_partitions
|
||||
${BOOTMODE} || mount_partitions
|
||||
|
||||
ui_print " << Removing installation logs (if any)"
|
||||
|
||||
@ -409,24 +427,7 @@ rm -f /data/adb/.nanodroid_runtimeclean
|
||||
|
||||
ui_print " >> clean up"
|
||||
|
||||
umount -l /system_root 2>/dev/null
|
||||
umount -l /system 2>/dev/null
|
||||
umount -l /vendor 2>/dev/null
|
||||
umount -l /dev/random 2>/dev/null
|
||||
|
||||
mount | awk '/ \/apex/{print $3}' | while read apex_mount; do
|
||||
umount -l "${apex_mount}" 2>/dev/null
|
||||
done
|
||||
|
||||
mount | awk '/ \/apex/{print $1}' | while read apex_loop; do
|
||||
losetup -d "${apex_loop}" 2>/dev/null
|
||||
done
|
||||
|
||||
unset ANDROID_RUNTIME_ROOT
|
||||
unset ANDROID_TZDATA_ROOT
|
||||
|
||||
rm -rf ${APEX_TMP}/apex
|
||||
rm -rf /apex
|
||||
${BOOTMODE} || umount_partitions
|
||||
|
||||
ui_print " "
|
||||
ui_print " > Done!"
|
||||
|
Loading…
Reference in New Issue
Block a user