diff options
-rw-r--r-- | meta/recipes-extended/shadow/shadow-securetty_4.1.4.3.bb | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/meta/recipes-extended/shadow/shadow-securetty_4.1.4.3.bb b/meta/recipes-extended/shadow/shadow-securetty_4.1.4.3.bb index 86b5c8978a..4a1f79f8e5 100644 --- a/meta/recipes-extended/shadow/shadow-securetty_4.1.4.3.bb +++ b/meta/recipes-extended/shadow/shadow-securetty_4.1.4.3.bb | |||
@@ -10,22 +10,28 @@ PR = "r2" | |||
10 | 10 | ||
11 | SRC_URI = "file://securetty" | 11 | SRC_URI = "file://securetty" |
12 | 12 | ||
13 | # Since we deduce our arch from ${SERIAL_CONSOLE} | 13 | # Since SERIAL_CONSOLES is likely to be set from the machine configuration |
14 | PACKAGE_ARCH = "${MACHINE_ARCH}" | 14 | PACKAGE_ARCH = "${MACHINE_ARCH}" |
15 | 15 | ||
16 | do_install () { | 16 | do_install () { |
17 | # Ensure we add a suitable securetty file to the package that has | 17 | # Ensure we add a suitable securetty file to the package that has |
18 | # most common embedded TTYs defined. | 18 | # most common embedded TTYs defined. |
19 | if [ ! -z "${SERIAL_CONSOLE}" ]; then | 19 | install -d ${D}${sysconfdir} |
20 | # Our SERIAL_CONSOLE contains a baud rate and sometimes a -L | 20 | install -m 0400 ${WORKDIR}/securetty ${D}${sysconfdir}/securetty |
21 | # option as well. The following pearl :) takes that and converts | 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 | ||
22 | # it into newline-separated tty's and appends them into | 24 | # it into newline-separated tty's and appends them into |
23 | # securetty. So if a machine has a weird looking console device | 25 | # securetty. So if a machine has a weird looking console device |
24 | # node (e.g. ttyAMA0) that securetty does not know, it will get | 26 | # node (e.g. ttyAMA0) that securetty does not know, it will get |
25 | # appended to securetty and root logins will be allowed on that | 27 | # appended to securetty and root logins will be allowed on that |
26 | # console. | 28 | # console. |
27 | echo "${SERIAL_CONSOLE}" | sed -e 's/[0-9][0-9]\|\-L//g'|tr "[ ]" "[\n]" >> ${WORKDIR}/securetty | 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 | ||
28 | fi | 36 | fi |
29 | install -d ${D}${sysconfdir} | ||
30 | install -m 0400 ${WORKDIR}/securetty ${D}${sysconfdir}/securetty | ||
31 | } | 37 | } |