Skip to content

Instantly share code, notes, and snippets.

@andersevenrud
Last active January 29, 2016 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andersevenrud/556670c7702c5fcaa04c to your computer and use it in GitHub Desktop.
Save andersevenrud/556670c7702c5fcaa04c to your computer and use it in GitHub Desktop.
setboardconfig.sh
#!/bin/sh
# Extract arguments
while echo $1 | grep -q ^-; do
eval $( echo $1 | sed 's/^-//' )=$2
shift
shift
done
#
# SYSTEM SETTINGS
#
if [ -n "$password" ]; then
# TODO
fi
if [ -n "$hostname" ]; then
# TODO
fi
if [ -n "$timezone" ]; then
# TODO
fi
#
# WIFI SETTINGS
#
wifiwasset=false
if [ -n "$wifipassword" ]; then
/sbin/uci set wireless.@wifi-iface[0].key="$wifipassword"
wifiwasset=true
fi
if [ -n "$wifissid" ]; then
/sbin/uci set wireless.@wifi-iface[0].ssid="$wifissid"
wifiwasset=true
fi
if [ -n "$wifiencryption" ]; then
/sbin/uci set wireless.@wifi-iface[0].encryption="$wifiencryption"
wifiwasset=true
fi
if [ "$wifiwasset" = true ]; then
/sbin/uci set wireless.@wifi-iface[0].mode=sta
/sbin/uci set network.lan=interface
/sbin/uci set network.lan.proto=dhcp
/sbin/uci delete network.lan.ipaddr
/sbin/uci delete network.lan.netmask
/sbin/uci commit network
/sbin/uci commit wireless
/sbin/wifi
/etc/init.d/network reload
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment