From: Andrew Ruthven <andrew@etc.gen.nz>
Date: Mon, 31 Jul 2023 12:57:57 +0000 (+1200)
Subject: Support the Fedora config file location in more scripts
X-Git-Tag: 1.2.0~10
X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6f73da7b015aed538de35df5f469986549253274;p=mythtv-status.git

Support the Fedora config file location in more scripts
---

diff --git a/ChangeLog b/ChangeLog
index 23b85ca..f2190c4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,9 @@
 
   Provide, hopefully sane, defaults in health-check.
 
+  Support the Fedora config file for: health-check, mythtv_recording_now,
+  mythtv_recording_soon (not just mythtv-update-motd).
+
 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.
diff --git a/bin/health-check b/bin/health-check
index bbcda10..6361457 100755
--- a/bin/health-check
+++ b/bin/health-check
@@ -8,7 +8,10 @@
 #
 # Run mythtv-status to perform a health check of the MythTV system.
 
-. /etc/default/mythtv-status
+# Debian style
+[ -r /etc/default/mythtv-status ]   && . /etc/default/mythtv-status
+# Fedora style
+[ -r /etc/sysconfig/mythtv-status ] && . /etc/sysconfig/mythtv-status
 
 if [ "$EMAIL" = "none" ]
 then
diff --git a/bin/mythtv-update-motd b/bin/mythtv-update-motd
index 9f4cc5b..be0042b 100755
--- a/bin/mythtv-update-motd
+++ b/bin/mythtv-update-motd
@@ -11,7 +11,7 @@
 NAME=mythtv-update-motd
 
 # Debian style
-[ -r /etc/default/mythtv-status ] && . /etc/default/mythtv-status
+[ -r /etc/default/mythtv-status ]   && . /etc/default/mythtv-status
 # Fedora style
 [ -r /etc/sysconfig/mythtv-status ] && . /etc/sysconfig/mythtv-status
 
diff --git a/bin/mythtv_recording_now b/bin/mythtv_recording_now
index 331c4ea..62368a7 100755
--- a/bin/mythtv_recording_now
+++ b/bin/mythtv_recording_now
@@ -9,11 +9,11 @@
 # Return an exit code of 0 if the MythTV backend is currently recording
 # a show.
 
-# Where Debian stores the config info.
-if [ -f /etc/default/mythtv-status ]
-then
-  . /etc/default/mythtv-status
-fi
+# Debian style
+[ -r /etc/default/mythtv-status ]   && . /etc/default/mythtv-status
+# Fedora style
+[ -r /etc/sysconfig/mythtv-status ] && . /etc/sysconfig/mythtv-status
+
 
 /usr/bin/mythtv-status -h "${HOST:-localhost}" --return-code-only --recording-now
 
diff --git a/bin/mythtv_recording_soon b/bin/mythtv_recording_soon
index e4d1467..65d1c6a 100755
--- a/bin/mythtv_recording_soon
+++ b/bin/mythtv_recording_soon
@@ -9,11 +9,10 @@
 # Return an exit code of 0 if the MythTV backend is currently recording
 # a show or will be recording a show soon (in the next hour).
 
-# Where Debian stores the config info.
-if [ -f /etc/default/mythtv-status ]
-then
-  . /etc/default/mythtv-status
-fi
+# Debian style
+[ -r /etc/default/mythtv-status ]   && . /etc/default/mythtv-status
+# Fedora style
+[ -r /etc/sysconfig/mythtv-status ] && . /etc/sysconfig/mythtv-status
 
 if [ "x$1" != "x" ]
 then