updates for bookworm NetworkManager setup

This commit is contained in:
2026-03-10 10:03:15 -04:00
parent 926e7210bc
commit 7879d1dee0
4 changed files with 102 additions and 95 deletions

View File

@@ -9,37 +9,39 @@ then
exit 1
fi
source /etc/piwifiap.conf
newssidok=0
while [ "$newssidok" -ne 1 ]
do
echo -n "New SSID: "
read newssid
if [ "$newssid" = "" ]
then
echo "SSID cannot be blank. Try again or hit <ctrl>-c to abort."
else
newssidok=1
fi
done
if [ "$network_system" = "systemd-networkd" ]
then
sed -i "/ssid=.*/c ssid=$newssid" /etc/hostapd/hostapd.conf
systemctl restart hostapd
elif [ "$network_system" = "NetworkManager" ]
then
nmcli con down piwifi-ap
nmcli con mod piwifi-ap ssid "$newssid"
nmcli con up piwifi-ap
else
echo "Unable to determine what type of network configuration (systemd-networkd"
echo "or NetworkManager) your system uses."
echo "Cannot modify wireless access point parameters."
exit 2
fi
sed -i 's,'wapssid=.*','wapssid="\"$newssid\""',' /etc/piwifiap.conf
source /etc/piwifiap/piwifiap.conf
wapssidok="no"
while [[ "$wapssidok" == "no" ]]
do
echo "This access point will need an SSID. This is what will appear"
echo "as the name of this terminal when other devices connect."
echo -n "Please enter the desired SSID for this access point: "
read wapssid
if [[ "$wapssid" = "" ]]
then
echo "SSID cannot be blank. Try again."
else
wapssidok="yes"
fi
done
case "$network_system" in
"systemd-networkd")
sed -i "/ssid=.*/c ssid=$wapssid" /etc/hostapd/hostapd.conf
systemctl restart hostapd
sed -i 's|'wapssid=.*'|'wapssid="\'$wapssid\'"'|' /etc/piwifiap/piwifiap.conf
;;
"NetworkManager")
nmcli con down piwifi-hotspot
nmcli con mod piwifi-hotspot ssid "$wapssid"
nmcli con up piwifi-hotspot passwd-file /etc/piwifiap/piwifiap.secret
sed -i 's|'wapssid=.*'|'wapssid="\'$wapssid\'"'|' /etc/piwifiap/piwifiap.conf
;;
*)
echo "Unable to determine what type of network configuration (systemd-networkd"
echo "or NetworkManager) your system uses."
echo "Cannot modify wireless access point parameters."
exit 2
;;
esac