IQ.Pilot Release Commit @ d23c019
This commit is contained in:
34
system/flockd.service
Normal file
34
system/flockd.service
Normal file
@@ -0,0 +1,34 @@
|
||||
# Copyright © IQ.Lvbs, apart of Project Teal Lvbs, All Rights Reserved, licensed under https://konn3kt.com/tos
|
||||
|
||||
[Unit]
|
||||
Description=Konn3kt Flock/ALPR RF Detector
|
||||
Documentation=https://gitlvb.teallvbs.xyz/teal/iqpilot
|
||||
After=bluetooth.service dbus.service NetworkManager.service
|
||||
Wants=bluetooth.service dbus.service
|
||||
StartLimitIntervalSec=300
|
||||
StartLimitBurst=10
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=comma
|
||||
AmbientCapabilities=CAP_SYS_NICE
|
||||
Environment="IQPILOT_SOURCE_ROOT=/data/openpilot/openpilot"
|
||||
Environment="PYTHONPATH=/usr/libexec/iqpilot/python:/data/openpilot"
|
||||
Environment="PYTHONSAFEPATH=1"
|
||||
Environment="PATH=/usr/local/venv/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
WorkingDirectory=/data/openpilot
|
||||
ExecStartPre=/bin/bash -c 'for i in $(seq 1 120); do if [ -x /usr/libexec/iqpilot/iqpilot_bundle_runner ]; then exit 0; fi; echo "Waiting for iqpilot_bundle_runner..."; sleep 5; done; exit 1'
|
||||
ExecStartPre=/bin/bash -c 'if [ -f /data/openpilot/artifacts/runtime/ensure_private_installed.sh ]; then bash /data/openpilot/artifacts/runtime/ensure_private_installed.sh || true; fi'
|
||||
ExecStart=/bin/bash -lc 'exec /usr/libexec/iqpilot/iqpilot_bundle_runner --bundle iqpilot_hephaestusd_private --mode python-module --entry iqpilot_private.konn3kt.flockd.flockd --daemon-name flockd'
|
||||
TimeoutStartSec=600
|
||||
Restart=always
|
||||
RestartSec=15
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
PrivateTmp=yes
|
||||
NoNewPrivileges=false
|
||||
ProtectSystem=full
|
||||
ProtectHome=no
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
42
system/install_flockd_service.sh
Normal file
42
system/install_flockd_service.sh
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/bash
|
||||
set -e
|
||||
|
||||
SERVICE_FILE="/data/openpilot/system/flockd.service"
|
||||
SERVICE_NAME="flockd.service"
|
||||
SERVICE_OVERRIDE="/etc/systemd/system/${SERVICE_NAME}"
|
||||
SERVICE_BAKED="/lib/systemd/system/${SERVICE_NAME}"
|
||||
|
||||
echo "Installing Flock RF detector systemd service..."
|
||||
|
||||
if [ -f "$SERVICE_BAKED" ] && grep -q "/usr/libexec/iqpilot/iqpilot_bundle_runner" "$SERVICE_BAKED"; then
|
||||
echo "Using IQ.OS baked ${SERVICE_NAME}; removing stale override if present..."
|
||||
sudo mount -o remount,rw /
|
||||
sudo rm -f "$SERVICE_OVERRIDE"
|
||||
sudo systemctl daemon-reload
|
||||
sudo mount -o remount,ro /
|
||||
else
|
||||
if [ ! -f "$SERVICE_FILE" ]; then
|
||||
echo "ERROR: Service file not found at $SERVICE_FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "IQ.OS baked unit unavailable; installing fallback override into /etc/systemd/system..."
|
||||
sudo cp "$SERVICE_FILE" "$SERVICE_OVERRIDE"
|
||||
sudo systemctl daemon-reload
|
||||
fi
|
||||
|
||||
echo "Enabling $SERVICE_NAME to start at boot..."
|
||||
sudo systemctl enable "$SERVICE_NAME"
|
||||
|
||||
echo "Starting $SERVICE_NAME..."
|
||||
sudo systemctl restart "$SERVICE_NAME"
|
||||
|
||||
echo ""
|
||||
echo "Service status:"
|
||||
sudo systemctl status "$SERVICE_NAME" --no-pager
|
||||
|
||||
echo ""
|
||||
echo "Useful commands:"
|
||||
echo " sudo systemctl status flockd - Check service status"
|
||||
echo " sudo systemctl restart flockd - Restart service"
|
||||
echo " sudo journalctl -u flockd -f - View live logs"
|
||||
@@ -181,6 +181,32 @@ class NativeProcess(ManagerProcess):
|
||||
self.shutting_down = False
|
||||
|
||||
|
||||
def _normalize_bundle_modes(bundle: str) -> None:
|
||||
import json
|
||||
candidates = []
|
||||
if env_root := os.environ.get("IQPILOT_PROPRIETARY_ROOT"):
|
||||
candidates += [os.path.join(env_root, bundle), env_root]
|
||||
candidates += [
|
||||
os.path.join(BASEDIR, ".iqpilot", "bundles", bundle),
|
||||
os.path.join(os.path.dirname(BASEDIR), ".iqpilot", "bundles", bundle),
|
||||
os.path.join(BASEDIR, "artifacts", bundle),
|
||||
]
|
||||
root = next((c for c in candidates if os.path.isfile(os.path.join(c, "manifest.json"))), None)
|
||||
if root is None:
|
||||
return
|
||||
try:
|
||||
with open(os.path.join(root, "manifest.json")) as f:
|
||||
manifest = json.load(f)
|
||||
for rel, meta in manifest.items():
|
||||
if not (isinstance(meta, dict) and "mode" in meta and "sha256" in meta):
|
||||
continue
|
||||
path = os.path.join(root, rel)
|
||||
if os.path.isfile(path) and (os.stat(path).st_mode & 0o777) != meta["mode"]:
|
||||
os.chmod(path, meta["mode"])
|
||||
except Exception:
|
||||
cloudlog.exception(f"failed to normalize bundle modes for {bundle}")
|
||||
|
||||
|
||||
class BundleProcess(NativeProcess):
|
||||
def __init__(self, name, bundle, entry, should_run, enabled=True, sigkill=False, restart_if_crash=False):
|
||||
self.bundle = bundle
|
||||
@@ -204,6 +230,11 @@ class BundleProcess(NativeProcess):
|
||||
sigkill=sigkill,
|
||||
)
|
||||
|
||||
def start(self) -> None:
|
||||
if self.proc is None:
|
||||
_normalize_bundle_modes(self.bundle)
|
||||
super().start()
|
||||
|
||||
|
||||
class PythonProcess(ManagerProcess):
|
||||
def __init__(self, name, module, should_run, enabled=True, sigkill=False, restart_if_crash=False):
|
||||
|
||||
Reference in New Issue
Block a user