From: Andrew Ruthven Date: Mon, 31 Jul 2023 12:43:01 +0000 (+1200) Subject: Allow to always run interactively X-Git-Tag: 1.2.0~12 X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1d672143d0e4f1546b4536ad9f1069be5ba63dee;p=mythtv-status.git Allow to always run interactively --- 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: