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 | |
| 7 | SRC_URI = "file://inittab" |
| 8 | |
| 9 | S = "${WORKDIR}" |
| 10 | |
| 11 | INHIBIT_DEFAULT_DEPS = "1" |
| 12 | |
| 13 | do_compile() { |
| 14 | : |
| 15 | } |
| 16 | |
| 17 | do_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 | |
| 41 | EOF |
| 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 | |
| 51 | pkg_postinst_${PN} () { |
| 52 | # run this on the target |
| 53 | if [ "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 |
| 63 | else |
| 64 | if [ "${SERIAL_CONSOLES_CHECK}" = "" ]; then |
| 65 | exit 0 |
| 66 | else |
| 67 | exit 1 |
| 68 | fi |
| 69 | fi |
| 70 | } |
| 71 | |
| 72 | # USE_VT and SERIAL_CONSOLES are generally defined by the MACHINE .conf. |
| 73 | # Set PACKAGE_ARCH appropriately. |
| 74 | PACKAGE_ARCH = "${MACHINE_ARCH}" |
| 75 | |
| 76 | FILES_${PN} = "${sysconfdir}/inittab" |
| 77 | CONFFILES_${PN} = "${sysconfdir}/inittab" |
| 78 | |
| 79 | USE_VT ?= "1" |
| 80 | SYSVINIT_ENABLED_GETTYS ?= "1" |
| 81 | |
| 82 | |
| 83 | |