shadow-securetty: change to handle SERIAL_CONSOLES
SERIAL_CONSOLES is now set from SERIAL_CONSOLE if not already set. This change also installs the file before modifying it in place, allowing do_install to re-execute properly. (From OE-Core rev: 013a1e304e6845eda97b94d133ad75bbccff0b9a) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
c58cfcefce
commit
4ea0449039
|
@ -10,22 +10,28 @@ PR = "r2"
|
||||||
|
|
||||||
SRC_URI = "file://securetty"
|
SRC_URI = "file://securetty"
|
||||||
|
|
||||||
# Since we deduce our arch from ${SERIAL_CONSOLE}
|
# Since SERIAL_CONSOLES is likely to be set from the machine configuration
|
||||||
PACKAGE_ARCH = "${MACHINE_ARCH}"
|
PACKAGE_ARCH = "${MACHINE_ARCH}"
|
||||||
|
|
||||||
do_install () {
|
do_install () {
|
||||||
# Ensure we add a suitable securetty file to the package that has
|
# Ensure we add a suitable securetty file to the package that has
|
||||||
# most common embedded TTYs defined.
|
# most common embedded TTYs defined.
|
||||||
if [ ! -z "${SERIAL_CONSOLE}" ]; then
|
install -d ${D}${sysconfdir}
|
||||||
# Our SERIAL_CONSOLE contains a baud rate and sometimes a -L
|
install -m 0400 ${WORKDIR}/securetty ${D}${sysconfdir}/securetty
|
||||||
# option as well. The following pearl :) takes that and converts
|
if [ ! -z "${SERIAL_CONSOLES}" ]; then
|
||||||
|
# Our SERIAL_CONSOLES contains a baud rate and sometimes extra
|
||||||
|
# options as well. The following pearl :) takes that and converts
|
||||||
# it into newline-separated tty's and appends them into
|
# it into newline-separated tty's and appends them into
|
||||||
# securetty. So if a machine has a weird looking console device
|
# securetty. So if a machine has a weird looking console device
|
||||||
# node (e.g. ttyAMA0) that securetty does not know, it will get
|
# node (e.g. ttyAMA0) that securetty does not know, it will get
|
||||||
# appended to securetty and root logins will be allowed on that
|
# appended to securetty and root logins will be allowed on that
|
||||||
# console.
|
# console.
|
||||||
echo "${SERIAL_CONSOLE}" | sed -e 's/[0-9][0-9]\|\-L//g'|tr "[ ]" "[\n]" >> ${WORKDIR}/securetty
|
tmp="${SERIAL_CONSOLES}"
|
||||||
|
for entry in $tmp ; do
|
||||||
|
ttydev=`echo "$entry" | sed -e 's/^[0-9]*\;//' -e 's/\;.*//'`
|
||||||
|
if ! grep -q $ttydev ${D}${sysconfdir}/securetty; then
|
||||||
|
echo $ttydev >> ${D}${sysconfdir}/securetty
|
||||||
|
fi
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
install -d ${D}${sysconfdir}
|
|
||||||
install -m 0400 ${WORKDIR}/securetty ${D}${sysconfdir}/securetty
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue