From 2b0bab72a5ac2d8ca11454a04531ed6b9734cc7f Mon Sep 17 00:00:00 2001 From: Tom Rund <52415182+tomrund@users.noreply.github.com> Date: Sun, 24 Dec 2023 16:47:12 -0500 Subject: [PATCH] Suppress UX courtesy reminders on non-interactive shells (#804) --- setup/pi/setup-teslausb | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/setup/pi/setup-teslausb b/setup/pi/setup-teslausb index c6c691b9..504d50ba 100755 --- a/setup/pi/setup-teslausb +++ b/setup/pi/setup-teslausb @@ -918,11 +918,13 @@ sed -i '/source \/root\/bin\/setup-teslausb/d' /root/.bashrc if ! grep -q TESLAUSB_TIP1 /root/.bashrc then cat >> /root/.bashrc <<- EOC - cat << TESLAUSB_TIP1 - Run 'bin/setup-teslausb upgrade' to update to the latest version of teslausb, - or run 'bin/remountfs_rw' to allow writing to the root partition. + if [ -n "\$PS1" ]; then + cat << TESLAUSB_TIP1 + Run 'bin/setup-teslausb upgrade' to update to the latest version of teslausb, + or run 'bin/remountfs_rw' to allow writing to the root partition. - TESLAUSB_TIP1 + TESLAUSB_TIP1 + fi EOC fi @@ -932,10 +934,12 @@ then if ! grep -q TESLAUSB_TIP1 "/home/$DEFUSER/.bashrc" then cat >> "/home/$DEFUSER/.bashrc" <<- EOC - cat << TESLAUSB_TIP1 - Run 'sudo -i' if you need to make changes. + if [ -n "\$PS1" ]; then + cat << TESLAUSB_TIP1 + Run 'sudo -i' if you need to make changes. - TESLAUSB_TIP1 + TESLAUSB_TIP1 + fi EOC fi fi