fix: harden UI actions and daemon calls for reliable control (v1.3.2)

Retry and serialize pineapd/hak5 calls, queue virtual-pager keys, and grey out buttons until the pager finishes. Deploy now installs python3-light after factory firmware. Bump version to 1.3.2.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-20 15:49:10 -05:00
co-authored by Cursor
parent cd26553d21
commit 7d48b7ad06
25 changed files with 3625 additions and 782 deletions
+58 -17
View File
@@ -97,31 +97,75 @@ PY
printf 'Built: %s\n' "$ZIP_PATH"
TARGET="$PAGER_USER@$PAGER_HOST"
SSH_OPTS=(-o StrictHostKeyChecking=accept-new)
if [[ -n "$PASSWORD" && -z "$SSH_KEY" ]]; then
SSH_OPTS+=(-o PreferredAuthentications=password -o PubkeyAuthentication=no)
fi
run_scp() {
if [[ -n "$PASSWORD" && -n "$SSH_KEY" ]]; then
SSHPASS="$PASSWORD" sshpass -e scp -i "$SSH_KEY" "$@"
SSHPASS="$PASSWORD" sshpass -e scp "${SSH_OPTS[@]}" -i "$SSH_KEY" "$@"
elif [[ -n "$PASSWORD" ]]; then
SSHPASS="$PASSWORD" sshpass -e scp "$@"
SSHPASS="$PASSWORD" sshpass -e scp "${SSH_OPTS[@]}" "$@"
elif [[ -n "$SSH_KEY" ]]; then
scp -i "$SSH_KEY" "$@"
scp "${SSH_OPTS[@]}" -i "$SSH_KEY" "$@"
else
scp "$@"
scp "${SSH_OPTS[@]}" "$@"
fi
}
run_ssh() {
if [[ -n "$PASSWORD" && -n "$SSH_KEY" ]]; then
SSHPASS="$PASSWORD" sshpass -e ssh -i "$SSH_KEY" "$@"
SSHPASS="$PASSWORD" sshpass -e ssh "${SSH_OPTS[@]}" -i "$SSH_KEY" "$@"
elif [[ -n "$PASSWORD" ]]; then
SSHPASS="$PASSWORD" sshpass -e ssh "$@"
SSHPASS="$PASSWORD" sshpass -e ssh "${SSH_OPTS[@]}" "$@"
elif [[ -n "$SSH_KEY" ]]; then
ssh -i "$SSH_KEY" "$@"
ssh "${SSH_OPTS[@]}" -i "$SSH_KEY" "$@"
else
ssh "$@"
ssh "${SSH_OPTS[@]}" "$@"
fi
}
install_python3() {
if run_ssh "$TARGET" 'command -v python3 >/dev/null'; then
printf 'python3 already present on the pager.\n'
return 0
fi
printf 'python3 missing on pager; installing python3-light (offline ipks).\n'
local cache="$ROOT/build/python-ipk"
local pkg_base='https://downloads.openwrt.org/releases/24.10.1/packages/mipsel_24kc'
mkdir -p "$cache"
local files=(
"base/libbz2-1.0_1.0.8-r1_mipsel_24kc.ipk"
"packages/libpython3-3.11_3.11.14-r1_mipsel_24kc.ipk"
"packages/python3-base_3.11.14-r1_mipsel_24kc.ipk"
"packages/python3-light_3.11.14-r1_mipsel_24kc.ipk"
)
local names=()
local rel
for rel in "${files[@]}"; do
local name="${rel##*/}"
names+=("$name")
if [[ ! -s "$cache/$name" ]]; then
curl -fsSL --retry 3 -o "$cache/$name" "$pkg_base/$rel"
fi
done
run_ssh "$TARGET" 'mkdir -p /tmp/python-ipk && rm -rf /tmp/python-ipk/*'
(
cd "$cache"
run_scp "${names[@]}" "$TARGET:/tmp/python-ipk/"
)
run_ssh "$TARGET" 'set -e
cd /tmp/python-ipk
opkg install libbz2-1.0_*.ipk libpython3-3.11_*.ipk python3-base_*.ipk python3-light_*.ipk
command -v python3 >/dev/null
python3 -c "import json,socket,hashlib,threading,select,subprocess,struct,base64,re"
rm -rf /tmp/python-ipk
echo PYTHON_OK'
}
install_python3
run_scp "$ZIP_PATH" "$MANIFEST_PATH" "$TARGET:/tmp/"
REMOTE_PAYLOAD_DIR="user/$PAYLOAD_CATEGORY/$PAYLOAD_KEY"
@@ -151,16 +195,13 @@ else
exit 1
fi
rm -f '/tmp/$ZIP_NAME' /tmp/_hak5_manifest.json
webui_running=false
if [ -x /etc/init.d/pagerwebui ] && /etc/init.d/pagerwebui running >/dev/null 2>&1; then
webui_running=true
fi
if [ -f /etc/init.d/pagerwebui ]; then
cp '$REMOTE_PAYLOAD_DIR/pagerwebui.init' /etc/init.d/pagerwebui
chmod +x /etc/init.d/pagerwebui
fi
if \$webui_running; then
cp '$REMOTE_PAYLOAD_DIR/pagerwebui.init' /etc/init.d/pagerwebui
chmod +x /etc/init.d/pagerwebui
/etc/init.d/pagerwebui enable
if /etc/init.d/pagerwebui running >/dev/null 2>&1; then
/etc/init.d/pagerwebui restart
else
/etc/init.d/pagerwebui start
fi
echo EXTRACT_OK"
run_ssh "$TARGET" "$REMOTE_COMMAND"