Files
PiWifiAP/apsetup/usr/local/bin/wap-enable

30 lines
685 B
Bash

#!/bin/bash
# Enable PiWifiAP wireless access point
current_user=`whoami`
if [ "$current_user" != "root" ]
then
echo "You must have root privileges to run this setup."
echo "Try 'sudo $0'"
exit 1
fi
source /etc/piwifiap/piwifiap.conf
case "$network_system" in
"systemd-networkd")
systemctl enable hostapd
systemctl start hostapd
;;
"NetworkManager")
nmcli con mod piwifi-hotspot autoconnect yes
nmcli con up piwifi-hotspot passwd-file /etc/piwifiap/piwifiap.secret
;;
*)
echo "Unable to determine what type of network configuration (systemd-networkd"
echo "or NetworkManager) your system uses."
echo "Cannot enable wireless access point."
exit 2
;;
esac