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