From: Andrew Ruthven Date: Tue, 2 Oct 2012 08:50:40 +0000 (+1300) Subject: Debian Wheezy now uses /var/run/motd.dynamic. X-Git-Tag: debian-sid-0.10.2-2 X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3d86e7892b0980c984978c37a8052654c9c0cee2;p=mythtv-status.git Debian Wheezy now uses /var/run/motd.dynamic. --- diff --git a/debian/changelog b/debian/changelog index e21aa32..411c53b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,9 @@ mythtv-status (0.10.2-2) unstable; urgency=low * Handle a stale temp file more gracefully (Closes: #681684) + * base-files 6.11 in Wheezy uses /var/run/motd.dynamic (Closes: #688034) - -- Andrew Ruthven Tue, 02 Oct 2012 21:48:01 +1300 + -- Andrew Ruthven Tue, 02 Oct 2012 21:50:10 +1300 mythtv-status (0.10.2-1) unstable; urgency=low diff --git a/debian/init.d b/debian/init.d index 61826bb..613f492 100644 --- a/debian/init.d +++ b/debian/init.d @@ -21,8 +21,8 @@ # Provides: mythtv-status # Required-Start: $remote_fs # Required-Stop: $remote_fs -# Should-Start: $named mythtv-backend -# Should-Stop: $named mythtv-backend +# Should-Start: $named mythtv-backend $motd +# Should-Stop: $named mythtv-backend $motd # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Update the MOTD with the MythTV status @@ -35,6 +35,7 @@ DAEMON=/usr/bin/mythtv-status # Introduce the server's location here NAME=mythtv-status # Introduce the short server's name here DESC="MythTV Status" # Introduce a short description here TEMPFILE=/var/run/motd.mythtv-status +WORKFILE=/var/run/motd test -x $DAEMON || exit 0 @@ -53,6 +54,9 @@ if [ "x$RUN" != "xyes" ] ; then exit fi +# Debian Wheezy+ handles the MOTD differently. +[ -f /var/run/motd.dynamic ] && WORKFILE=/var/run/motd.dynamic + set -e case "$1" in @@ -60,8 +64,8 @@ case "$1" in log_daemon_msg "Updating $DESC" "$NAME" # Just incase someone has removed their motd file. - [ -f /var/run/motd ] || touch /var/run/motd - [ -f /var/run/motd.orig ] || cp /var/run/motd /var/run/motd.orig + [ -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. @@ -84,7 +88,7 @@ case "$1" in log_failure_msg "My temporary file has gone away, failed." exit 1 else - mv $TEMPFILE /var/run/motd + mv $TEMPFILE $WORKFILE fi log_end_msg 0 else @@ -93,7 +97,7 @@ case "$1" in ;; stop) log_daemon_msg "Stopping $DESC" "$NAME" - [ -f /var/run/motd.orig ] && cp /var/run/motd.orig /var/run/motd + [ -f /var/run/motd.orig ] && cp /var/run/motd.orig $WORKFILE rm /var/run/motd.orig log_end_msg 0 ;; @@ -102,11 +106,11 @@ case "$1" in log_failure_msg "$NAME is not running" exit 1 fi - if [ ! -f /var/run/motd ]; then - log_failure_msg "$NAME is not running (no motd file!)" + if [ ! -f $WORKFILE ]; then + log_failure_msg "$NAME is not running (no motd file)!" exit 1 fi - if [ $(date -d "15 minutes ago" +"%s") -gt $(stat -c "%Y" /var/run/motd) ] + if [ $(date -d "15 minutes ago" +"%s") -gt $(stat -c "%Y" $WORKFILE) ] then log_failure_msg "$NAME is not running (motd file is stale)" exit 1