2018-01-23 20:11:52 +00:00
|
|
|
#!/sbin/sh
|
|
|
|
|
|
|
|
OUTFD=$2
|
|
|
|
ZIP=$3
|
2019-06-09 20:12:18 +00:00
|
|
|
BACKUP_DIR="/data/media/0/nanodroid_backups"
|
2020-08-18 15:26:18 +00:00
|
|
|
VERSION=22.6.91.99999999
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2018-08-21 20:13:00 +00:00
|
|
|
detect_bootmode () {
|
2018-11-09 20:21:27 +00:00
|
|
|
[ -z ${BOOTMODE} ] && BOOTMODE=false
|
|
|
|
${BOOTMODE} || ps | grep zygote | grep -qv grep && BOOTMODE=true
|
2019-05-05 10:25:07 +00:00
|
|
|
${BOOTMODE} || ps -A 2>/dev/null | grep zygote | grep -qv grep && BOOTMODE=true
|
2018-11-10 21:03:23 +00:00
|
|
|
|
|
|
|
${BOOTMODE} && error "NanoDroid Uninstaller can't be run from Magisk Manager!"
|
2018-08-21 20:13:00 +00:00
|
|
|
}
|
|
|
|
|
2018-01-23 20:11:52 +00:00
|
|
|
ui_print() {
|
|
|
|
echo -n -e "ui_print $1\n" >> /proc/self/fd/$OUTFD
|
|
|
|
echo -n -e "ui_print\n" >> /proc/self/fd/$OUTFD
|
|
|
|
}
|
|
|
|
|
|
|
|
grep_prop() {
|
2018-08-05 11:18:32 +00:00
|
|
|
REGEX="${1}"
|
2018-01-23 20:11:52 +00:00
|
|
|
shift
|
2018-08-05 11:18:32 +00:00
|
|
|
FILES="${@}"
|
|
|
|
[ -z "${@}" ] && FILES='/system/build.prop'
|
|
|
|
sed -n "s/^${REGEX}=//p" ${FILES} | \
|
|
|
|
head -n 1
|
|
|
|
}
|
|
|
|
|
|
|
|
grep_cmdline() {
|
|
|
|
local REGEX="s/^${1}=//p"
|
|
|
|
sed -E 's/ +/\n/g' /proc/cmdline | \
|
|
|
|
sed -n "${REGEX}" 2>/dev/null
|
2018-01-23 20:11:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
is_mounted() {
|
|
|
|
if [ ! -z "$2" ]; then
|
|
|
|
cat /proc/mounts | grep $1 | grep $2, >/dev/null
|
|
|
|
else
|
|
|
|
cat /proc/mounts | grep $1 >/dev/null
|
|
|
|
fi
|
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
2019-01-17 18:35:48 +00:00
|
|
|
set_perm () {
|
|
|
|
chown ${2}:${3} ${1} || error "failed change owner for ${1}"
|
|
|
|
chmod ${4} ${1} || error "failed to change mode for ${1}"
|
|
|
|
|
|
|
|
if [ ! -z "${5}" ]; then
|
|
|
|
chcon ${5} ${1} 2>/dev/null
|
|
|
|
else chcon 'u:object_r:system_file:s0' ${1} 2>/dev/null
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
set_perm_recursive() {
|
|
|
|
find ${1} -type d 2>/dev/null | while read dir; do
|
|
|
|
set_perm ${dir} ${2} ${3} ${4} ${6}
|
|
|
|
done
|
|
|
|
find ${1} -type f 2>/dev/null | while read file; do
|
|
|
|
set_perm ${file} ${2} ${3} ${5} ${6}
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
set_perm_data () {
|
|
|
|
if [ "${1}" = "-r" ]; then
|
|
|
|
echo " perm: data [recursive] {${2}}"
|
|
|
|
set_perm_recursive ${2} 0 0 0755 0644
|
|
|
|
else
|
|
|
|
echo " perm: data [single] {${1}}"
|
|
|
|
set_perm ${1} 0 0 0644
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2018-08-26 16:59:34 +00:00
|
|
|
setup_busybox () {
|
|
|
|
mkdir /dev/tmp
|
|
|
|
|
|
|
|
ABI=$(grep_prop ro.product.cpu.abi | cut -c-3)
|
|
|
|
ABI2=$(grep_prop ro.product.cpu.abi2 | cut -c-3)
|
|
|
|
ABILONG=$(grep_prop ro.product.cpu.abi)
|
|
|
|
|
|
|
|
ARCH=arm
|
|
|
|
|
|
|
|
[ "$ABI" = "x86" ] && ARCH=x86
|
|
|
|
[ "$ABI2" = "x86" ] && ARCH=x86
|
|
|
|
[ "$ABILONG" = "arm64-v8a" ] && ARCH=arm64
|
|
|
|
[ "$ABILONG" = "x86_64" ] && ARCH=x86_64
|
|
|
|
|
|
|
|
case ${ARCH} in
|
|
|
|
arm | arm64 )
|
2019-04-25 18:49:26 +00:00
|
|
|
unzip -oq "${ZIP}" busybox.arm -d "/dev/tmp"
|
2018-08-26 16:59:34 +00:00
|
|
|
BUSY=/dev/tmp/busybox.arm
|
|
|
|
;;
|
|
|
|
|
|
|
|
x86 | x86_64 )
|
2019-04-25 18:49:26 +00:00
|
|
|
unzip -oq "${ZIP}" busybox.x86 -d "/dev/tmp"
|
2018-08-26 16:59:34 +00:00
|
|
|
BUSY=/dev/tmp/busybox.x86
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
OLD_PATH=${PATH}
|
|
|
|
|
|
|
|
chmod 0755 ${BUSY}
|
|
|
|
mkdir -p /dev/tmp/busybox
|
|
|
|
ln -s ${BUSY} /dev/tmp/busybox/busybox
|
|
|
|
${BUSY} --install -s /dev/tmp/busybox/
|
|
|
|
|
|
|
|
export PATH="/dev/tmp/busybox:${PATH}"
|
|
|
|
}
|
|
|
|
|
2018-01-23 20:11:52 +00:00
|
|
|
error () {
|
2018-09-08 17:34:25 +00:00
|
|
|
ui_print " !!"
|
|
|
|
ui_print " !! ${@}"
|
|
|
|
ui_print " !!"
|
2018-01-23 20:11:52 +00:00
|
|
|
exit 1
|
|
|
|
}
|
2020-08-11 19:25:48 +00:00
|
|
|
|
|
|
|
# taken from Magisk, with modifications for NanoDroid
|
|
|
|
mount_apex_loop () {
|
|
|
|
local number=0
|
|
|
|
local minorx=1
|
|
|
|
local loop
|
|
|
|
|
|
|
|
[ -e /dev/block/loop1 ] && minorx=$(stat -Lc '%T' /dev/block/loop1)
|
|
|
|
|
|
|
|
apex_mount="${1}"
|
|
|
|
|
2020-08-15 17:55:00 +00:00
|
|
|
echo " *** mount_apex_loop [apex_mount]: ${apex_mount}"
|
|
|
|
|
2020-08-11 19:25:48 +00:00
|
|
|
while [ ${number} -lt 64 ]; do
|
|
|
|
loop=/dev/block/loop${number}
|
|
|
|
[ -e ${loop} ] || mknod ${loop} b 7 $((number * minorx))
|
|
|
|
|
2020-08-15 17:55:00 +00:00
|
|
|
if losetup "${loop}" /apex/apex_payload.img 2>/dev/null; then
|
|
|
|
echo " *** mount_apex_loop [loop]: ${loop}"
|
2020-08-11 19:25:48 +00:00
|
|
|
if mount -text4 -oro,noatime "${loop}" "${apex_mount}"; then
|
|
|
|
rm -f /apex/apex_payload.img
|
|
|
|
break
|
|
|
|
fi
|
2019-10-12 18:00:52 +00:00
|
|
|
fi
|
2020-08-11 19:25:48 +00:00
|
|
|
|
|
|
|
number=$((number + 1))
|
2019-10-12 18:00:52 +00:00
|
|
|
done
|
2020-08-11 19:25:48 +00:00
|
|
|
}
|
2019-10-08 18:48:47 +00:00
|
|
|
|
2020-08-11 19:25:48 +00:00
|
|
|
# taken from Magisk, with modifications for NanoDroid
|
|
|
|
mount_apex () {
|
|
|
|
if ${BOOTMODE}; then
|
2020-08-18 16:42:29 +00:00
|
|
|
APEX_LD=/apex/com.android.runtime
|
2020-08-11 19:25:48 +00:00
|
|
|
else
|
|
|
|
APEX_LD=/apex/com.android.runtime
|
2019-10-08 18:48:47 +00:00
|
|
|
|
2019-10-12 18:00:52 +00:00
|
|
|
mkdir -p /apex
|
2020-08-11 19:25:48 +00:00
|
|
|
|
|
|
|
for apex in /system/apex/*; do
|
|
|
|
apex_mount="/apex/$(basename ${apex} .apex)"
|
|
|
|
apex_loop="/dev/loop_apex_$(basename ${apex} .apex)"
|
|
|
|
|
|
|
|
[ "${apex_mount}" == /apex/com.android.runtime.release ] && apex_mount=/apex/com.android.runtime
|
|
|
|
[ "${apex_mount}" == /apex/com.android.runtime.debug ] && apex_mount=/apex/com.android.runtime
|
|
|
|
|
2020-08-18 08:43:47 +00:00
|
|
|
mkdir -p "${apex_mount}"
|
|
|
|
|
2020-08-11 19:25:48 +00:00
|
|
|
if [ -f "${apex}" ]; then
|
|
|
|
unzip -oq "${apex}" apex_payload.img -d /apex
|
|
|
|
mount_apex_loop "${apex_mount}" || error "APEX loop setup failed!"
|
|
|
|
elif [ -d "${apex}" ]; then
|
|
|
|
mount -o bind "${apex}" "${apex_mount}"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
export ANDROID_RUNTIME_ROOT=/apex/com.android.runtime
|
|
|
|
export ANDROID_TZDATA_ROOT=/apex/com.android.tzdata
|
2019-10-08 18:48:47 +00:00
|
|
|
fi
|
2020-08-11 19:25:48 +00:00
|
|
|
|
|
|
|
echo " INFO: #10 [APEX_LD] ${APEX_LD}"
|
2020-08-18 08:44:57 +00:00
|
|
|
echo " INFO: #11 [APEX [ALL]] $(ls /system/apex/*)"
|
2019-10-23 19:33:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# taken from Magisk, with minor modifications for NanoDroid
|
|
|
|
mount_partitions () {
|
|
|
|
DEVICE_AB=FALSE
|
|
|
|
VENDOR_COMPAT=FALSE
|
|
|
|
SYSTEM_AS_ROOT=FALSE
|
|
|
|
|
|
|
|
SLOT=$(grep_cmdline androidboot.slot_suffix)
|
2019-10-29 18:38:41 +00:00
|
|
|
echo " INFO: #1 [SLOT] ${SLOT}"
|
2019-10-23 19:33:46 +00:00
|
|
|
if [ -z ${SLOT} ]; then
|
|
|
|
SLOT=$(grep_cmdline androidboot.slot)
|
2019-10-29 18:38:41 +00:00
|
|
|
echo " INFO: #2 [SLOT] ${SLOT}"
|
2019-10-23 20:05:21 +00:00
|
|
|
if [ ! -z ${SLOT} ]; then
|
2019-10-23 19:33:46 +00:00
|
|
|
SLOT=_${SLOT}
|
2019-10-29 18:38:41 +00:00
|
|
|
echo " INFO: #3 [SLOT] ${SLOT}"
|
2019-10-23 19:33:46 +00:00
|
|
|
DEVICE_AB=TRUE
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
system_tmp=$(find /dev/block -type l -name system${SLOT} | head -n 1)
|
2019-10-29 18:38:41 +00:00
|
|
|
echo " INFO: #4 [system_tmp] ${system_tmp}"
|
2019-10-23 19:33:46 +00:00
|
|
|
SYSTEM_BLOCK=$(readlink -f ${system_tmp})
|
2019-10-29 18:38:41 +00:00
|
|
|
echo " INFO: #5 [SYSTEM_BLOCK] ${SYSTEM_BLOCK}"
|
2019-10-23 19:33:46 +00:00
|
|
|
|
|
|
|
is_mounted /data || mount /data || error "failed to mount /data!"
|
2019-10-08 18:48:47 +00:00
|
|
|
|
2019-10-23 19:33:46 +00:00
|
|
|
mount -o bind /dev/urandom /dev/random
|
2019-10-29 18:38:41 +00:00
|
|
|
! is_mounted /system && mount -o rw /system
|
|
|
|
! is_mounted /system && mount -o rw ${SYSTEM_BLOCK} /system
|
|
|
|
! is_mounted /system && error "failed to mount /system!"
|
2019-10-23 19:33:46 +00:00
|
|
|
|
|
|
|
if [ -f /system/init.rc ]; then
|
|
|
|
SYSTEM_AS_ROOT=true
|
|
|
|
[ -L /system_root ] && rm -f /system_root
|
|
|
|
mkdir /system_root 2>/dev/null
|
|
|
|
mount --move /system /system_root
|
|
|
|
mount -o bind /system_root/system /system
|
|
|
|
fi
|
|
|
|
|
|
|
|
vendor_tmp=$(find /dev/block -type l -name vendor${SLOT} | head -n 1)
|
2019-10-29 18:38:41 +00:00
|
|
|
echo " INFO: #6 [vendor_tmp] ${vendor_tmp}"
|
2019-10-23 19:33:46 +00:00
|
|
|
VENDOR_BLOCK=$(readlink -f ${vendor_tmp})
|
2019-10-29 18:38:41 +00:00
|
|
|
echo " INFO: #7 [VENDOR_BLOCK] ${VENDOR_BLOCK}"
|
|
|
|
|
|
|
|
! is_mounted /vendor && mount -o ro /vendor || mount -o ro ${VENDOR_BLOCK} /vendor
|
2019-10-08 18:48:47 +00:00
|
|
|
|
2019-10-29 18:38:41 +00:00
|
|
|
if [ -d /system/vendor ]; then
|
2019-01-12 09:23:18 +00:00
|
|
|
### XXX work-around required for some ROMs
|
2019-10-08 18:48:47 +00:00
|
|
|
VENDOR_COMPAT=TRUE
|
2019-11-14 19:26:32 +00:00
|
|
|
ln -sf /system/vendor /vendor >/dev/null
|
2019-10-29 18:38:41 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo " "
|
|
|
|
mount | awk '{print $1 " on " $3 " params: " $6}'
|
|
|
|
echo " "
|
2019-10-23 19:33:46 +00:00
|
|
|
|
2019-10-29 18:38:41 +00:00
|
|
|
echo " INFO: #8 [prop]"
|
|
|
|
ls -l /system/*.prop
|
2019-10-23 19:33:46 +00:00
|
|
|
|
2019-10-29 18:38:41 +00:00
|
|
|
export build_props=$(find /system /system_root /vendor -type f -name build.prop)
|
|
|
|
echo " INFO: #9 [build_props] ${build_props}"
|
2019-01-12 09:23:18 +00:00
|
|
|
|
2019-10-29 18:38:41 +00:00
|
|
|
[ -z "${build_props}" ] && error "failed to mount /system (unsupported A/B device?)"
|
2019-10-23 19:33:46 +00:00
|
|
|
|
|
|
|
mount_apex
|
2018-03-09 19:13:37 +00:00
|
|
|
}
|
|
|
|
|
2018-01-23 20:11:52 +00:00
|
|
|
# check for configuration files
|
2019-06-30 05:01:23 +00:00
|
|
|
config_locations="/data/media/0 /external_sd /sdcard1 /data $(dirname ${ZIP}))"
|
2018-08-22 18:01:37 +00:00
|
|
|
config_files=".nanodroid-setup .nanodroid-apps .nanodroid-overlay"
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2018-11-12 17:09:11 +00:00
|
|
|
restore_apps () {
|
2019-05-05 10:25:07 +00:00
|
|
|
backup_path="${BACKUP_DIR}/$(grep_prop ro.build.flavor)_$(grep_prop ro.build.id)"
|
2019-01-17 18:35:48 +00:00
|
|
|
|
2019-06-10 17:33:09 +00:00
|
|
|
if [ -d ${backup_path}/app/ ]; then
|
2019-07-08 19:46:06 +00:00
|
|
|
for app in ${backup_path}/app/*; do
|
|
|
|
_app=$(basename ${app})
|
|
|
|
if [ -d /system/app/${_app} ]; then
|
|
|
|
ui_print " << removing backup: app:{_app}"
|
|
|
|
rm -rf "${app}"
|
2019-06-10 17:33:09 +00:00
|
|
|
else
|
2019-07-08 19:46:06 +00:00
|
|
|
ui_print " << restoring: app:${_app}"
|
|
|
|
mv "${app}" "/system/app/${_app}"
|
|
|
|
set_perm_data -r "/system/app/${_app}"
|
2019-06-10 17:33:09 +00:00
|
|
|
fi
|
|
|
|
done
|
2019-01-17 18:48:18 +00:00
|
|
|
|
2019-07-08 19:46:06 +00:00
|
|
|
rmdir ${backup_path}/app
|
2019-06-10 17:33:09 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -d ${backup_path}/priv-app/ ]; then
|
2019-07-08 19:46:06 +00:00
|
|
|
for app in ${backup_path}/priv-app/*; do
|
|
|
|
_app=$(basename ${app})
|
|
|
|
if [ -d /system/priv-app/${_app} ]; then
|
|
|
|
ui_print " << removing backup: priv-app:{_app}"
|
|
|
|
rm -rf "${app}"
|
2019-06-10 17:33:09 +00:00
|
|
|
else
|
2019-07-08 19:46:06 +00:00
|
|
|
ui_print " << restoring: priv-app:${_app}"
|
|
|
|
mv "${app}" "/system/priv-app/${_app}"
|
|
|
|
set_perm_data -r "/system/priv-app/${_app}"
|
2019-06-10 17:33:09 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2019-07-08 19:46:06 +00:00
|
|
|
rmdir ${backup_path}/priv-app
|
2019-06-10 17:33:09 +00:00
|
|
|
fi
|
2019-10-08 18:50:49 +00:00
|
|
|
|
|
|
|
if [ -d ${backup_path}/reserve/ ]; then
|
|
|
|
for app in ${backup_path}/reserve/*; do
|
|
|
|
_app=$(basename ${app})
|
|
|
|
if [ -d /system/reserve/${_app} ]; then
|
|
|
|
ui_print " << removing backup: reserve:{_app}"
|
|
|
|
rm -rf "${app}"
|
|
|
|
else
|
|
|
|
ui_print " << restoring: reserve:${_app}"
|
|
|
|
mv "${app}" "/system/reserve/${_app}"
|
|
|
|
set_perm_data -r "/system/reserve/${_app}"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
rmdir ${backup_path}/reserve
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -d ${backup_path}/product/app/ ]; then
|
|
|
|
for app in ${backup_path}/product/app/*; do
|
|
|
|
_app=$(basename ${app})
|
|
|
|
if [ -d /system/product/app/${_app} ]; then
|
|
|
|
ui_print " << removing backup: product/app:{_app}"
|
|
|
|
rm -rf "${app}"
|
|
|
|
else
|
|
|
|
ui_print " << restoring: product/app:${_app}"
|
|
|
|
mv "${app}" "/system/product/app/${_app}"
|
|
|
|
set_perm_data -r "/system/product/app/${_app}"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
rmdir ${backup_path}/product/app
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -d ${backup_path}/product/priv-app/ ]; then
|
|
|
|
for app in ${backup_path}/product/priv-app/*; do
|
|
|
|
_app=$(basename ${app})
|
|
|
|
if [ -d /system/product/priv-app/${_app} ]; then
|
|
|
|
ui_print " << removing backup: product/priv-app:{_app}"
|
|
|
|
rm -rf "${app}"
|
|
|
|
else
|
|
|
|
ui_print " << restoring: product/priv-app:${_app}"
|
|
|
|
mv "${app}" "/system/product/priv-app/${_app}"
|
|
|
|
set_perm_data -r "/system/product/priv-app/${_app}"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
rmdir ${backup_path}/product/priv-app
|
|
|
|
fi
|
2018-08-21 20:13:00 +00:00
|
|
|
}
|
|
|
|
|
2018-01-23 20:11:52 +00:00
|
|
|
system_mode_uninstall () {
|
|
|
|
ui_print " << uninstalling: NanoDroid (System)"
|
2018-01-27 08:52:39 +00:00
|
|
|
ui_print " << using: ${1}"
|
|
|
|
system_list=${1}
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2018-04-08 17:59:37 +00:00
|
|
|
if test -h /system/fonts/Roboto-Regular.ttf; then
|
|
|
|
CUSTOM_FONT="$(basename $(readlink /system/fonts/Roboto-Regular.ttf) .ttf)"
|
|
|
|
ui_print " << Detected NanoDroid-Font (${CUSTOM_FONT})"
|
|
|
|
ui_print " < Restoring original Font"
|
|
|
|
|
2018-08-21 19:59:15 +00:00
|
|
|
${NANODROID_BINDIR}/nanodroid-font -r
|
2018-04-08 17:59:37 +00:00
|
|
|
fi
|
|
|
|
|
2018-11-12 17:09:11 +00:00
|
|
|
restore_apps
|
2019-07-08 19:46:06 +00:00
|
|
|
xargs rm < ${system_list} || error "failed to remove files"
|
2018-01-23 20:11:52 +00:00
|
|
|
|
|
|
|
# remove empty directories
|
|
|
|
# (find -empty not available on Android)
|
2019-07-08 19:46:06 +00:00
|
|
|
for dir in app priv-app; do
|
|
|
|
find /system/${dir} -type d | xargs rmdir -p
|
2018-01-23 20:11:52 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
rm -f "${system_list}"
|
2018-01-27 08:52:39 +00:00
|
|
|
}
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2018-09-08 08:39:07 +00:00
|
|
|
patcher_uninstall () {
|
2019-07-08 19:46:06 +00:00
|
|
|
if [ -f /data/adb/NanoDroid_Patched ]; then
|
2018-12-25 19:41:09 +00:00
|
|
|
services_name="services.jar_$(grep_prop ro.build.flavor)_$(grep_prop ro.build.id)"
|
|
|
|
|
2019-05-05 10:25:07 +00:00
|
|
|
if [ -f ${BACKUP_DIR}/${services_name} ]; then
|
2018-09-08 08:39:07 +00:00
|
|
|
ui_print " << restoring: unpatched services.jar"
|
2019-05-05 10:25:07 +00:00
|
|
|
mv "${BACKUP_DIR}/${services_name}" /system/framework/services.jar
|
2019-01-17 18:35:48 +00:00
|
|
|
set_perm_data /system/framework/services.jar
|
2018-09-08 08:39:07 +00:00
|
|
|
else ui_print " << can't restore unpatched services.jar"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2018-11-19 21:59:36 +00:00
|
|
|
[ -d /data/adb/nanodroid_patcher ] && rm -rf /data/adb/nanodroid_patcher
|
2019-06-10 17:33:09 +00:00
|
|
|
[ -f /system/addon.d/70-nanodroidpatcher.sh ] && rm -f ${addonsh}
|
|
|
|
[ -f /data/adb/NanoDroid_Patched ] && rm -f ${pfile}
|
2018-01-23 20:11:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ui_print " "
|
2019-06-09 20:12:18 +00:00
|
|
|
ui_print "**********************"
|
|
|
|
ui_print " NanoDroid "
|
|
|
|
ui_print " Uninstaller "
|
|
|
|
ui_print " ${VERSION} "
|
|
|
|
ui_print "**********************"
|
2018-01-23 20:11:52 +00:00
|
|
|
ui_print " "
|
|
|
|
|
2018-08-21 20:13:00 +00:00
|
|
|
detect_bootmode
|
2018-03-09 19:13:37 +00:00
|
|
|
mount_partitions
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2018-07-09 18:43:21 +00:00
|
|
|
ui_print " << Removing installation logs (if any)"
|
|
|
|
|
2019-05-11 19:33:15 +00:00
|
|
|
# old format
|
2018-08-21 19:59:15 +00:00
|
|
|
rm -f /data/adb/NanoDroid_log*
|
|
|
|
rm -f /data/adb/NanoDroid_twrp*
|
2018-07-09 18:43:21 +00:00
|
|
|
|
2019-05-11 19:33:15 +00:00
|
|
|
# new format
|
|
|
|
rm -rf /data/media/0/nanodroid_logs
|
|
|
|
|
2018-01-23 20:11:52 +00:00
|
|
|
# System Mode uninstallation
|
2019-07-08 19:46:06 +00:00
|
|
|
[ -f /data/adb/NanoDroid_FileList ] && system_mode_uninstall /data/adb/NanoDroid_FileList
|
2018-01-27 08:52:39 +00:00
|
|
|
|
2018-09-08 08:39:07 +00:00
|
|
|
patcher_uninstall
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2019-06-10 17:42:38 +00:00
|
|
|
for module in NanoDroid NanoDroid_microG NanoDroid_FDroid \
|
2020-01-17 22:22:21 +00:00
|
|
|
NanoDroid_BromiteWebView NanoDroid_OsmAnd NanoDroid_Google; do
|
2019-06-10 17:42:38 +00:00
|
|
|
if [ -d /data/adb/modules/${module} ]; then
|
|
|
|
ui_print " << uninstalling: ${module}"
|
|
|
|
rm -rf /data/adb/modules/${module}
|
|
|
|
fi
|
|
|
|
done
|
2019-04-03 20:13:38 +00:00
|
|
|
|
2019-10-14 15:10:08 +00:00
|
|
|
rm -f /data/adb/.nanodroid_runtimeclean
|
|
|
|
|
2018-01-23 20:11:52 +00:00
|
|
|
ui_print " >> clean up"
|
|
|
|
|
2019-10-23 20:05:21 +00:00
|
|
|
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
|
2020-08-11 19:25:48 +00:00
|
|
|
|
|
|
|
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
|
2018-01-23 20:11:52 +00:00
|
|
|
|
|
|
|
ui_print " "
|
|
|
|
ui_print " > Done!"
|
|
|
|
ui_print " "
|
|
|
|
ui_print "Thanks for giving NanoDroid a try"
|
|
|
|
ui_print " "
|
|
|
|
|
|
|
|
exit 0
|