summaryrefslogtreecommitdiff
path: root/recipes-bsp/multitech/mts-io-sysfs/mts-io-sysfs.init
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-bsp/multitech/mts-io-sysfs/mts-io-sysfs.init')
-rwxr-xr-xrecipes-bsp/multitech/mts-io-sysfs/mts-io-sysfs.init50
1 files changed, 50 insertions, 0 deletions
diff --git a/recipes-bsp/multitech/mts-io-sysfs/mts-io-sysfs.init b/recipes-bsp/multitech/mts-io-sysfs/mts-io-sysfs.init
new file mode 100755
index 0000000..3af4f71
--- /dev/null
+++ b/recipes-bsp/multitech/mts-io-sysfs/mts-io-sysfs.init
@@ -0,0 +1,50 @@
+#! /bin/bash
+
+### BEGIN INIT INFO
+# Provides: eeprom-config
+# Required-Start: mts-io
+# Default-Start: 2 3 4 5
+# Default-Stop:
+# Short-Description: Create /run/config with eeprom configuration
+### END INIT INFO
+
+GETCONFIG=/usr/sbin/mts-io-sysfs
+JSONFILE=/run/config/device_info.json
+
+case "$1" in
+ start)
+ if ! [[ -f ${JSONFILE} ]] ; then
+ [[ -d /run/config ]] || mkdir -m 755 -p /run/config
+ if [[ -x ${GETCONFIG} ]] ; then
+ ${GETCONFIG} init -t1 # Radio might not be found yet.
+ fi
+ fi
+ ;;
+ stop)
+ ;;
+ force-reload)
+ rm -rf /run/config/*
+ ${GETCONFIG} init
+ ;;
+ restart)
+ ${GETCONFIG} init
+ ;;
+ reload)
+ ${GETCONFIG} init
+ ;;
+ status)
+ if [[ -f ${JSONFILE} ]] ; then
+ echo EEPROM Config is populated
+ exit 0
+ else
+ echo EEPROM Config is not populated
+ exit 3
+ fi
+ ;;
+ *)
+ echo "Usage: ntpd { start | stop | status | restart | reload | force-reload }" >&2
+ exit 1
+ ;;
+esac
+
+exit 0