another fix

This commit is contained in:
Karl 2025-07-22 10:29:28 +01:00
parent 249327a8cc
commit d9d8fb3d5a
2 changed files with 11 additions and 5 deletions

View File

@ -60,6 +60,8 @@ 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

View File

@ -11,13 +11,17 @@ if [ -z "${WIFI_SSID}" ]; then
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 > "/etc/NetworkManager/system-connections/${WIFI_SSID}.nmconnection" << EOF
cat > "${PROFILE_PATH}" << EOF
[connection]
id=${WIFI_SSID}
id=${PROFILE_NAME}
uuid=${UUID}
type=wifi
interface-name=wlan0
@ -40,7 +44,7 @@ method=auto
EOF
# Set the correct permissions
chmod 600 "/etc/NetworkManager/system-connections/${WIFI_SSID}.nmconnection"
chown root:root "/etc/NetworkManager/system-connections/${WIFI_SSID}.nmconnection"
chmod 600 "${PROFILE_PATH}"
chown root:root "${PROFILE_PATH}"
echo "Successfully created connection profile for ${WIFI_SSID}."
echo "Successfully created connection profile at ${PROFILE_PATH}."