Renewing on router shell scripts for the phone app.
[lede.git] / vigilia_setup / register / version_3 / change_default_pw.sh
diff --git a/vigilia_setup/register/version_3/change_default_pw.sh b/vigilia_setup/register/version_3/change_default_pw.sh
new file mode 100644 (file)
index 0000000..67c1c61
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+# Print usage
+if [ "$#" -eq 0 ] || [ "$1" == "-h" ]; then
+       echo "This is a simple script that change the pre-shared key of a router"
+       echo "using UCI command change password written in /etc/config/wireless"
+       echo ""
+       echo "Usage:"
+       echo "  ./change_default_pw.sh [-h]"
+       echo "  ./change_default_pw.sh [-ch <specific_password>]"
+       echo ""
+       echo "Options:"
+       echo "  -h      show this usage"
+       echo "  -ch     change default into a specific password"
+       echo ""
+
+elif [ "$1" == "-ch" ]; then
+       # Change the wireless.key option in the config file.
+       PW=$2
+       uci set wireless.default_radio0.key=$PW
+       uci set wireless.default_radio1.key=$PW
+       uci commit
+       /sbin/wifi
+
+else
+       echo "Unknown option. Please run ./change_default_pw.sh -h for usage."
+fi
+
+