From 1d672143d0e4f1546b4536ad9f1069be5ba63dee Mon Sep 17 00:00:00 2001 From: Andrew Ruthven Date: Tue, 1 Aug 2023 00:43:01 +1200 Subject: [PATCH] Allow to always run interactively --- ChangeLog | 6 +++++- bin/mythtv-update-motd | 17 +++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index f3f09dc..ac3615d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2023-08-01 Andrew Ruthven + If mythtv-update-motd is run via interactive shell, always try to run, + regardless of the flags. + 2023-07-27 Andrew Ruthven Install the systemd files into the UsrMerge location so we'll work with more distributions, thanks to Göran Uddeborgfor pointing this out. @@ -6,7 +10,7 @@ our hooks for those. 2023-07-27 Göran Uddebor - Install update-update-motd + Install mythtv-update-motd Use a default for $HOST in all scripts. diff --git a/bin/mythtv-update-motd b/bin/mythtv-update-motd index a7174eb..9f4cc5b 100755 --- a/bin/mythtv-update-motd +++ b/bin/mythtv-update-motd @@ -18,9 +18,17 @@ NAME=mythtv-update-motd # Support the old RUN variable [ "$UPDATE_MOTD" = "" ] && UPDATE_MOTD=$RUN -if [ "$UPDATE_MOTD" != "yes" ] || [ -f /var/lib/mythtv-status/motd_update_disabled ] +# Test for an interactive shell (in bash $- will include i, for dash we need +# to check to see if FD 0 is connected), if we are interactive always try to +# update the MOTD. +if [ "$-" = "*i*" ] || [ -t 0 ] then - exit + echo Going to update the MOTD for the MythTV status +else + if [ "$UPDATE_MOTD" != "yes" ] || [ -f /var/lib/mythtv-status/motd_update_disabled ] + then + exit + fi fi WORKFILE=/run/motd @@ -96,6 +104,11 @@ else exit 1 fi +if [ "$-" = "*i*" ] || [ -t 0 ] +then + echo Updated the MOTD +fi + # Local Variables: # sh-basic-offset: 2 # End: -- 2.30.2