fixed background picture view port bug and dependency check in preflight
This commit is contained in:
@@ -76,6 +76,15 @@ else
|
|||||||
fail_line "not available. Install it (e.g. apt install python3-venv)." || PREFLIGHT_FAIL=1
|
fail_line "not available. Install it (e.g. apt install python3-venv)." || PREFLIGHT_FAIL=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# pip or ensurepip (venv will get pip via ensurepip or get-pip.py)
|
||||||
|
PREFLIGHT_LABEL="pip / ensurepip"
|
||||||
|
preflight_check "$PREFLIGHT_LABEL"
|
||||||
|
if python3 -m pip --version >/dev/null 2>&1 || python3 -c 'import ensurepip' 2>/dev/null; then
|
||||||
|
ok_line "available"
|
||||||
|
else
|
||||||
|
fail_line "pip not found. Install python3-pip or python3-venv (e.g. apt install python3-venv python3-pip)." || PREFLIGHT_FAIL=1
|
||||||
|
fi
|
||||||
|
|
||||||
# systemd
|
# systemd
|
||||||
PREFLIGHT_LABEL="systemd"
|
PREFLIGHT_LABEL="systemd"
|
||||||
preflight_check "$PREFLIGHT_LABEL"
|
preflight_check "$PREFLIGHT_LABEL"
|
||||||
@@ -140,19 +149,48 @@ do_install() {
|
|||||||
install -m 644 "$BRIDGE_ROOT/daemon/main.py" "$INSTALL_PREFIX/"
|
install -m 644 "$BRIDGE_ROOT/daemon/main.py" "$INSTALL_PREFIX/"
|
||||||
install -m 644 "$BRIDGE_ROOT/daemon/requirements.txt" "$INSTALL_PREFIX/"
|
install -m 644 "$BRIDGE_ROOT/daemon/requirements.txt" "$INSTALL_PREFIX/"
|
||||||
chown -R "$SERVICE_USER:$SERVICE_GROUP" "$INSTALL_PREFIX"
|
chown -R "$SERVICE_USER:$SERVICE_GROUP" "$INSTALL_PREFIX"
|
||||||
# Python venv (pip quiet to keep log small)
|
|
||||||
|
# Python venv: ensure pip is available, then install deps and verify uvicorn
|
||||||
if [[ ! -x "$INSTALL_PREFIX/venv/bin/uvicorn" ]]; then
|
if [[ ! -x "$INSTALL_PREFIX/venv/bin/uvicorn" ]]; then
|
||||||
python3 -m venv "$INSTALL_PREFIX/venv"
|
python3 -m venv "$INSTALL_PREFIX/venv"
|
||||||
"$INSTALL_PREFIX/venv/bin/pip" install --disable-pip-version-check -q -r "$INSTALL_PREFIX/requirements.txt"
|
VENV_PYTHON="$INSTALL_PREFIX/venv/bin/python"
|
||||||
|
|
||||||
|
# Ensure pip in venv (some minimal python3-venv installs create venv without pip)
|
||||||
|
if ! "$VENV_PYTHON" -m pip --version >/dev/null 2>&1; then
|
||||||
|
if "$VENV_PYTHON" -m ensurepip --upgrade 2>/dev/null; then
|
||||||
|
: # pip now available
|
||||||
|
else
|
||||||
|
GET_PIP="$(mktemp)"
|
||||||
|
if curl -sSf -o "$GET_PIP" "https://bootstrap.pypa.io/get-pip.py" && "$VENV_PYTHON" "$GET_PIP"; then
|
||||||
|
rm -f "$GET_PIP"
|
||||||
|
else
|
||||||
|
rm -f "$GET_PIP"
|
||||||
|
echo "FATAL: Could not install pip into venv (ensurepip failed and get-pip.py failed or unavailable)." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
"$VENV_PYTHON" -m pip install --disable-pip-version-check -q -r "$INSTALL_PREFIX/requirements.txt" || {
|
||||||
|
echo "FATAL: pip install -r requirements.txt failed." >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ ! -x "$INSTALL_PREFIX/venv/bin/uvicorn" ]]; then
|
||||||
|
echo "FATAL: uvicorn not found after pip install. Check requirements.txt and network." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
chown -R "$SERVICE_USER:$SERVICE_GROUP" "$INSTALL_PREFIX/venv"
|
chown -R "$SERVICE_USER:$SERVICE_GROUP" "$INSTALL_PREFIX/venv"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# systemd unit
|
# systemd unit
|
||||||
install -m 644 "$BRIDGE_ROOT/daemon/systemd/orderpy-bridge.service" /etc/systemd/system/
|
install -m 644 "$BRIDGE_ROOT/daemon/systemd/orderpy-bridge.service" /etc/systemd/system/
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
( do_install; echo $? > "$INSTALL_EXIT_FILE" ) >> "$INSTALL_LOG" 2>&1 &
|
( do_install; r=$?; echo $r > "$INSTALL_EXIT_FILE"; exit $r ) >> "$INSTALL_LOG" 2>&1 &
|
||||||
INSTALL_PID=$!
|
INSTALL_PID=$!
|
||||||
|
|
||||||
# Progress bar (indeterminate: moving cursor)
|
# Progress bar (indeterminate: moving cursor)
|
||||||
|
|||||||
Reference in New Issue
Block a user