Hi Adeodato,
Thank you for the feedback. Interestingly the first set of tests did
seemed to work when I was testing various combinations before making the
upload of 0.9.0-4. But I've changed them as suggested.
I've also changed the handling of the return code as suggested.
Please find attached debdiffs between 0.9.0-5 (just uploaded) and both
0.9.0-1 (in lenny) and 0.9.0-4 (the previous version I'd uploaded).
Cheers!
On Fri, 2008-11-07 at 20:05 +0100, Adeodato Simó wrote:
> * Andrew Ruthven [Tue, 04 Nov 2008 14:08:32 +1300]:
>
> > Gidday,
>
> Hello,
>
> > + # 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
>
> This is wrong for a `set -e` script. If those files exist, the left part
> of the expression will fail, and the script will abort. The proper way
> to do it is:
>
> [ -f /var/run/motd ] || touch /var/run/motd
> [ -f /var/run/motd.orig ] || cp /var/run/motd /var/run/motd.orig
>
> > + set +e
> > + $DAEMON $ARGS -h $HOST >> /var/run/motd.new 2> /dev/null
> > + ret=$?
> > + set -e
>
> A more idiomatic way to do it, in case you like it better, is:
>
> ret=0
> $DAEMON $ARGS -h $HOST >> /var/run/motd.new 2> /dev/null || ret=$?
>
> HTH,
>
--
Andrew Ruthven
Wellington, New Zealand
At home: andrew@etc.gen.nz | This space intentionally
| left blank.
diff -u mythtv-status-0.9.0/debian/mythtv-status.1 mythtv-status-0.9.0/debian/mythtv-status.1
--- mythtv-status-0.9.0/debian/mythtv-status.1
+++ mythtv-status-0.9.0/debian/mythtv-status.1
@@ -1,15 +1,7 @@
-.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.1801 (Pod::Simple 3.05)
.\"
.\" Standard preamble:
.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
@@ -53,7 +45,7 @@
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.ie \nF \{\
@@ -132,7 +124,7 @@
.\" ========================================================================
.\"
.IX Title "MYTHTV-STATUS 1"
-.TH MYTHTV-STATUS 1 "2008-07-22" "perl v5.10.0" "User Contributed Perl Documentation"
+.TH MYTHTV-STATUS 1 "2008-10-30" "perl v5.10.0" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -u mythtv-status-0.9.0/debian/changelog mythtv-status-0.9.0/debian/changelog
--- mythtv-status-0.9.0/debian/changelog
+++ mythtv-status-0.9.0/debian/changelog
@@ -1,3 +1,34 @@
+mythtv-status (0.9.0-5) unstable; urgency=medium
+
+ * Update init.d with feedback from Adeodato Simó.
+
+ -- Andrew Ruthven <andrew@etc.gen.nz> Sat, 08 Nov 2008 10:49:01 +1300
+
+mythtv-status (0.9.0-4) unstable; urgency=medium
+
+ * It turns out that release 0.9.1 of mythtv-status snuck into
+ the 0.9.0-2 upload, back that out for now.
+
+ -- Andrew Ruthven <andrew@etc.gen.nz> Thu, 30 Oct 2008 13:55:01 +1300
+
+mythtv-status (0.9.0-3) unstable; urgency=medium
+
+ * If someone has removed /var/run/motd then tries to install (or
+ reinstall) this package, then it fails. We should make sure that
+ doesn't happen by making sure that /var/run/motd exists.
+ * Provide some sanity checking before updating the MOTD file in
+ the init.d script to make sure that mythtv-status didn't die.
+
+ -- Andrew Ruthven <andrew@etc.gen.nz> Tue, 28 Oct 2008 15:12:02 +1300
+
+mythtv-status (0.9.0-2) unstable; urgency=low
+
+ * The init.d script shouldn't check the return code anymore, as the
+ return code may be 1 if there are any warnings present. This
+ has been stopping the MOTD from being updated.
+
+ -- Andrew Ruthven <andrew@etc.gen.nz> Mon, 26 Sep 2008 09:16:53 +1200
+
mythtv-status (0.9.0-1) unstable; urgency=low
* New upstream release.
diff -u mythtv-status-0.9.0/debian/init.d mythtv-status-0.9.0/debian/init.d
--- mythtv-status-0.9.0/debian/init.d
+++ mythtv-status-0.9.0/debian/init.d
@@ -57,15 +57,21 @@
case "$1" in
start|reload|refresh|restart|force-reload)
log_daemon_msg "Updating $DESC" "$NAME"
- [ ! -f /var/run/motd.orig ] && cp /var/run/motd /var/run/motd.orig
+
+ # 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
cp /var/run/motd.orig /var/run/motd.new
- if $DAEMON $ARGS -h $HOST >> /var/run/motd.new
- then
+ ret=0
+ $DAEMON $ARGS -h $HOST >> /var/run/motd.new 2> /dev/null || ret=$?
+ if [ $ret -eq 0 -o $ret -eq 1 ]; then
mv /var/run/motd.new /var/run/motd
+ log_end_msg 0
+ else
+ log_failure_msg
fi
- log_end_msg 0
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
diff -u mythtv-status-0.9.0/debian/changelog mythtv-status-0.9.0/debian/changelog
--- mythtv-status-0.9.0/debian/changelog
+++ mythtv-status-0.9.0/debian/changelog
@@ -1,3 +1,9 @@
+mythtv-status (0.9.0-5) unstable; urgency=medium
+
+ * Update init.d with feedback from Adeodato Simó.
+
+ -- Andrew Ruthven <andrew@etc.gen.nz> Sat, 08 Nov 2008 10:49:01 +1300
+
mythtv-status (0.9.0-4) unstable; urgency=medium
* It turns out that release 0.9.1 of mythtv-status snuck into
diff -u mythtv-status-0.9.0/debian/init.d mythtv-status-0.9.0/debian/init.d
--- mythtv-status-0.9.0/debian/init.d
+++ mythtv-status-0.9.0/debian/init.d
@@ -59,15 +59,13 @@
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 /var/run/motd ] || touch /var/run/motd
+ [ -f /var/run/motd.orig ] || cp /var/run/motd /var/run/motd.orig
cp /var/run/motd.orig /var/run/motd.new
- set +e
- $DAEMON $ARGS -h $HOST >> /var/run/motd.new 2> /dev/null
- ret=$?
- set -e
+ ret=0
+ $DAEMON $ARGS -h $HOST >> /var/run/motd.new 2> /dev/null || ret=$?
if [ $ret -eq 0 -o $ret -eq 1 ]; then
mv /var/run/motd.new /var/run/motd
log_end_msg 0
Attachment:
signature.asc
Description: This is a digitally signed message part