Last active
January 29, 2016 18:38
-
-
Save andersevenrud/556670c7702c5fcaa04c to your computer and use it in GitHub Desktop.
setboardconfig.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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