Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | SUMMARY = "Provider of the machine specific securetty file" |
| 2 | SECTION = "base utils" |
| 3 | LICENSE = "MIT" |
| 4 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" |
| 5 | |
| 6 | INHIBIT_DEFAULT_DEPS = "1" |
| 7 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 8 | |
| 9 | SRC_URI = "file://securetty" |
| 10 | |
| 11 | S = "${WORKDIR}" |
| 12 | |
| 13 | # Since SERIAL_CONSOLES is likely to be set from the machine configuration |
| 14 | PACKAGE_ARCH = "${MACHINE_ARCH}" |
| 15 | |
| 16 | do_install () { |
| 17 | # Ensure we add a suitable securetty file to the package that has |
| 18 | # most common embedded TTYs defined. |
| 19 | install -d ${D}${sysconfdir} |
| 20 | install -m 0400 ${WORKDIR}/securetty ${D}${sysconfdir}/securetty |
| 21 | if [ ! -z "${SERIAL_CONSOLES}" ]; then |
| 22 | # Our SERIAL_CONSOLES contains a baud rate and sometimes extra |
| 23 | # options as well. The following pearl :) takes that and converts |
| 24 | # it into newline-separated tty's and appends them into |
| 25 | # securetty. So if a machine has a weird looking console device |
| 26 | # node (e.g. ttyAMA0) that securetty does not know, it will get |
| 27 | # appended to securetty and root logins will be allowed on that |
| 28 | # console. |
| 29 | tmp="${SERIAL_CONSOLES}" |
| 30 | for entry in $tmp ; do |
| 31 | ttydev=`echo "$entry" | sed -e 's/^[0-9]*\;//' -e 's/\;.*//'` |
| 32 | if ! grep -q $ttydev ${D}${sysconfdir}/securetty; then |
| 33 | echo $ttydev >> ${D}${sysconfdir}/securetty |
| 34 | fi |
| 35 | done |
| 36 | fi |
| 37 | } |