potental correct wifi fix

This commit is contained in:
Karl 2025-07-22 11:44:26 +01:00
parent d9d8fb3d5a
commit 466668553d
5 changed files with 23 additions and 85 deletions

View File

@ -2,7 +2,7 @@
# This script is being run on the target debian platform
apt update
DEBIAN_FRONTEND=noninteractive apt install -y lightdm openbox nginx php-fpm php-cli chromium autossh unclutter x11-xserver-utils xdotool htop nano openssh-server rsync x11vnc lm-sensors ntpdate scrot wireless-regdb fontconfig php-cli uuid-runtime
DEBIAN_FRONTEND=noninteractive apt install -y lightdm openbox nginx php-fpm php-cli chromium autossh unclutter x11-xserver-utils xdotool htop nano openssh-server rsync x11vnc lm-sensors ntpdate scrot wireless-regdb fontconfig php-cli
rsync -a --chown=root:root "/kiosk_skeleton/." "/"
chmod +x /usr/bin/kiosk-* /usr/bin/get-ini /usr/bin/refresh-screen /usr/bin/schedule-* /usr/bin/setup-refresh-timer
@ -60,8 +60,6 @@ mkdir -p /etc/wpa_supplicant/
ln -sf /tmp/hosts /etc/hosts
ln -sf /tmp/hostname /etc/hostname
ln -sf /tmp/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf
mkdir -p /etc/NetworkManager/system-connections/
ln -sf /tmp/kiosk.nmconnection /etc/NetworkManager/system-connections/kiosk.nmconnection
systemctl daemon-reload
@ -73,6 +71,7 @@ systemctl disable bluetooth || true
systemctl enable kiosk-ssh-keys
systemctl enable NetworkManager
systemctl enable NetworkManager
systemctl enable kiosk-wifi
systemctl enable kiosk-autossh
systemctl enable kiosk-watchdog

View File

@ -0,0 +1,21 @@
[connection]
id=kiosk
uuid=a2a5c7d8-2e2b-4b2a-9c1d-3e4e5e6a7b8c
type=wifi
autoconnect=true
interface-name=wlan0
[wifi]
mode=infrastructure
ssid=YOUR_WIFI_SSID
[wifi-security]
auth-alg=open
key-mgmt=wpa-psk
psk=YOUR_WIFI_PASSWORD
[ipv4]
method=auto
[ipv6]
method=auto

View File

@ -1,10 +0,0 @@
[Unit]
Description=Generate NetworkManager connection profile from kioskbrowser.ini
Before=NetworkManager.service
[Service]
Type=oneshot
ExecStart=/usr/bin/kiosk-wifi
[Install]
WantedBy=multi-user.target

View File

@ -1,22 +0,0 @@
#!/usr/bin/env php
<?php
if ($argc != 4 && $argc != 5)
{
error_log("Usage: get-ini FILE SECTION NAME [DEFAULT]");
error_log("Fetches a single configuration item from an ini file");
exit(1);
}
$config = parse_ini_file($argv[1], true, INI_SCANNER_NORMAL);
if (isset($config[$argv[2]]))
{
if (isset($config[$argv[2]][$argv[3]]))
{
echo $config[$argv[2]][$argv[3]];
exit(0);
}
}
echo $argv[4] ?? "";
exit(1);

View File

@ -1,50 +0,0 @@
#!/bin/bash
set -e
echo "Generating NetworkManager connection profile..."
WIFI_SSID=$(get-ini /boot/kioskbrowser.ini wifi ssid)
WIFI_PSK=$(get-ini /boot/kioskbrowser.ini wifi psk)
if [ -z "${WIFI_SSID}" ]; then
echo "No WiFi SSID configured. Exiting."
exit 0
fi
# The profile will be written to /tmp and symlinked from /etc
PROFILE_NAME="kiosk"
PROFILE_PATH="/tmp/${PROFILE_NAME}.nmconnection"
# Generate a UUID for the connection
UUID=$(uuidgen)
# Create the NetworkManager connection file
cat > "${PROFILE_PATH}" << EOF
[connection]
id=${PROFILE_NAME}
uuid=${UUID}
type=wifi
interface-name=wlan0
autoconnect=true
[wifi]
mode=infrastructure
ssid=${WIFI_SSID}
[wifi-security]
auth-alg=open
key-mgmt=wpa-psk
psk=${WIFI_PSK}
[ipv4]
method=auto
[ipv6]
method=auto
EOF
# Set the correct permissions
chmod 600 "${PROFILE_PATH}"
chown root:root "${PROFILE_PATH}"
echo "Successfully created connection profile at ${PROFILE_PATH}."