Skip to content

Commit

Permalink
improve code logic
Browse files Browse the repository at this point in the history
  • Loading branch information
AkinaAcct committed Oct 4, 2024
1 parent ccf0a1c commit b0f1dd6
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions AAP.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,6 @@ if command -v getprop >/dev/null 2>&1; then
else
OS="linux"
fi
# ROOT 检测
if [ "$(id -u)" -eq 0 ]; then
ROOT=true
if [ "${OS}" = "android" ]; then
if [ "$(magisk -v | grep "delta")" -o "$(magisk -v | grep "kitsune")" ]; then
msg_fatal "Detected Magisk Deleta/Kitsune: Unsupported environment. Aborted."
exit 114
fi
fi
else
ROOT=false
msg_warn "You are running in unprivileged mode; some functionality may be limited."
fi

if [ -z "$(echo ${PREFIX} | grep -i termux)" -a "${OS}" = "android" ]; then
msg_warn "Unsupported terminal app(not in Termux)."
fi
print_help() {
printf "${BLUE}%s${RESET}\n\n" "
APatch Auto Patch Tool
Expand Down Expand Up @@ -168,6 +151,20 @@ while getopts ":hvi:k:KIVs:Sd:E:c:" OPT; do
;;
esac
done

# ROOT 检测
if [ "$(id -u)" -eq 0 ]; then
ROOT=true
if [ "${OS}" = "android" ]; then
if [ "$(magisk -v | grep "delta")" -o "$(magisk -v | grep "kitsune")" ]; then
msg_fatal "Detected Magisk Deleta/Kitsune: Unsupported environment. Aborted."
exit 114
fi
fi
else
ROOT=false
msg_warn "You are running in unprivileged mode; some functionality may be limited."
fi
# 镜像路径检测(For Linux)
if [ "${OS}" = "linux" -a -z "${BOOTPATH}" ]; then
msg_fatal "You are using ${OS}, but there is no image specified by you. Aborted."
Expand Down

0 comments on commit b0f1dd6

Please sign in to comment.