Persist AP override across reboots

/tmp/babycam-ap-override → /var/lib/babycam/ap-override
setup.sh legt /var/lib/babycam mit chown pi:pi an

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Julian Vollmer 2026-05-18 15:58:14 +02:00
parent 7cfc958cf0
commit 30180e5923
3 changed files with 7 additions and 3 deletions

View File

@ -163,7 +163,7 @@ def wifi_scan():
@app.route("/ap/<action>", methods=["POST"])
def ap_control(action):
override_file = "/tmp/babycam-ap-override"
override_file = "/var/lib/babycam/ap-override"
if action == "on":
with open(override_file, "w") as f:
f.write("on")
@ -183,7 +183,7 @@ def ap_control(action):
def get_ap_override():
try:
with open("/tmp/babycam-ap-override") as f:
with open("/var/lib/babycam/ap-override") as f:
return f.read().strip().lower()
except FileNotFoundError:
return "auto"

View File

@ -29,7 +29,7 @@ AP_INTERFACE = "wlan1"
CLIENT_INTERFACE = "wlan0"
AP_IP = "192.168.50.1"
CHECK_INTERVAL = 30 # Sekunden
OVERRIDE_FILE = "/tmp/babycam-ap-override"
OVERRIDE_FILE = "/var/lib/babycam/ap-override"
def run(cmd, check=False):

View File

@ -46,6 +46,10 @@ fi
# ------------------------------------------------------------------------------
# 3. Projektdateien installieren
# ------------------------------------------------------------------------------
info "Verzeichnisse anlegen..."
mkdir -p /var/lib/babycam
chown pi:pi /var/lib/babycam
info "Projektdateien nach $INSTALL_DIR kopieren..."
mkdir -p "$INSTALL_DIR"
cp -r "$REPO_DIR/app" "$INSTALL_DIR/"