summaryrefslogtreecommitdiff
path: root/recipes-bsp/multitech/radio-reset_0.1.bb
blob: 65c6e09ab29e3264d624b8229afe45282ffe3e3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
DESCRIPTION = "Cellular radio reset init scripts"
HOMEPAGE = "http://www.multitech.net/"
SECTION = "base"
PRIORITY = "optional"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"

SRC_URI = " \
    file://radio-reset.init \
    file://radio-reset.default \
"

inherit update-rc.d

INITSCRIPT_NAME = "radio-reset"

# The script starts with runlevel of 40 (right after mts-io) in initlevel S (Single-user mode on boot),
# and stops with runlevel of 99 in initlevel 6 (reboot)
INITSCRIPT_PARAMS = "start 40 S . stop 99 6 ."

do_install() {
  install -d ${D}/etc/init.d
  install -m 0755 ${WORKDIR}/radio-reset.init ${D}/etc/init.d/radio-reset

  install -d ${D}${sysconfdir}/default
  install -m 0644 ${WORKDIR}/radio-reset.default ${D}${sysconfdir}/default/radio-reset
}

fakeroot do_install_append_mtr() {
    # enable radio-reset on start for the mtr hardware
    sed -i 's/ONSTART="no"/ONSTART="yes"/g' ${D}${sysconfdir}/default/radio-reset

    # disable radio-reset on shutdown for the mtr hardware
    sed -i 's/ONSTOP="yes"/ONSTOP="no"/g' ${D}${sysconfdir}/default/radio-reset
}

fakeroot do_install_append_mtrv1() {
    # enable radio-reset on start for the mtrv1 hardware
    sed -i 's/ONSTART="no"/ONSTART="yes"/g' ${D}${sysconfdir}/default/radio-reset

    # disable radio-reset on shutdown for the mtrv1 hardware
    sed -i 's/ONSTOP="yes"/ONSTOP="no"/g' ${D}${sysconfdir}/default/radio-reset
}

fakeroot do_install_append_mtcap() {
    # disable radio-reset both on start and on shutdown for the mtcap hardware
    # mtcap issues the radio reset in /etc/init.d/mts-io init script
    sed -i 's/ENABLED="yes"/ENABLED="no"/g' ${D}${sysconfdir}/default/radio-reset
}