reopen 678030
stop

2012/6/19 Michael Vogt <m...@debian.org>:
> Thanks a lot! I updated bzr to include your version with some small
> modifications. Looking at the README.Debian.gz from lsb-base it
> appears that log_action_begin_msg and log_action_end_msg is actually
> closer to what we want as the other one appears to be more for daemons
> and the check may take some time (usually not though of
> course). Please let me know if you agree with this change.

Indeed, I agree that "daemon" was not appropriate here. Note below
that there was a typo that prevented the above plan to be perfect! :-)

> I wasn't sure about VERBOSE but followed your example and left it
> in. It seems like a lot of the scripts in /etc/init.d do not really
> honor it.

Yes, but the design is also broken. This is all or nothing, black or
white. In practice we have the need to write very important messages
(like syslog priorities emergency, critical, error) , thus VERBOSE
should not be considered.

> Please double check bzr trunk (bzr branch lp:unattended-upgrades gives
> it to you) if it all makes sense :)

Checking your changes it doesn't appear good:

root@frost:~# /etc/init.d/unattended-upgrades stop
[info] Checking for running unattended package upgrades unattended-upgrades.
done.

So, I took a look at the README in lsb-base and saw that you used
"log_action_msg" -- probably a typo since your plan was different.
With the patch below (and attached u-a script) the output is:

root@frost:~# /etc/init.d/unattended-upgrades2 stop
[ ok ] Checking for running unattended package upgrades...done
(unattended-upgrades).

One last note on the code style. Probably your editor (I use «geany»
for text and shell scripts) prefers or is configured to insert 4
spaces instead of a tab. I would advice to either use only tabs or
only 2/4/8 spaces, as you prefer.
(On "case" options I don't add any indent -- from C/kernel coding style.)

Thanks


# diff -u -w /etc/init.d/unattended-upgrades /etc/init.d/unattended-upgrades2
--- /etc/init.d/unattended-upgrades     2012-06-21 17:50:49.000000000 +0300
+++ /etc/init.d/unattended-upgrades2    2012-06-22 09:03:25.687317012 +0300
@@ -32,9 +32,9 @@
        ;;
     stop)
        if [ -e $SHUTDOWN_HELPER ]; then
-           [ "$VERBOSE" != "no" ] && log_action_msg "Checking for running
$DESC" "$NAME"
+               [ "$VERBOSE" != "no" ] && log_action_begin_msg "Checking for 
running $DESC"
            python $SHUTDOWN_HELPER
-           [ "$VERBOSE" != "no" ] && log_action_end_msg $?
+               [ "$VERBOSE" != "no" ] && log_action_end_msg $? "$NAME"
        fi
        ;;
     *)

Attachment: unattended-upgrades2
Description: Binary data

Reply via email to