Skip to content

Commit

Permalink
custom-rc.d: Call custom startup scripts during boot.
Browse files Browse the repository at this point in the history
When custom-rc.d is installed, if the files /data/rcS.local or /data/rc.local
exists, they will be called early (rcS) and late (rc) during startup. These
scripts will survive upgrades and can be used by customers to start their own
custom software.
  • Loading branch information
izak authored and Jeroen Hofstee committed Oct 16, 2017
1 parent f7fac01 commit 2dbd16c
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
38 changes: 38 additions & 0 deletions meta-venus/recipes-core/custom-rc.d/custom-rc.d.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
SUMMARY = "Call user-defined scripts at startup, if they exist"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"

INHIBIT_DEFAULT_DEPS = "1"

SRC_URI = " \
file://custom-rc-early.sh \
file://custom-rc-late.sh \
"

S = "${WORKDIR}"

inherit allarch
inherit update-rc.d

INITSCRIPT_PACKAGES = "${PN}-early ${PN}-late"
INITSCRIPT_NAME_${PN}-early = "custom-rc-early.sh"
INITSCRIPT_PARAMS_${PN}-early = "start 99 S ."
INITSCRIPT_NAME_${PN}-late = "custom-rc-late.sh"
INITSCRIPT_PARAMS_${PN}-late = "start 99 5 ."

PACKAGES =+ "${PN}-early ${PN}-late"

FILES_${PN}-early = "/etc/init.d/custom-rc-early.sh"
FILES_${PN}-late = "/etc/init.d/custom-rc-late.sh"

RDEPENDS_${PN} += "${PN}-early ${PN}-late"
ALLOW_EMPTY_${PN} = "1"

do_install () {
install -d ${D}${sysconfdir}/rcS.d
install -d ${D}${sysconfdir}/rc5.d
install -d ${D}${sysconfdir}/init.d

install -m 0755 ${WORKDIR}/custom-rc-early.sh ${D}${sysconfdir}/init.d/custom-rc-early.sh
install -m 0755 ${WORKDIR}/custom-rc-late.sh ${D}${sysconfdir}/init.d/custom-rc-late.sh
}
6 changes: 6 additions & 0 deletions meta-venus/recipes-core/custom-rc.d/files/custom-rc-early.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
if test -x /data/rcS.local; then
/data/rcS.local
fi

exit 0
5 changes: 5 additions & 0 deletions meta-venus/recipes-core/custom-rc.d/files/custom-rc-late.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
if test -x /data/rc.local; then
/data/rc.local
fi
exit 0

0 comments on commit 2dbd16c

Please sign in to comment.