+2015-01-10 Andrew Ruthven
+ Make the cron.d file for Debian use mythtv-update-motd to stop
+ systemd from being upset.
+
2014-12-02 Andrew Ruthven
Add in more UTF-8 encodings as required for Perl v5.18, thanks to
Jan Schneider for reporting the UTF-8 issue.
my $return_code_only = 0;
-my $VERSION = '0.10.6';
+my $VERSION = '0.10.7';
# Some display blocks are disabled by default:
$c->{'display'}{'Shows due to Auto Expire'} = 0;
#!/bin/bash
+# Run mythtv-status to update the MOTD.
+
+NAME=mythtv-update-motd
+WORKFILE=/var/run/motd
+TEMPFILE=/var/run/motd.mythtv-status
+
. /etc/default/mythtv-status
if [ x$RUN != xyes ]
exit
fi
+# 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
+[ -f /var/run/motd.orig ] || cp $WORKFILE /var/run/motd.orig
+
+# If the tempfile is less than 15 minutes old, object, otherwise
+# we'll assume that something went wrong and remove it.
+if [ -f $TEMPFILE ]; then
+ AGE=$(stat -c "%Z" $TEMPFILE);
+ if (( $AGE > $(date +'%s') - 900 ))
+ then
+ echo "I think another $NAME is running."
+ exit 1
+ fi
+fi
+
[ ! -f /var/run/motd.orig ] && cp /var/run/motd /var/run/motd.orig
cp /var/run/motd.orig /var/run/motd.new
ret=0
-mythtv-status $ARGS -h $HOST >> /var/run/motd.new 2> /dev/null || ret=$?
+mythtv-status $ARGS -h $HOST >> $TEMPFILE 2> /dev/null || ret=$?
if [ $ret -eq 0 -o $ret -eq 1 ]; then
- [ -f /var/run/motd.new ] && mv /var/run/motd.new /var/run/motd
+ if [ ! -f $TEMPFILE ]; then
+ echo My temporary file has gone away, failed.
+ exit 1
+ else
+ mv $TEMPFILE $WORKFILE
+ fi
+else
+ # Something else went wrong, remove the temp file.
+ rm $TEMPFILE
+ exit 1
fi
+mythtv-status (0.10.7-1) unstable; urgency=low
+
+ * New upstream release (Closes: #772801).
+
+ -- Andrew Ruthven <andrew@etc.gen.nz> Sat, 10 Jan 2015 15:56:21 +1300
+
mythtv-status (0.10.6-1) unstable; urgency=low
* New upstream release.
#
# Regular cron jobs for the mythtv-status package
#
-*/10 * * * * root [ -x /etc/init.d/mythtv-status ] && /etc/init.d/mythtv-status reload > /dev/null
+*/10 * * * * root [ -x /usr/sbin/mythtv-update-motd ] && /usr/sbin/mythtv-update-motd > /dev/null
start|reload|refresh|restart|force-reload)
log_daemon_msg "Updating $DESC" "$NAME"
- # Just incase someone has removed their motd file.
- [ -f $WORKFILE ] || touch $WORKFILE
- [ -f /var/run/motd.orig ] || cp $WORKFILE /var/run/motd.orig
-
- # If the tempfile is less than 15 minutes old, object, otherwise
- # we'll assume that something went wrong and remove it.
- if [ -f $TEMPFILE ]; then
- AGE=$(stat -c "%Z" $TEMPFILE);
- if expr $AGE \> $(date +'%s') - 900
- then
- log_warning_msg "I think another $NAME is running."
+ if ! /usr/sbin/mythtv-update-motd; then
+ log_failure_msg "Failed to update MOTD"
exit 1
- fi
- fi
-
- cp /var/run/motd.orig $TEMPFILE
- ret=0
- start=$(date)
- $DAEMON $ARGS -h $HOST >> $TEMPFILE || ret=$?
- if [ $ret -eq 0 -o $ret -eq 1 ]; then
- if [ ! -f $TEMPFILE ]; then
- log_failure_msg "My temporary file has gone away, failed."
- exit 1
- else
- mv $TEMPFILE $WORKFILE
- fi
- log_end_msg 0
- else
- log_failure_msg
fi
+
+ log_end_msg 0
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
bin/mythtv-status usr/bin
bin/mythtv_recording_now usr/bin
bin/mythtv_recording_soon usr/bin
+bin/mythtv-update-motd /usr/sbin
molly-guard/40-mythtv-recording-soon etc/molly-guard/run.d
debian/lintian/overrides/mythtv-status usr/share/lintian/overrides
--- /dev/null
+.\" Hey, EMACS: -*- nroff -*-
+.\" First parameter, NAME, should be all caps
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
+.\" other parameters are allowed: see man(7), man(1)
+.TH MYTHTV-UPDATE-MOTD 1 "2015-01-11"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh disable hyphenation
+.\" .hy enable hyphenation
+.\" .ad l left justify
+.\" .ad b justify to both left and right margins
+.\" .nf disable filling
+.\" .fi enable filling
+.\" .br insert line break
+.\" .sp <n> insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+mythtv-update-motd \- update the MOTD with the MythTV backend status
+.SH SYNOPSIS
+.B mythtv-update-motd
+.SH DESCRIPTION
+.B mythtv-update-motd
+Update the system MOTD with the status of the MythTV backend.
+It checks the host which is configured in
+.I /etc/default/mythtv-status
+with the HOST setting.
+.SH OPTIONS
+None
+.SH "EXIT STATUS"
+.TP
+.B 0
+Updated MOTD with MythTV status
+.TP
+.B 1
+Failed to update MOTD with MythTV status
+.SH FILES
+.B /etc/default/mythtv-status
+Config file
+.SH SEE ALSO
+.BR mythtv-status (1),
+.SH AUTHOR
+mythtv-update-motd and this manpage were written by Andrew Ruthven
+<andrew@etc.gen.nz>.