mirror of
https://github.com/optim-enterprises-bv/meta-openwrt.git
synced 2026-01-07 16:11:55 +00:00
procd: Generate a correct inittab based on MACHINE
We need the right serial ports and virtual consoles, so grab the sysvinit-inittab recipe and modify it appropriately. Closes https://github.com/kraj/meta-openwrt/issues/34 and Closes https://github.com/kraj/meta-openwrt/issues/23 Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
This commit is contained in:
committed by
Khem Raj
parent
b06dd0a6c4
commit
de202ca869
83
recipes-core/procd/procd-inittab.bb
Normal file
83
recipes-core/procd/procd-inittab.bb
Normal file
@@ -0,0 +1,83 @@
|
||||
SUMMARY = "Inittab configuration for procd"
|
||||
LICENSE = "GPLv2"
|
||||
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
|
||||
|
||||
SRC_URI = "file://inittab \
|
||||
"
|
||||
|
||||
inherit update-alternatives
|
||||
|
||||
S = "${WORKDIR}"
|
||||
|
||||
INHIBIT_DEFAULT_DEPS = "1"
|
||||
|
||||
do_compile() {
|
||||
:
|
||||
}
|
||||
|
||||
PROCD_ENABLED_TTYS ?= "${SYSVINIT_ENABLED_GETTYS}"
|
||||
|
||||
do_install() {
|
||||
install -d ${D}${sysconfdir}
|
||||
install -m 0644 ${WORKDIR}/inittab ${D}${sysconfdir}/inittab
|
||||
|
||||
set -x
|
||||
tmp="${SERIAL_CONSOLES}"
|
||||
for i in $tmp
|
||||
do
|
||||
j=`echo ${i} | sed s/\;/\ /g`
|
||||
l=`echo ${i} | sed -e 's/^.*;//' -e 's/;.*//'`
|
||||
echo "$l::askfirst:/usr/libexec/login.sh" >> ${D}${sysconfdir}/inittab
|
||||
done
|
||||
|
||||
if [ "${USE_VT}" = "1" ]; then
|
||||
for n in ${PROCD_ENABLED_TTYS}
|
||||
do
|
||||
echo "tty$n::askfirst:/usr/libexec/login.sh" >> ${D}${sysconfdir}/inittab
|
||||
done
|
||||
echo "" >> ${D}${sysconfdir}/inittab
|
||||
fi
|
||||
|
||||
if [ -z "${SERIAL_CONSOLES}" ] && [ "${USE_VT}" != "1" ]; then
|
||||
echo "::askconsole:/usr/libexec.sh/login.sh" >> ${D}${sysconfdir}/inittab
|
||||
echo "" >${D}${sysconfdir}/inittab
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_postinst_${PN} () {
|
||||
# run this on the target
|
||||
if [ "x$D" = "x" ] && [ -e /proc/consoles ]; then
|
||||
tmp="${SERIAL_CONSOLES_CHECK}"
|
||||
for i in $tmp
|
||||
do
|
||||
j=`echo ${i} | sed -e s/^.*\;//g -e s/\:.*//g`
|
||||
k=`echo ${i} | sed s/^.*\://g`
|
||||
if [ -z "`grep ${j} /proc/consoles`" ]; then
|
||||
if [ -z "${k}" ] || [ -z "`grep ${k} /proc/consoles`" ] || [ ! -e /dev/${j} ]; then
|
||||
sed -i -e /^.*${j}\ /d -e /^.*${j}$/d /etc/inittab
|
||||
fi
|
||||
fi
|
||||
done
|
||||
kill -HUP 1
|
||||
else
|
||||
if [ "${SERIAL_CONSOLES_CHECK}" = "" ]; then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
ALTERNATIVE_PRIORITY = "200"
|
||||
ALTERNATIVE_${PN} = "inittab"
|
||||
ALTERNATIVE_TARGET[inittab] = "${sysconfdir}/inittab"
|
||||
|
||||
# USE_VT and SERIAL_CONSOLES are generally defined by the MACHINE .conf.
|
||||
# Set PACKAGE_ARCH appropriately.
|
||||
PACKAGE_ARCH = "${MACHINE_ARCH}"
|
||||
|
||||
FILES_${PN} = "${sysconfdir}/inittab*"
|
||||
CONFFILES_${PN} = "${sysconfdir}/inittab"
|
||||
|
||||
USE_VT ?= "1"
|
||||
SYSVINIT_ENABLED_GETTYS ?= "1"
|
||||
2
recipes-core/procd/procd-inittab/inittab
Normal file
2
recipes-core/procd/procd-inittab/inittab
Normal file
@@ -0,0 +1,2 @@
|
||||
::sysinit:/etc/init.d/rcS S boot
|
||||
::shutdown:/etc/init.d/rcS K shutdown
|
||||
@@ -8,7 +8,7 @@ LIC_FILES_CHKSUM = "file://procd.c;beginline=1;endline=13;md5=61e3657604f131a859
|
||||
SECTION = "base"
|
||||
DEPENDS = "libubox ubus json-c"
|
||||
|
||||
RDEPENDS_${PN} += " fstools base-files-scripts-openwrt"
|
||||
RDEPENDS_${PN} += " fstools base-files-scripts-openwrt ${PN}-inittab"
|
||||
|
||||
# NB: Is both VIRTUAL-RUNTIME-init_manager and VIRTUAL_RUNTIME-dev_manager (like systemd/systemd-udev)
|
||||
|
||||
@@ -52,8 +52,6 @@ do_install_append() {
|
||||
install -Dm 0755 ${BF}/etc/init.d/done ${D}${sysconfdir}/init.d/done
|
||||
install -Dm 0755 ${BF}/etc/init.d/sysctl ${D}${sysconfdir}/init.d/sysctl
|
||||
install -Dm 0755 ${BF}/etc/init.d/umount ${D}${sysconfdir}/init.d/umount
|
||||
# FIXME: Serial ports need to reflect actual machine
|
||||
install -Dm 0644 ${BF}/etc/inittab ${D}${sysconfdir}/inittab
|
||||
install -Dm 0755 ${BF}/usr/libexec/login.sh ${D}/usr/libexec/login.sh
|
||||
install -dm 0755 ${D}/rc.d
|
||||
# FIXME: Need to split openwrt base-files 'boot' script so that
|
||||
@@ -86,13 +84,11 @@ do_install_append() {
|
||||
|
||||
FILES_${PN} = "/"
|
||||
|
||||
ALTERNATIVE_${PN} = "init inittab"
|
||||
ALTERNATIVE_${PN} = "init"
|
||||
|
||||
ALTERNATIVE_PRIORITY = "40"
|
||||
|
||||
ALTERNATIVE_LINK_NAME[init] = "${base_sbindir}/init"
|
||||
|
||||
ALTERNATIVE_LINK_NAME[inittab] = "${sysconfdir}/inittab"
|
||||
ALTERNATIVE_TARGET[init] = "${base_sbindir}/init"
|
||||
|
||||
python () {
|
||||
if not bb.utils.contains('DISTRO_FEATURES', 'procd', True, False, d):
|
||||
|
||||
Reference in New Issue
Block a user