From 55632f1d78ed103a90374e22cb822cd893d28836 Mon Sep 17 00:00:00 2001 From: Andrew Ruthven Date: Fri, 11 Jan 2019 23:37:00 +1300 Subject: [PATCH] Rename ARGS to UPDATE_MOTD_ARGS and RUN to UPDATE_MOTD --- bin/mythtv-update-motd | 4 ++-- bin/mythtv_recording_soon | 6 +++--- debian/changelog | 2 ++ debian/config | 9 ++++++++- debian/init.d | 8 ++++---- debian/postinst | 32 ++++++++++++++++++++++---------- man/mythtv-update-motd.1 | 6 +++++- 7 files changed, 46 insertions(+), 21 deletions(-) diff --git a/bin/mythtv-update-motd b/bin/mythtv-update-motd index e31d042..6b33ef2 100755 --- a/bin/mythtv-update-motd +++ b/bin/mythtv-update-motd @@ -8,7 +8,7 @@ TEMPFILE=/var/run/motd.mythtv-status . /etc/default/mythtv-status -if [ x$RUN != xyes -o -f /var/lib/mythtv-status/motd_update_disabled ] +if [ x$UPDATE_MOTD != xyes -o -f /var/lib/mythtv-status/motd_update_disabled ] then exit fi @@ -49,7 +49,7 @@ fi ret=0 -mythtv-status $ARGS -h $HOST >> $TEMPFILE || ret=$? +mythtv-status $UPDATE_MOTD_ARGS -h $HOST >> $TEMPFILE || ret=$? if [ $ret -eq 0 -o $ret -eq 1 ]; then if [ ! -f $TEMPFILE ]; then echo My temporary file has gone away, failed. diff --git a/bin/mythtv_recording_soon b/bin/mythtv_recording_soon index b8e8507..8743be3 100755 --- a/bin/mythtv_recording_soon +++ b/bin/mythtv_recording_soon @@ -17,13 +17,13 @@ fi if [ "x$1" != "x" ] then - ARGS="--recording-in-warn $1" + UPDATE_MOTD_ARGS="--recording-in-warn $1" else - ARGS="--recording-in-warn 600" + UPDATE_MOTD_ARGS="--recording-in-warn 600" fi /usr/bin/mythtv-status -h ${HOST:=localhost} --return-code-only \ - --recording-now --next-recording $ARGS + --recording-now --next-recording $UPDATE_MOTD_ARGS if [ $? -eq 1 ] then diff --git a/debian/changelog b/debian/changelog index 5318854..44747b7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,8 @@ mythtv-status (1.0.0-1) UNRELEASED; urgency=medium * Install a snippet into /etc/update-motd.d (Closes: #902684). * Update standards version to 4.3.0. * Ship a systemd service file (Closes: #772801) + * Rename RUN and ARGS in /etc/default/mythtv-status to be more + specific, since this file is used by a couple of different scripts. -- Andrew Ruthven Mon, 31 Dec 2018 21:58:47 +1300 diff --git a/debian/config b/debian/config index 8c5ff3d..817ce98 100644 --- a/debian/config +++ b/debian/config @@ -14,7 +14,14 @@ if [ -e $CONFIGFILE ]; then # Store values from config file into # debconf db. - db_set $PACKAGE/enable $RUN + if [ "x$RUN" != "x" ] + then + db_set $PACKAGE/enable $RUN + fi + if [ "x$UPDATE_MOTD" != "x" ] + then + db_set $PACKAGE/enable $UPDATE_MOTD + fi db_set $PACKAGE/host $HOST db_set $PACKAGE/email $EMAIL diff --git a/debian/init.d b/debian/init.d index 204380d..44ab3ca 100644 --- a/debian/init.d +++ b/debian/init.d @@ -47,11 +47,11 @@ if [ -f /etc/default/$NAME ] ; then . /etc/default/$NAME fi -# Use this if you want the user to explicitly set 'RUN' in -# /etc/default/ -if [ "x$RUN" != "xyes" ] ; then +# Use this if you want the user to explicitly set 'UPDATE_MOTD' in +# /etc/default/mythtv-status +if [ "x$UPDATE_MOTD" != "xyes" ] ; then log_failure_msg "$NAME disabled, please adjust the configuration to your needs " - log_failure_msg "and then set RUN to 'yes' in /etc/default/$NAME to enable it." + log_failure_msg "and then set UPDATE_MOTD to 'yes' in /etc/default/$NAME to enable it." exit fi diff --git a/debian/postinst b/debian/postinst index 59c324c..858f16e 100644 --- a/debian/postinst +++ b/debian/postinst @@ -23,11 +23,23 @@ case "$1" in HOST="${RET:-localhost}" db_get $PACKAGE/enable - RUN="${RET:-true}" + UPDATE_MOTD="${RET:-true}" - if [ $RUN = 'true' ] + if [ $UPDATE_MOTD = 'true' ] then - RUN='yes' + UPDATE_MOTD='yes' + fi + + # Support the old variable name. + if [ "x$RUN" != "x" ] + then + UPDATE_MOTD=$RUN + fi + + # Support the old variable name. + if [ "x$ARGS != "x" ] + then + UPDATE_MOTD_ARGS=$ARGS fi db_get $PACKAGE/email @@ -49,17 +61,17 @@ case "$1" in HOST=$HOST ######################################################################## -# The following settings are used by /etc/init.d/mythtv-status script # -# to update the MOTD. # +# The following settings are used by the /etc/init.d/mythtv-status and # +# mythtv-update-motd scripts to update the MOTD. # ######################################################################## -# RUN: +# UPDATE_MOTD: # Should we actually run and update the MOTD? -RUN=$RUN +UPDATE_MOTD=$UPDATE_MOTD -# ARGS: -# Any extra arguments to pass to mythtv-status (i.e., -e and/or -d). -ARGS="$ARGS" +# UPDATE_MOTD_ARGS: +# Any extra arguments to pass to mythtv-status (i.e., -e -d). +UPDATE_MOTD_ARGS="$UPDATE_MOTD_ARGS" ######################################################################## # The following settings are used by the /etc/cron.daily/mythtv-status # diff --git a/man/mythtv-update-motd.1 b/man/mythtv-update-motd.1 index 1864ed3..60f22f8 100644 --- a/man/mythtv-update-motd.1 +++ b/man/mythtv-update-motd.1 @@ -30,8 +30,12 @@ options of interest: .B HOST The host to check, by default this is localhost. .TP -.B RUN +.B UPDATE_MOTD Should this script run? Set to yes to enable, anything else to disable. +.TP +.B UPDATE_MOTD_ARGS +Any additional arguments you'd like to have run if the MOTD is updated by this +script. .PP .PD 0 You can also disable this script from running by creating a file -- 2.30.2