dcwifi: Update component versions
[feed/packages.git] / net / dcwapd / files / dcwapd.init.d
diff --git a/net/dcwapd/files/dcwapd.init.d b/net/dcwapd/files/dcwapd.init.d
new file mode 100755 (executable)
index 0000000..6f6a48f
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/sh /etc/rc.common
+
+START=99
+# Setting the stop value makes the restart script unreliable when invoked by LuCI
+#STOP=0
+
+scriptdir=/etc/dcwapd
+
+#validate_section_dcwapd() {
+#      uci_validate_section dcwapd general "${1}" \
+#              'enabled:bool:1'
+#}
+
+start() {
+#      validate_section_dcwapd dcwapd
+
+       # only run the start script if the enabled uci option is set properly
+       enabled=$(uci get dcwapd.general.enabled)
+       if [ "${enabled}" = "1" ]; then
+               ${scriptdir}/start_dcwapd.sh
+       else
+               echo "dcwapd is disabled in UCI"
+               return 1
+       fi
+}
+
+stop() {
+        ${scriptdir}/stop_dcwapd.sh
+       # Add a sleep after stopping because an immediate restat will fail otherwise
+       sleep 1
+}