Scriptet fungerer ved å endre en config-fil ved neste boot - den tar ikke effekt før du har boota ruteren en gang til ; altså - denne configen skriver en ny config :-)
#!/bin/sh
#
# Using 4 last digits of serialnumber for creating unique SSIDs
variable=$(status sys)
echo $variable >> /status.txt
NAME=$(awk ' /Serial/ {print substr($9,length($9)-3,4)} ' /status.txt)
SSID="WIFI_AP_SSID=LEICA_$NAME"
sed -i "s/WIFI_AP_SSID=/$SSID/g" /etc/settings.wifi_ap
sed -i "s|WIFI_AP_ENABLED=0|WIFI_AP_ENABLED=1|g" /etc/settings.wifi_ap
# Cleanup
# Remove the script itself after first and only run
cat /etc/defaults/rc.d/rc.local > /etc/rc.d/rc.local
# Remove temporary file
rm /status.txt
********************************************
#!/bin/sh
#
# Using 4 last digits of epoch time to create unique SSIDs
timestr=$(date +%s | tail -c 5)
SSID="WIFI_AP_SSID=LEICA_$timestr"
sed -i "s/WIFI_AP_SSID=/$SSID/g" /etc/settings.wifi_ap
sed -i "s|WIFI_AP_ENABLED=0|WIFI_AP_ENABLED=1|g" /etc/settings.wifi_ap
# Cleanup
# Remove the script itself after first and only run
cat /etc/defaults/rc.d/rc.local > /etc/rc.d/rc.local