From: Andrew Ruthven Date: Fri, 4 Jan 2019 22:28:21 +0000 (+1300) Subject: Clean up what files we create and how we handle them. X-Git-Tag: 1.0.0~19 X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d0791908cfb52bb69dadc578f6b8c38ceb1752bf;p=mythtv-status.git Clean up what files we create and how we handle them. Thanks for the tip from Göran Uddeborgthat I was double handlinga file. --- diff --git a/bin/mythtv-update-motd b/bin/mythtv-update-motd index 0e3d38c..e31d042 100755 --- a/bin/mythtv-update-motd +++ b/bin/mythtv-update-motd @@ -15,14 +15,21 @@ fi if [ -d /etc/update-motd.d ] then + # We want to generate file which only contains the MythTV Status + # as a snippet in /etc/update-motd.d will cat this file. + WORKFILE=/var/run/motd.mythtv-status TEMPFILE=${WORKFILE}.new else + # We are going to generate an motd file to be used for the system, + # with the previous content first, then the MythTV Status. + # Debian Wheezy+ handles the MOTD differently. [ -f /var/run/motd.dynamic ] && WORKFILE=/var/run/motd.dynamic # Just incase someone has removed their motd file. [ -f $WORKFILE ] || touch $WORKFILE + # Keep the original content around. [ -f /var/run/motd.orig ] || cp $WORKFILE /var/run/motd.orig # If the tempfile is less than 15 minutes old, object, otherwise @@ -36,9 +43,8 @@ else fi fi - [ ! -f /var/run/motd.orig ] && cp /var/run/motd /var/run/motd.orig - - cp /var/run/motd.orig /var/run/motd.new + # Have whatever the system motd contains before the MythTV content + cp /var/run/motd.orig $TEMPFILE fi