blob: 49b1326a26d9b25ade276b3eb196c5d357fcb70f [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
7SRC_URI = "file://inittab"
8
9S = "${WORKDIR}"
10
11INHIBIT_DEFAULT_DEPS = "1"
12
13do_compile() {
14 :
15}
16
17do_install() {
18 install -d ${D}${sysconfdir}
19 install -m 0644 ${WORKDIR}/inittab ${D}${sysconfdir}/inittab
20
21 set -x
22 tmp="${SERIAL_CONSOLES}"
23 for i in $tmp
24 do
25 j=`echo ${i} | sed s/\;/\ /g`
26 label=`echo ${i} | sed -e 's/tty//' -e 's/^.*;//' -e 's/;.*//'`
27 echo "$label:12345:respawn:${base_sbindir}/getty -L ${j}" >> ${D}${sysconfdir}/inittab
28 done
29
30 if [ "${USE_VT}" = "1" ]; then
31 cat <<EOF >>${D}${sysconfdir}/inittab
32# ${base_sbindir}/getty invocations for the runlevels.
33#
34# The "id" field MUST be the same as the last
35# characters of the device (after "tty").
36#
37# Format:
38# <id>:<runlevels>:<action>:<process>
39#
40
41EOF
42
43 for n in ${SYSVINIT_ENABLED_GETTYS}
44 do
45 echo "$n:12345:respawn:${base_sbindir}/getty 38400 tty$n" >> ${D}${sysconfdir}/inittab
46 done
47 echo "" >> ${D}${sysconfdir}/inittab
48 fi
49}
50
51pkg_postinst_${PN} () {
52# run this on the target
53if [ "x$D" = "x" ] && [ -e /proc/consoles ]; then
54 tmp="${SERIAL_CONSOLES_CHECK}"
55 for i in $tmp
56 do
57 j=`echo ${i} | sed s/^.*\;//g`
58 if [ -z "`grep ${j} /proc/consoles`" ]; then
59 sed -i /^.*${j}$/d /etc/inittab
60 fi
61 done
62 kill -HUP 1
63else
64 if [ "${SERIAL_CONSOLES_CHECK}" = "" ]; then
65 exit 0
66 else
67 exit 1
68 fi
69fi
70}
71
72# USE_VT and SERIAL_CONSOLES are generally defined by the MACHINE .conf.
73# Set PACKAGE_ARCH appropriately.
74PACKAGE_ARCH = "${MACHINE_ARCH}"
75
76FILES_${PN} = "${sysconfdir}/inittab"
77CONFFILES_${PN} = "${sysconfdir}/inittab"
78
79USE_VT ?= "1"
80SYSVINIT_ENABLED_GETTYS ?= "1"
81
82
83