diff --git a/setup-fikakassa-kioskmode.sh b/setup-fikakassa-kioskmode.sh index cc472f4..ee1703a 100755 --- a/setup-fikakassa-kioskmode.sh +++ b/setup-fikakassa-kioskmode.sh @@ -9,15 +9,16 @@ set -Eeuo pipefail # # The script: # - installs the kiosk stack and Python runtime -# - creates a non-admin kiosk user +# - uses the existing Debian user as the kiosk user # - installs the Fikakassan app from the directory containing this script # - starts FastAPI automatically at boot # - configures Wi-Fi through NetworkManager # - autologins the kiosk user # - starts Chromium in true kiosk mode # - disables suspend/blanking and common escape routes -# - limits outbound traffic so the kiosk does not use the phone's -# mobile data for normal Internet traffic; DNS/NTP are still allowed +# - blocks ordinary Internet traffic over the Wi-Fi hotspot while allowing +# full Internet access over wired Ethernet when a cable is connected +# - keeps Wi-Fi and Ethernet connected simultaneously # # Before running, put this script in the root of the Fikakassan project. @@ -77,14 +78,14 @@ systemctl enable NetworkManager.service systemctl enable ssh.service systemctl enable nftables.service -log "Skapar kiosk-användare" +log "Kontrollerar kiosk-användare" if ! id "$KIOSK_USER" >/dev/null 2>&1; then - useradd --create-home --shell /bin/bash --user-group "$KIOSK_USER" + die "Användaren '$KIOSK_USER' finns inte. Skapa användaren först eller ange KIOSK_USER=..." fi -# Use the existing Debian user for the kiosk session. Existing sudo/group -# memberships are preserved. +# Use the existing Debian user for the kiosk session. Do not alter its +# existing group memberships or sudo permissions. usermod -s /bin/bash "$KIOSK_USER" log "Installerar Fikakassan i $APP_DIR" @@ -103,8 +104,16 @@ find "$APP_DIR" -type f -exec chmod 644 {} + log "Skapar Python virtualenv" +rm -rf "$APP_DIR/.venv" python3 -m venv "$APP_DIR/.venv" -"$APP_DIR/.venv/bin/pip" install --disable-pip-version-check --no-cache-dir -r "$APP_DIR/requirements.txt" + +# Do not execute the pip wrapper directly. Some Debian filesystems/policies +# can leave the wrapper without execute permission. Running pip through the +# virtualenv Python avoids that failure. +"$APP_DIR/.venv/bin/python" -m pip install \ + --disable-pip-version-check \ + --no-cache-dir \ + -r "$APP_DIR/requirements.txt" log "Skapar systemd-tjänst för Fikakassan" @@ -163,6 +172,12 @@ nmcli connection modify "$WIFI_CONNECTION" connection.autoconnect-priority 100 nmcli connection up "$WIFI_CONNECTION" || true +# Wired Ethernet is the maintenance/Internet path. Do not create a special +# Ethernet profile: NetworkManager's normal DHCP profile should be allowed to +# obtain a default route whenever a cable is connected. The Wi-Fi profile has +# never-default enabled above, so Ethernet wins the default route naturally. +# Existing Ethernet profiles are left untouched. + log "Konfigurerar lokal brandvägg" if [[ "$LOCK_DOWN_INTERNET" == "1" ]]; then