diff mbox

[2/2] board/raspberrypi/post-build.sh: only tweak /etc/inittab if available

Message ID 1472205140-739-2-git-send-email-peter@korsgaard.com
State Accepted
Headers show

Commit Message

Peter Korsgaard Aug. 26, 2016, 9:52 a.m. UTC
As pointed out in bug #9161, we don't always have an inittab file (if
systemd or no init is used), so the post build script should only try to
tweak it if present.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
---
 board/raspberrypi/post-build.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/board/raspberrypi/post-build.sh b/board/raspberrypi/post-build.sh
index 7eae14a..5e5eb71 100755
--- a/board/raspberrypi/post-build.sh
+++ b/board/raspberrypi/post-build.sh
@@ -4,6 +4,8 @@  set -u
 set -e
 
 # Add a console on tty1
-grep -qE '^tty1::' ${TARGET_DIR}/etc/inittab || \
-sed -i '/GENERIC_SERIAL/a\
+if [ -e ${TARGET_DIR}/etc/inittab ]; then
+    grep -qE '^tty1::' ${TARGET_DIR}/etc/inittab || \
+	sed -i '/GENERIC_SERIAL/a\
 tty1::respawn:/sbin/getty -L  tty1 0 vt100 # HDMI console' ${TARGET_DIR}/etc/inittab
+fi