Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | SUMMARY = "Inittab configuration for SysVinit" |
| 2 | LICENSE = "GPLv2" |
| 3 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" |
| 4 | |
| 5 | PR = "r10" |
| 6 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 7 | SRC_URI = "file://inittab \ |
| 8 | file://start_getty" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 9 | |
| 10 | S = "${WORKDIR}" |
| 11 | |
| 12 | INHIBIT_DEFAULT_DEPS = "1" |
| 13 | |
| 14 | do_compile() { |
| 15 | : |
| 16 | } |
| 17 | |
| 18 | do_install() { |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 19 | install -d ${D}${sysconfdir} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 20 | install -m 0644 ${WORKDIR}/inittab ${D}${sysconfdir}/inittab |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 21 | install -d ${D}${base_bindir} |
| 22 | install -m 0755 ${WORKDIR}/start_getty ${D}${base_bindir}/start_getty |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 23 | |
| 24 | set -x |
| 25 | tmp="${SERIAL_CONSOLES}" |
| 26 | for i in $tmp |
| 27 | do |
| 28 | j=`echo ${i} | sed s/\;/\ /g` |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 29 | l=`echo ${i} | sed -e 's/tty//' -e 's/^.*;//' -e 's/;.*//'` |
| 30 | label=`echo $l | sed 's/.*\(....\)/\1/'` |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 31 | echo "$label:12345:respawn:${base_bindir}/start_getty ${j} vt102" >> ${D}${sysconfdir}/inittab |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 32 | done |
| 33 | |
| 34 | if [ "${USE_VT}" = "1" ]; then |
| 35 | cat <<EOF >>${D}${sysconfdir}/inittab |
| 36 | # ${base_sbindir}/getty invocations for the runlevels. |
| 37 | # |
| 38 | # The "id" field MUST be the same as the last |
| 39 | # characters of the device (after "tty"). |
| 40 | # |
| 41 | # Format: |
| 42 | # <id>:<runlevels>:<action>:<process> |
| 43 | # |
| 44 | |
| 45 | EOF |
| 46 | |
| 47 | for n in ${SYSVINIT_ENABLED_GETTYS} |
| 48 | do |
| 49 | echo "$n:12345:respawn:${base_sbindir}/getty 38400 tty$n" >> ${D}${sysconfdir}/inittab |
| 50 | done |
| 51 | echo "" >> ${D}${sysconfdir}/inittab |
| 52 | fi |
| 53 | } |
| 54 | |
| 55 | pkg_postinst_${PN} () { |
| 56 | # run this on the target |
| 57 | if [ "x$D" = "x" ] && [ -e /proc/consoles ]; then |
| 58 | tmp="${SERIAL_CONSOLES_CHECK}" |
| 59 | for i in $tmp |
| 60 | do |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 61 | j=`echo ${i} | sed -e s/^.*\;//g -e s/\:.*//g` |
| 62 | k=`echo ${i} | sed s/^.*\://g` |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 63 | if [ -z "`grep ${j} /proc/consoles`" ]; then |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 64 | if [ -z "${k}" ] || [ -z "`grep ${k} /proc/consoles`" ] || [ ! -e /dev/${j} ]; then |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 65 | sed -i -e /^.*${j}\ /d -e /^.*${j}$/d /etc/inittab |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 66 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 67 | fi |
| 68 | done |
| 69 | kill -HUP 1 |
| 70 | else |
| 71 | if [ "${SERIAL_CONSOLES_CHECK}" = "" ]; then |
| 72 | exit 0 |
| 73 | else |
| 74 | exit 1 |
| 75 | fi |
| 76 | fi |
| 77 | } |
| 78 | |
| 79 | # USE_VT and SERIAL_CONSOLES are generally defined by the MACHINE .conf. |
| 80 | # Set PACKAGE_ARCH appropriately. |
| 81 | PACKAGE_ARCH = "${MACHINE_ARCH}" |
| 82 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 83 | FILES_${PN} = "${sysconfdir}/inittab ${base_bindir}/start_getty" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 84 | CONFFILES_${PN} = "${sysconfdir}/inittab" |
| 85 | |
| 86 | USE_VT ?= "1" |
| 87 | SYSVINIT_ENABLED_GETTYS ?= "1" |
| 88 | |
| 89 | |
| 90 | |