[oe-commits] Paul Eggleton : shadow-securetty: change to handle SERIAL_CONSOLES

git at git.openembedded.org git at git.openembedded.org
Thu May 2 16:38:11 UTC 2013


Module: openembedded-core.git
Branch: master
Commit: 013a1e304e6845eda97b94d133ad75bbccff0b9a
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=013a1e304e6845eda97b94d133ad75bbccff0b9a

Author: Paul Eggleton <paul.eggleton at linux.intel.com>
Date:   Tue Apr 30 15:32:06 2013 +0100

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.

Signed-off-by: Paul Eggleton <paul.eggleton at linux.intel.com>
Signed-off-by: Saul Wold <sgw at linux.intel.com>

---

 .../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 86b5c89..4a1f79f 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"
 
 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}"
 
 do_install () {
 	# Ensure we add a suitable securetty file to the package that has
 	# most common embedded TTYs defined.
-	if [ ! -z "${SERIAL_CONSOLE}" ]; then
-		# Our SERIAL_CONSOLE contains a baud rate and sometimes a -L
-		# option as well. The following pearl :) takes that and converts
+	install -d ${D}${sysconfdir}
+	install -m 0400 ${WORKDIR}/securetty ${D}${sysconfdir}/securetty
+	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
 		# securetty. So if a machine has a weird looking console device
 		# node (e.g. ttyAMA0) that securetty does not know, it will get
 		# appended to securetty and root logins will be allowed on that
 		# 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
-	install -d ${D}${sysconfdir}
-	install -m 0400 ${WORKDIR}/securetty ${D}${sysconfdir}/securetty 
 }





More information about the Openembedded-commits mailing list