blob: 8781492d472faf352d925463f3b50e62cb3377b0 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "Inittab configuration for SysVinit"
2LICENSE = "GPLv2"
3LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
4
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
56pkg_postinst_${PN} () {
Brad Bishop316dfdd2018-06-25 12:45:53 -040057# run this on host and on target
58if [ "${SERIAL_CONSOLES_CHECK}" = "" ]; then
59 exit 0
60fi
61}
62
63pkg_postinst_ontarget_${PN} () {
Patrick Williamsc124f4f2015-09-15 14:41:29 -050064# run this on the target
Brad Bishop316dfdd2018-06-25 12:45:53 -040065if [ -e /proc/consoles ]; then
Patrick Williamsc124f4f2015-09-15 14:41:29 -050066 tmp="${SERIAL_CONSOLES_CHECK}"
67 for i in $tmp
68 do
Patrick Williamsc0f7c042017-02-23 20:41:17 -060069 j=`echo ${i} | sed -e s/^.*\;//g -e s/\:.*//g`
70 k=`echo ${i} | sed s/^.*\://g`
Patrick Williamsc124f4f2015-09-15 14:41:29 -050071 if [ -z "`grep ${j} /proc/consoles`" ]; then
Patrick Williamsc0f7c042017-02-23 20:41:17 -060072 if [ -z "${k}" ] || [ -z "`grep ${k} /proc/consoles`" ] || [ ! -e /dev/${j} ]; then
Brad Bishop6e60e8b2018-02-01 10:27:11 -050073 sed -i -e /^.*${j}\ /d -e /^.*${j}$/d /etc/inittab
Patrick Williamsc0f7c042017-02-23 20:41:17 -060074 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -050075 fi
76 done
77 kill -HUP 1
78else
Brad Bishop316dfdd2018-06-25 12:45:53 -040079 exit 1
Patrick Williamsc124f4f2015-09-15 14:41:29 -050080fi
81}
82
83# USE_VT and SERIAL_CONSOLES are generally defined by the MACHINE .conf.
84# Set PACKAGE_ARCH appropriately.
85PACKAGE_ARCH = "${MACHINE_ARCH}"
86
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050087FILES_${PN} = "${sysconfdir}/inittab ${base_bindir}/start_getty"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050088CONFFILES_${PN} = "${sysconfdir}/inittab"
89
90USE_VT ?= "1"
91SYSVINIT_ENABLED_GETTYS ?= "1"
92
Brad Bishop15ae2502019-06-18 21:44:24 -040093RCONFLICTS_${PN} = "busybox-inittab"