Skip to contentSkip to conversation

systemd-serialgetty: Replace sed quoting using ' with " to allow var expansion

PATCH New Geoff Parker 1 participant 1 message Sep 12, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 systemd-serialgetty: Replace sed quoting using ' with " to allow var expansion

From: Geoff Parker <[email protected]>

A recent commit added single quotes around the sed regex's. This prevented the expansion of $default_baudrate in do_install(), and ended up with systemd's' [email protected] file having a literal $default_baudrate.

This broke the serial console getty service.

[email protected] was getting a line which looked like this:

ExecStart=-/sbin/agetty -8 -L %I $default_baudrate $TERM

Rather than:

ExecStart=-/sbin/agetty -8 -L %I 115200 $TERM

Fixed by repacing the single quotes with double quotes in the sed expressions.

---
 meta/recipes-core/systemd/systemd-serialgetty.bb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta/recipes-core/systemd/systemd-serialgetty.bb +2 -2
index 059fccc2b6..0cc0dc8c79 100644
@@ -21,7 +21,7 @@ do_install() {
 		install -d ${D}${systemd_unitdir}/system/
 		install -d ${D}${sysconfdir}/systemd/system/getty.target.wants/
 		install -m 0644 ${WORKDIR}/[email protected] ${D}${systemd_unitdir}/system/
-		sed -i -e 's/\@BAUDRATE\@/$default_baudrate/g' ${D}${systemd_unitdir}/system/[email protected]
+		sed -i -e "s/\@BAUDRATE\@/$default_baudrate/g" ${D}${systemd_unitdir}/system/[email protected]
 
 		tmp="${SERIAL_CONSOLES}"
 		for entry in $tmp ; do
@@ -34,7 +34,7 @@ do_install() {
 			else
 				# install custom service file for the non-default baudrate
 				install -m 0644 ${WORKDIR}/[email protected] ${D}${systemd_unitdir}/system/[email protected]
-				sed -i -e s/\@BAUDRATE\@/$baudrate/g ${D}${systemd_unitdir}/system/[email protected]
+				sed -i -e "s/\@BAUDRATE\@/$baudrate/g" ${D}${systemd_unitdir}/system/[email protected]
 				# enable the service
 				ln -sf ${systemd_unitdir}/system/[email protected] \
 					${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty$baudrate@$ttydev.service
Signature · 1 line
2.20.1