summaryrefslogtreecommitdiff
path: root/recipes-bsp/multitech
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2018-05-14 18:33:13 -0500
committerJohn Klug <john.klug@multitech.com>2018-05-14 18:33:13 -0500
commitd89ab03409d531d21a791108367ae68d0a1f22a0 (patch)
tree218da6346f5094973d86de3c9674b231712bc55c /recipes-bsp/multitech
parent6a3d1658a46efea65217cf948207f355a78989d6 (diff)
downloadmeta-multitech-d89ab03409d531d21a791108367ae68d0a1f22a0.tar.gz
meta-multitech-d89ab03409d531d21a791108367ae68d0a1f22a0.tar.bz2
meta-multitech-d89ab03409d531d21a791108367ae68d0a1f22a0.zip
Have radio-reset install at boot. New package mts-io-radio
Diffstat (limited to 'recipes-bsp/multitech')
-rw-r--r--recipes-bsp/multitech/mts-io.inc69
1 files changed, 63 insertions, 6 deletions
diff --git a/recipes-bsp/multitech/mts-io.inc b/recipes-bsp/multitech/mts-io.inc
index 5c9d129..d6384a4 100644
--- a/recipes-bsp/multitech/mts-io.inc
+++ b/recipes-bsp/multitech/mts-io.inc
@@ -45,16 +45,29 @@ do_compile () {
oe_runmake
}
-PACKAGES = "${PN}-noarch kernel-module-${PN} ${PN}-util ${PN}-util-dbg ${PN}-dev"
+
+# Note that the opkg post install does not work if the radio-reset package is
+# named mts-io-radio-reset. It may be too long for the opkg name to handle.
+PACKAGES = "${PN}-noarch kernel-module-${PN} ${PN}-util ${PN}-util-dbg ${PN}-dev ${PN}-radio"
FILES_kernel-module-${PN} = "${base_libdir}/modules/${KERNEL_VERSION}/extra/mts_io.ko"
-FILES_${PN}-noarch = "${sysconfdir}"
+
+FILES_${PN}-noarch = "${sysconfdir}/init.d/mts-io \
+ ${sysconfdir}/rc5.d/S95led-status_heartbeat_trigger \
+ ${sysconfdir}/default/mts-io \
+ ${sysconfdir}/init.d/led-status_heartbeat_trigger"
+
+
FILES_${PN}-noarch += "${libdir}/mts-io-sysfs*"
FILES_${PN}-noarch += "${sbindir}/mts-io-sysfs"
FILES_${PN}-noarch_append_mtcap += "${sbindir}/lora-led-updater"
FILES_${PN}-util += "${sbindir}/mts-util-lora2-reset"
FILES_${PN}-util-dbg += "/usr/src /usr/sbin/.debug"
FILES_${PN}-dev += "/usr/include/linux/mts_eeprom.h"
+FILES_${PN}-radio = "${sysconfdir}/init.d/radio-reset \
+ ${sysconfdir}/default/radio-reset"
+RRECOMMENDS_${PN}-radio = "update-rc.d"
+
INITSCRIPT_NAME = "mts-io"
INITSCRIPT_PARAMS = "start 39 S ."
@@ -79,10 +92,6 @@ fakeroot do_install () {
install -d ${D}${sysconfdir}/default
install -m 0755 ${WORKDIR}/mts-io.conf ${D}${sysconfdir}/default/mts-io
- # run radio-reset on reboot
- install -d ${D}${sysconfdir}/rc6.d
- ln -sf ${sysconfdir}/init.d/radio-reset ${D}/${sysconfdir}/rc6.d/S30radio-reset
-
# blink status LED after booted
install -d ${D}${sysconfdir}/rc5.d
ln -sf ${sysconfdir}/init.d/led-status_heartbeat_trigger ${D}/${sysconfdir}/rc5.d/S95led-status_heartbeat_trigger
@@ -108,3 +117,51 @@ fakeroot do_install_append_mtcdt() {
sed -i 's/STOP="no"/STOP="yes"/' ${D}${sysconfdir}/default/radio-reset
}
+# Install the radio reset. Not allowed two init script in one recipe.
+pkg_postinst_${PN}-radio() {
+#!/bin/sh
+# Begin section update-rc.d
+logger -t opkg.install.radio -p daemon.info 'radio preinstall'
+if type update-rc.d >/dev/null 2>/dev/null; then
+ if [ -n "$D" ]; then
+ OPT="-r $D"
+ else
+ OPT="-s"
+ fi
+ update-rc.d $OPT radio-reset start 39 S .
+fi
+# End section update-rc.d
+}
+
+pkg_preinst_${PN}-radio() {
+ #!/bin/bash
+ if type update-rc.d >/dev/null 2>/dev/null; then
+ if [ -n "$D" ]; then
+ OPT="-f -r $D"
+ else
+ OPT="-f"
+ fi
+ update-rc.d $OPT radio-reset remove
+ fi
+}
+
+pkg_prerm_${PN}-radio() {
+ #!/bin/bash
+ if [ -z "$D" ] ; then
+ logger -t opkg.remove.radio -p daemon.info 'Removing radio-reset'
+ fi
+}
+
+
+pkg_postrm_${PN}-radio() {
+ #!/bin/bash
+ if type update-rc.d >/dev/null 2>/dev/null; then
+ if [ -n "$D" ]; then
+ OPT="-f -r $D"
+ else
+ OPT="-f"
+ fi
+ update-rc.d $OPT radio-reset remove
+ fi
+}
+