update bundled script

This commit is contained in:
Luis Guzmán 2026-01-06 06:09:37 -06:00
parent 53f7a97ee5
commit c01e28ec58
1 changed files with 38 additions and 6 deletions

View File

@ -925,7 +925,10 @@ self_check_android_flags() {
fi
fi
log " Tip: run --check for full details."
# Avoid redundant tip when we're already in --check mode.
if [[ "${MODE:-}" != "check" && "${MODE:-}" != "all" ]]; then
log " Tip: run --check for full details."
fi
}
# ---- END 60_mod_ppk_checks.sh ----
@ -960,6 +963,7 @@ CHECK_PPK=""
# Modes are mutually exclusive (baseline is default)
MODE="baseline" # baseline|with-adb|adb-only|connect-only|ppk-only|check|all
MODE_SET=0
CONNECT_PORT_FROM="" # "", "flag", "positional"
usage() {
cat <<'EOF'
@ -1027,10 +1031,11 @@ self_check() {
log " adb: present"
adb devices -l 2>/dev/null | sed 's/^/ /' || true
local serial
if serial="$(adb_pick_loopback_serial 2>/dev/null)"; then
log " adb shell id (first device):"
adb -s "$serial" shell id 2>/dev/null | sed 's/^/ /' || true
fi
# renable in need for verbose output.
# if serial="$(adb_pick_loopback_serial 2>/dev/null)"; then
# log " adb shell id (first device):"
# adb -s "$serial" shell id 2>/dev/null | sed 's/^/ /' || true
# fi
else
warn " adb: not present"
fi
@ -1161,7 +1166,10 @@ while [[ $# -gt 0 ]]; do
ONLY_CONNECT=1
# Optional positional port (5 digits)
if [[ "${2:-}" =~ ^[0-9]{5}$ ]]; then
[[ -n "${CONNECT_PORT_FROM:-}" && "${CONNECT_PORT_FROM}" != "positional" ]] && \
die "CONNECT PORT specified twice (positional + --connect-port). Use only one."
CONNECT_PORT="$2"
CONNECT_PORT_FROM="positional"
shift 2
else
shift
@ -1170,7 +1178,13 @@ while [[ $# -gt 0 ]]; do
--ppk-only) set_mode "ppk-only"; shift ;;
--check) set_mode "check"; shift ;;
--all) set_mode "all"; shift ;;
--connect-port) CONNECT_PORT="${2:-}"; shift 2 ;;
--connect-port)
[[ -n "${CONNECT_PORT_FROM:-}" && "${CONNECT_PORT_FROM}" != "flag" ]] && \
die "CONNECT PORT specified twice (positional + --connect-port). Use only one."
CONNECT_PORT="${2:-}"
CONNECT_PORT_FROM="flag"
shift 2
;;
--timeout) TIMEOUT_SECS="${2:-180}"; shift 2 ;;
--host) HOST="${2:-127.0.0.1}"; shift 2 ;;
--reset-debian|--clean-debian) RESET_DEBIAN=1; shift ;;
@ -1182,11 +1196,29 @@ while [[ $# -gt 0 ]]; do
esac
done
validate_args() {
if [[ -n "${CONNECT_PORT:-}" ]]; then
CONNECT_PORT="${CONNECT_PORT//[[:space:]]/}"
[[ "$CONNECT_PORT" =~ ^[0-9]{5}$ ]] || die "Invalid --connect-port (must be 5 digits): '$CONNECT_PORT'"
case "$MODE" in
adb-only|with-adb|connect-only|ppk-only|check|all) : ;;
baseline)
log "--connect-port requires an ADB mode."
die "Use along with: --adb-only / --with-adb / --connect-only / --check / --ppk-only / --all"
;;
*)
die "--connect-port is not valid with mode=$MODE"
;;
esac
fi
}
# -------------------------
# Main flows
# -------------------------
main() {
setup_logging "$@"
validate_args
sanitize_timeout
acquire_wakelock