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` |
| 29 | label=`echo ${i} | sed -e 's/tty//' -e 's/^.*;//' -e 's/;.*//'` |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame^] | 30 | echo "$label:12345:respawn:${base_bindir}/start_getty ${j}" >> ${D}${sysconfdir}/inittab |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 31 | done |
| 32 | |
| 33 | if [ "${USE_VT}" = "1" ]; then |
| 34 | cat <<EOF >>${D}${sysconfdir}/inittab |
| 35 | # ${base_sbindir}/getty invocations for the runlevels. |
| 36 | # |
| 37 | # The "id" field MUST be the same as the last |
| 38 | # characters of the device (after "tty"). |
| 39 | # |
| 40 | # Format: |
| 41 | # <id>:<runlevels>:<action>:<process> |
| 42 | # |
| 43 | |
| 44 | EOF |
| 45 | |
| 46 | for n in ${SYSVINIT_ENABLED_GETTYS} |
| 47 | do |
| 48 | echo "$n:12345:respawn:${base_sbindir}/getty 38400 tty$n" >> ${D}${sysconfdir}/inittab |
| 49 | done |
| 50 | echo "" >> ${D}${sysconfdir}/inittab |
| 51 | fi |
| 52 | } |
| 53 | |
| 54 | pkg_postinst_${PN} () { |
| 55 | # run this on the target |
| 56 | if [ "x$D" = "x" ] && [ -e /proc/consoles ]; then |
| 57 | tmp="${SERIAL_CONSOLES_CHECK}" |
| 58 | for i in $tmp |
| 59 | do |
| 60 | j=`echo ${i} | sed s/^.*\;//g` |
| 61 | if [ -z "`grep ${j} /proc/consoles`" ]; then |
| 62 | sed -i /^.*${j}$/d /etc/inittab |
| 63 | fi |
| 64 | done |
| 65 | kill -HUP 1 |
| 66 | else |
| 67 | if [ "${SERIAL_CONSOLES_CHECK}" = "" ]; then |
| 68 | exit 0 |
| 69 | else |
| 70 | exit 1 |
| 71 | fi |
| 72 | fi |
| 73 | } |
| 74 | |
| 75 | # USE_VT and SERIAL_CONSOLES are generally defined by the MACHINE .conf. |
| 76 | # Set PACKAGE_ARCH appropriately. |
| 77 | PACKAGE_ARCH = "${MACHINE_ARCH}" |
| 78 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame^] | 79 | FILES_${PN} = "${sysconfdir}/inittab ${base_bindir}/start_getty" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 80 | CONFFILES_${PN} = "${sysconfdir}/inittab" |
| 81 | |
| 82 | USE_VT ?= "1" |
| 83 | SYSVINIT_ENABLED_GETTYS ?= "1" |
| 84 | |
| 85 | |
| 86 | |