sysvinit & initscripts: use update-rc.d

Update-rc.d provides a cleaner interface for creating links for init scripts.
So we use update-rc.d to replace the redundant 'ln -sf xxx' statements.

[YOCTO #3708]

(From OE-Core rev: 66f3e3c15faedc9ee78532b4c59fa5d7148ddace)

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Chen Qi
2013-01-22 15:02:42 +08:00
committed by Richard Purdie
parent 77eaad86d1
commit 43c2c5b426
2 changed files with 32 additions and 40 deletions

View File

@@ -37,6 +37,7 @@ SRC_URI_append_arm = " file://alignment.sh"
KERNEL_VERSION = ""
inherit update-alternatives
DEPENDS_append = " update-rc.d-native"
ALTERNATIVE_PRIORITY = "90"
ALTERNATIVE_${PN} = "functions"
@@ -64,6 +65,8 @@ do_install () {
install -d ${D}${sysconfdir}/rc6.d
install -d ${D}${sysconfdir}/default
install -d ${D}${sysconfdir}/default/volatiles
# Holds state information pertaining to urandom
install -d ${D}/var/lib/urandom
install -m 0644 ${WORKDIR}/functions ${D}${sysconfdir}/init.d
install -m 0755 ${WORKDIR}/bootmisc.sh ${D}${sysconfdir}/init.d
@@ -84,6 +87,7 @@ do_install () {
install -m 0755 ${WORKDIR}/populate-volatile.sh ${D}${sysconfdir}/init.d
install -m 0755 ${WORKDIR}/save-rtc.sh ${D}${sysconfdir}/init.d
install -m 0644 ${WORKDIR}/volatiles ${D}${sysconfdir}/default/volatiles/00_core
if [ "${TARGET_ARCH}" = "arm" ]; then
install -m 0755 ${WORKDIR}/alignment.sh ${D}${sysconfdir}/init.d
fi
@@ -92,44 +96,29 @@ do_install () {
#
install -m 0755 ${WORKDIR}/banner.sh ${D}${sysconfdir}/init.d/banner.sh
install -m 0755 ${WORKDIR}/umountfs ${D}${sysconfdir}/init.d/umountfs
install -m 0755 ${WORKDIR}/device_table.txt ${D}${sysconfdir}/device_table
#
# Create runlevel links
#
ln -sf ../init.d/rmnologin.sh ${D}${sysconfdir}/rc2.d/S99rmnologin.sh
ln -sf ../init.d/rmnologin.sh ${D}${sysconfdir}/rc3.d/S99rmnologin.sh
ln -sf ../init.d/rmnologin.sh ${D}${sysconfdir}/rc4.d/S99rmnologin.sh
ln -sf ../init.d/rmnologin.sh ${D}${sysconfdir}/rc5.d/S99rmnologin.sh
ln -sf ../init.d/sendsigs ${D}${sysconfdir}/rc6.d/S20sendsigs
# ln -sf ../init.d/urandom ${D}${sysconfdir}/rc6.d/S30urandom
ln -sf ../init.d/umountnfs.sh ${D}${sysconfdir}/rc6.d/S31umountnfs.sh
ln -sf ../init.d/umountfs ${D}${sysconfdir}/rc6.d/S40umountfs
# udev will run at S55 if installed
ln -sf ../init.d/reboot ${D}${sysconfdir}/rc6.d/S90reboot
ln -sf ../init.d/sendsigs ${D}${sysconfdir}/rc0.d/S20sendsigs
# ln -sf ../init.d/urandom ${D}${sysconfdir}/rc0.d/S30urandom
ln -sf ../init.d/umountnfs.sh ${D}${sysconfdir}/rc0.d/S31umountnfs.sh
ln -sf ../init.d/umountfs ${D}${sysconfdir}/rc0.d/S40umountfs
# udev will run at S55 if installed
ln -sf ../init.d/halt ${D}${sysconfdir}/rc0.d/S90halt
ln -sf ../init.d/save-rtc.sh ${D}${sysconfdir}/rc0.d/S25save-rtc.sh
ln -sf ../init.d/save-rtc.sh ${D}${sysconfdir}/rc6.d/S25save-rtc.sh
ln -sf ../init.d/banner.sh ${D}${sysconfdir}/rcS.d/S02banner.sh
ln -sf ../init.d/checkroot.sh ${D}${sysconfdir}/rcS.d/S10checkroot.sh
# ln -sf ../init.d/checkfs.sh ${D}${sysconfdir}/rcS.d/S30checkfs.sh
ln -sf ../init.d/mountall.sh ${D}${sysconfdir}/rcS.d/S35mountall.sh
ln -sf ../init.d/hostname.sh ${D}${sysconfdir}/rcS.d/S39hostname.sh
ln -sf ../init.d/mountnfs.sh ${D}${sysconfdir}/rcS.d/S45mountnfs.sh
ln -sf ../init.d/bootmisc.sh ${D}${sysconfdir}/rcS.d/S55bootmisc.sh
# ln -sf ../init.d/urandom ${D}${sysconfdir}/rcS.d/S55urandom
ln -sf ../init.d/sysfs.sh ${D}${sysconfdir}/rcS.d/S02sysfs.sh
# udev will run at S03 if installed
ln -sf ../init.d/populate-volatile.sh ${D}${sysconfdir}/rcS.d/S37populate-volatile.sh
ln -sf ../init.d/devpts.sh ${D}${sysconfdir}/rcS.d/S38devpts.sh
update-rc.d -r ${D} rmnologin.sh start 99 2 3 4 5 .
update-rc.d -r ${D} sendsigs start 20 0 6 .
update-rc.d -r ${D} urandom start 30 S 0 6 .
update-rc.d -r ${D} umountnfs.sh start 31 0 6 .
update-rc.d -r ${D} umountfs start 40 0 6 .
update-rc.d -r ${D} reboot start 90 6 .
update-rc.d -r ${D} halt start 90 0 .
update-rc.d -r ${D} save-rtc.sh start 25 0 6 .
update-rc.d -r ${D} banner.sh start 02 S .
update-rc.d -r ${D} checkroot.sh start 10 S .
update-rc.d -r ${D} mountall.sh start 35 S .
update-rc.d -r ${D} hostname.sh start 39 S .
update-rc.d -r ${D} mountnfs.sh start 45 S .
update-rc.d -r ${D} bootmisc.sh start 55 S .
update-rc.d -r ${D} sysfs.sh start 02 S .
update-rc.d -r ${D} populate-volatile.sh start 37 S .
update-rc.d -r ${D} devpts.sh start 38 S .
if [ "${TARGET_ARCH}" = "arm" ]; then
ln -sf ../init.d/alignment.sh ${D}${sysconfdir}/rcS.d/S06alignment.sh
update-rc.d -r ${D} alignment.sh start 06 S .
fi
install -m 0755 ${WORKDIR}/device_table.txt ${D}${sysconfdir}/device_table
# Holds state information pertaining to urandom
install -d ${D}/var/lib/urandom
}