Package: smartmontools
Version: 5.36-6
Severity: minor
Tags: patch
Hi,
the attached patch changes the smartmontools init.d script(s) to use lsb
logging functions.
Regards,
David
--
David Härdeman
diff -ur ./smartmontools-5.36.orig/debian/control
./smartmontools-5.36/debian/control
--- ./smartmontools-5.36.orig/debian/control 2006-09-03 22:29:55.000000000
+0200
+++ ./smartmontools-5.36/debian/control 2006-09-03 22:38:11.000000000 +0200
@@ -8,7 +8,7 @@
Package: smartmontools
Architecture: any
Conflicts: smartsuite, ucsc-smartsuite
-Depends: ${misc:Depends}, ${shlibs:Depends}, debianutils (>= 2.2)
+Depends: ${misc:Depends}, ${shlibs:Depends}, debianutils (>= 2.2), lsb-base
(>= 3.0-10)
Recommends: mailx | mailutils
Description: control and monitor storage systems using S.M.A.R.T.
The smartmontools package contains two utility programs (smartctl and smartd)
diff -ur ./smartmontools-5.36.orig/debian/smartmontools.init
./smartmontools-5.36/debian/smartmontools.init
--- ./smartmontools-5.36.orig/debian/smartmontools.init 2006-09-03
22:29:55.000000000 +0200
+++ ./smartmontools-5.36/debian/smartmontools.init 2006-09-03
22:37:39.000000000 +0200
@@ -12,6 +12,8 @@
SMARTDPID=/var/run/smartd.pid
[ -x $SMARTCTL ] || exit 0
[ -x $SMARTD ] || exit 0
+. /lib/lsb/init-functions
+
RET=0
[ -r /etc/default/smartmontools ] && . /etc/default/smartmontools
@@ -19,18 +21,20 @@
smartd_opts="--pidfile $SMARTDPID $smartd_opts"
enable_smart() {
- echo -n "Enabling S.M.A.R.T. for:"
+ log_action_begin_msg "Enabling S.M.A.R.T."
for device in $enable_smart; do
- echo -n " $device"
- $SMARTCTL --quietmode=errorsonly --smart=on $device || \
- { echo -n "(failed)"; RET=2; }
+ log_action_cont_msg "$device"
+ if ! $SMARTCTL --quietmode=errorsonly --smart=on $device; then
+ log_action_cont_msg "(failed)"
+ RET=2
+ fi
done
- echo "."
+ log_action_end_msg 0
}
check_start_smartd_option() {
if [ ! "$start_smartd" = "yes" ]; then
- echo "Not starting S.M.A.R.T. daemon smartd, disabled via
/etc/default/smartmontools"
+ log_warning_msg "Not starting S.M.A.R.T. daemon smartd, disabled via
/etc/default/smartmontools"
return 1
else
return 0
@@ -41,40 +45,40 @@
start)
[ -n "$enable_smart" ] && enable_smart
if check_start_smartd_option; then
- echo -n "Starting S.M.A.R.T. daemon: smartd"
+ log_daemon_msg "Starting S.M.A.R.T. daemon" "smartd"
if start-stop-daemon --start --quiet --pidfile $SMARTDPID \
--exec $SMARTD -- $smartd_opts; then
- echo "."
+ log_end_msg 0
else
- echo " (failed)"
+ log_end_msg 1
RET=1
fi
fi
;;
stop)
- echo -n "Stopping S.M.A.R.T. daemon: smartd"
+ log_daemon_msg "Stopping S.M.A.R.T. daemon" "smartd"
start-stop-daemon --stop --quiet --oknodo --pidfile $SMARTDPID
- echo "."
+ log_end_msg 0
;;
reload|force-reload)
- echo -n "Reloading S.M.A.R.T. daemon: smartd"
+ log_daemon_msg "Reloading S.M.A.R.T. daemon" "smartd"
if start-stop-daemon --stop --quiet --signal 1 \
--pidfile $SMARTDPID; then
- echo "."
+ log_end_msg 0
else
- echo " (failed)"
+ log_end_msg 1
RET=1
fi
;;
restart)
if check_start_smartd_option; then
- echo -n "Restarting S.M.A.R.T. daemon: smartd"
+ log_daemon_msg "Restarting S.M.A.R.T. daemon" "smartd"
start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile
$SMARTDPID
if start-stop-daemon --start --quiet --pidfile $SMARTDPID \
--exec $SMARTD -- $smartd_opts; then
- echo "."
+ log_end_msg 0
else
- echo " (failed)"
+ log_end_msg 1
RET=1
fi
fi