Link <name>-update into /usr/bin so pct exec finds it without the full path

pct exec runs without a login shell and its PATH may lack /usr/local/bin.
setup.sh adds the link on Linux; update.sh adds it to older installs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
neil 2026-11-04 21:05:20 -08:00
parent be727949c1
commit c9738358de
8 changed files with 19 additions and 11 deletions

View file

@ -16,7 +16,7 @@ export ROLE APP_VERSION PORT INSTALL_DIR INSTALL_MODE=native DATA_DIR="$INSTALL_
UPDATE_COMMAND="$NAME-update"
if [ "$PLATFORM" = systemd ] && command -v sudo >/dev/null 2>&1; then UPDATE_COMMAND="sudo $NAME-update"; fi
if systemd-detect-virt -cq 2>/dev/null; then
UPDATE_COMMAND="$NAME-update (from the Proxmox node: pct exec <ctid> -- /usr/local/bin/$NAME-update)"
UPDATE_COMMAND="$NAME-update (from the Proxmox node: pct exec <ctid> -- $NAME-update)"
fi
export UPDATE_COMMAND
exec "$INSTALL_DIR/.venv/bin/uvicorn" app.main:app --host "$(app_host)" --port "$PORT" \

View file

@ -91,6 +91,11 @@ printf '#!/bin/sh\n# Deploy a new commit of %s (native install). See: %s-update
as_root mkdir -p /usr/local/bin
as_root install -m 755 "$tmp" "/usr/local/bin/$NAME-update"
rm -f "$tmp"
if [ "$PLATFORM" = systemd ]; then
# Also in /usr/bin, which is on every PATH: `pct exec <ctid> -- <name>-update` from a Proxmox
# node runs without a login shell and its PATH may not include /usr/local/bin.
as_root ln -sfn "/usr/local/bin/$NAME-update" "/usr/bin/$NAME-update"
fi
native_log "service"
if [ "$PLATFORM" = systemd ]; then

View file

@ -26,6 +26,9 @@ while [ $# -gt 0 ]; do
done
if [ "$PLATFORM" = systemd ] && [ "$(id -u)" != 0 ]; then native_die "run it with sudo: sudo $NAME-update $*"; fi
if [ "$PLATFORM" = systemd ] && [ ! -e "/usr/bin/$NAME-update" ]; then # installs older than the /usr/bin link
ln -sfn "/usr/local/bin/$NAME-update" "/usr/bin/$NAME-update" 2>/dev/null || true
fi
if [ "$PLATFORM" = launchd ] && [ "$(id -u)" = 0 ] && [ "$SVC_USER" != root ]; then
exec sudo -u "$SVC_USER" NETMON_DIR="$INSTALL_DIR" /bin/bash "$0" "$@"
fi