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