summaryrefslogtreecommitdiff
path: root/recipes-connectivity/hostapd/files/WiFi-SSID
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-connectivity/hostapd/files/WiFi-SSID')
-rw-r--r--recipes-connectivity/hostapd/files/WiFi-SSID27
1 files changed, 27 insertions, 0 deletions
diff --git a/recipes-connectivity/hostapd/files/WiFi-SSID b/recipes-connectivity/hostapd/files/WiFi-SSID
new file mode 100644
index 0000000..e5d22ee
--- /dev/null
+++ b/recipes-connectivity/hostapd/files/WiFi-SSID
@@ -0,0 +1,27 @@
+diff -Naru orig/etc/init.d/hostapd new/etc/init.d/hostapd
+--- orig/etc/init.d/hostapd 2020-08-18 10:03:13.687093151 -0500
++++ new/etc/init.d/hostapd 2020-08-18 10:05:30.095090777 -0500
+@@ -2,7 +2,12 @@
+ DAEMON=/usr/sbin/hostapd
+ NAME=hostapd
+ DESC="HOSTAP Daemon"
+-ARGS="/etc/hostapd.conf -B"
++CONFIG=/var/config/hostapd.conf
++ARGS="${CONFIG} -B"
++
++DEVID=$(mts-io-sysfs show device-id)
++HOSTNAME=$(uname -n)
++SSID="${HOSTNAME}-${DEVID}"
+
+ test -f $DAEMON || exit 0
+
+@@ -35,6 +40,9 @@
+ if [[ -n $PREUP ]] ; then
+ bash -c "$PREUP"
+ fi
++ if ! grep -q "^ssid=${SSID}$" ${CONFIG} ; then
++ sed -i "s/^ssid=.*/ssid=${SSID}/" ${CONFIG}
++ fi
+ echo -n "Starting $DESC: "
+ start-stop-daemon -S -x $DAEMON -- $ARGS
+ if [[ -n $POSTUP ]] ; then