blob: 0af116f35cbd2bb785dbc052230190bc25df1ab3 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "Inittab configuration for SysVinit"
2LICENSE = "GPLv2"
Andrew Geissler90fd73c2021-03-05 15:25:55 -06003LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6"
Patrick Williamsc124f4f2015-09-15 14:41:29 -05004
5PR = "r10"
6
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05007SRC_URI = "file://inittab \
8 file://start_getty"
Patrick Williamsc124f4f2015-09-15 14:41:29 -05009
10S = "${WORKDIR}"
11
12INHIBIT_DEFAULT_DEPS = "1"
13
14do_compile() {
15 :
16}
17
18do_install() {
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050019 install -d ${D}${sysconfdir}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050020 install -m 0644 ${WORKDIR}/inittab ${D}${sysconfdir}/inittab
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050021 install -d ${D}${base_bindir}
22 install -m 0755 ${WORKDIR}/start_getty ${D}${base_bindir}/start_getty
Brad Bishop19323692019-04-05 15:28:33 -040023 sed -e 's,/usr/bin,${bindir},g' -i ${D}${base_bindir}/start_getty
Patrick Williamsc124f4f2015-09-15 14:41:29 -050024
25 set -x
26 tmp="${SERIAL_CONSOLES}"
27 for i in $tmp
28 do
29 j=`echo ${i} | sed s/\;/\ /g`
Patrick Williamsc0f7c042017-02-23 20:41:17 -060030 l=`echo ${i} | sed -e 's/tty//' -e 's/^.*;//' -e 's/;.*//'`
31 label=`echo $l | sed 's/.*\(....\)/\1/'`
Brad Bishop6e60e8b2018-02-01 10:27:11 -050032 echo "$label:12345:respawn:${base_bindir}/start_getty ${j} vt102" >> ${D}${sysconfdir}/inittab
Patrick Williamsc124f4f2015-09-15 14:41:29 -050033 done
34
35 if [ "${USE_VT}" = "1" ]; then
36 cat <<EOF >>${D}${sysconfdir}/inittab
37# ${base_sbindir}/getty invocations for the runlevels.
38#
39# The "id" field MUST be the same as the last
40# characters of the device (after "tty").
41#
42# Format:
43# <id>:<runlevels>:<action>:<process>
44#
45
46EOF
47
48 for n in ${SYSVINIT_ENABLED_GETTYS}
49 do
50 echo "$n:12345:respawn:${base_sbindir}/getty 38400 tty$n" >> ${D}${sysconfdir}/inittab
51 done
52 echo "" >> ${D}${sysconfdir}/inittab
53 fi
54}
55
Andrew Geissler95ac1b82021-03-31 14:34:31 -050056do_install_append_qemuppc64 () {
57 echo "9:12345:respawn:${base_sbindir}/getty 38400 hvc0" >> ${D}${sysconfdir}/inittab
58}
59
Patrick Williamsc124f4f2015-09-15 14:41:29 -050060pkg_postinst_${PN} () {
Brad Bishop316dfdd2018-06-25 12:45:53 -040061# run this on host and on target
62if [ "${SERIAL_CONSOLES_CHECK}" = "" ]; then
63 exit 0
64fi
65}
66
67pkg_postinst_ontarget_${PN} () {
Patrick Williamsc124f4f2015-09-15 14:41:29 -050068# run this on the target
Brad Bishop316dfdd2018-06-25 12:45:53 -040069if [ -e /proc/consoles ]; then
Patrick Williamsc124f4f2015-09-15 14:41:29 -050070 tmp="${SERIAL_CONSOLES_CHECK}"
71 for i in $tmp
72 do
Patrick Williamsc0f7c042017-02-23 20:41:17 -060073 j=`echo ${i} | sed -e s/^.*\;//g -e s/\:.*//g`
74 k=`echo ${i} | sed s/^.*\://g`
Patrick Williamsc124f4f2015-09-15 14:41:29 -050075 if [ -z "`grep ${j} /proc/consoles`" ]; then
Patrick Williamsc0f7c042017-02-23 20:41:17 -060076 if [ -z "${k}" ] || [ -z "`grep ${k} /proc/consoles`" ] || [ ! -e /dev/${j} ]; then
Brad Bishop6e60e8b2018-02-01 10:27:11 -050077 sed -i -e /^.*${j}\ /d -e /^.*${j}$/d /etc/inittab
Patrick Williamsc0f7c042017-02-23 20:41:17 -060078 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -050079 fi
80 done
81 kill -HUP 1
82else
Brad Bishop316dfdd2018-06-25 12:45:53 -040083 exit 1
Patrick Williamsc124f4f2015-09-15 14:41:29 -050084fi
85}
86
87# USE_VT and SERIAL_CONSOLES are generally defined by the MACHINE .conf.
88# Set PACKAGE_ARCH appropriately.
89PACKAGE_ARCH = "${MACHINE_ARCH}"
90
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050091FILES_${PN} = "${sysconfdir}/inittab ${base_bindir}/start_getty"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050092CONFFILES_${PN} = "${sysconfdir}/inittab"
93
94USE_VT ?= "1"
95SYSVINIT_ENABLED_GETTYS ?= "1"
96
Brad Bishop15ae2502019-06-18 21:44:24 -040097RCONFLICTS_${PN} = "busybox-inittab"