Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Paul Eggleton <paul.eggleton@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 4/5] shadow-securetty: change to handle SERIAL_CONSOLES
Date: Tue, 30 Apr 2013 17:53:00 +0100	[thread overview]
Message-ID: <548c556a1a41ec6f24ea765273f52cbeb5f9c5c7.1367340369.git.paul.eggleton@linux.intel.com> (raw)
In-Reply-To: <cover.1367340369.git.paul.eggleton@linux.intel.com>
In-Reply-To: <cover.1367340369.git.paul.eggleton@linux.intel.com>

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@linux.intel.com>
---
 .../shadow/shadow-securetty_4.1.4.3.bb               | 20 +++++++++++++-------
 1 file 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 
 }
-- 
1.8.1.2




  parent reply	other threads:[~2013-04-30 17:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-30 16:52 [PATCH 0/5] SERIAL_CONSOLES improvements Paul Eggleton
2013-04-30 16:52 ` [PATCH 1/5] sysvinit-inittab: ensure unique label for SERIAL_CONSOLES entries Paul Eggleton
2013-04-30 16:52 ` [PATCH 2/5] bitbake.conf: set SERIAL_CONSOLES from SERIAL_CONSOLE by default Paul Eggleton
2013-04-30 21:42   ` Khem Raj
2013-05-01  6:51     ` Paul Eggleton
2013-05-01 17:07       ` Khem Raj
2013-04-30 16:52 ` [PATCH 3/5] sysvinit-inittab: remove specific handling of SERIAL_CONSOLE Paul Eggleton
2013-04-30 16:53 ` Paul Eggleton [this message]
2013-04-30 16:53 ` [PATCH 5/5] systemd-serialgetty: change to handle SERIAL_CONSOLES Paul Eggleton
2013-05-01  7:14 ` [PATCH 0/5] SERIAL_CONSOLES improvements Koen Kooi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=548c556a1a41ec6f24ea765273f52cbeb5f9c5c7.1367340369.git.paul.eggleton@linux.intel.com \
    --to=paul.eggleton@linux.intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox