[pkg-fetchmail-maint] Bug#388843: fetchmail: Please consider using
LSB-enabled init script
Christian Perrier
bubulle at debian.org
Fri Sep 22 20:29:31 UTC 2006
Package: fetchmail
Version: 6.3.4-6+b1
Severity: wishlist
Tags: patch
This bug report is part of the "bubulle mini campaign to help the switch to
LSB-enabled init scripts". Please consider that I am definitely not a wizard
with regard of the LSB init scripts and you might need to get more advice
from the sysvinit package maintainers.
I just went on your package....because it is installed on my system and
using the attached patch makes the init of your package nicer on my
system..:-)
Using LSB-enabled scripts allows for more control of parallel execution of
these scripts and, as a nice side effect, helps improving the visual aspect
of the system boot.
More information is available on http://wiki.debian.org/LSBInitScripts and
http://initscripts-ng.alioth.debian.org/soc2006-bootsystem/.
The attached patch is an attempt that should help you switching your package
to LSB scripts. Please don't take it as Holy Word.....I bet it can be
enhanced..
-- System Information:
Debian Release: testing/unstable
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/dash
Kernel: Linux 2.6.17-2-686
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to fr_FR.UTF-8)
Versions of packages fetchmail depends on:
ii adduser 3.97 Add and remove users and groups
ii debianutils 2.17.2 Miscellaneous utilities specific t
ii gettext 0.15-2 GNU Internationalization utilities
ii libc6 2.3.6.ds1-4 GNU C Library: Shared libraries
ii libssl0.9.8 0.9.8c-1 SSL shared libraries
Versions of packages fetchmail recommends:
ii ca-certificates 20060816 Common CA Certificates PEM files
-- no debconf information
-------------- next part --------------
--- init.orig 2006-09-22 18:52:58.827721308 +0200
+++ init 2006-09-22 19:02:05.764882486 +0200
@@ -3,6 +3,14 @@
# Fetchmail init script
# Latest change: Mo Jul 31 20:23:54 CEST 2006
#
+### BEGIN INIT INFO
+# Provides: fetchmail
+# Required-Start: $network $local_fs $remote_fs
+# Required-Stop:
+# Default-Start: S 1 2 3 4 5
+# Default-Stop: 0 6
+### END INIT INFO
+#
# A fetchmailrc file containg hosts and passwords for all local users should be
# placed in /etc/fetchmailrc. Remember to make the /etc/fetchmailrc mode 600
# to avoid disclosing the users' passwords.
@@ -34,10 +42,13 @@
UIDL=/var/lib/fetchmail/.fetchmail-UIDL-cache
test -f $DAEMON || exit 0
+
+. /lib/lsb/init-functions
+
if [ "$1" = "start" ]; then
if [ ! -r $CONFFILE ] ; then
- echo "$CONFFILE not found."
- echo "can not start fetchmail daemon... consider disabling the script"
+ log_failure_msg "$CONFFILE not found."
+ log_failure_msg "can not start fetchmail daemon... consider disabling the script"
exit 0
fi
fi
@@ -58,7 +69,7 @@
chmod 700 /var/lib/fetchmail
chown -h -R fetchmail:nogroup /var/lib/fetchmail
else
- echo "$0: $USER user does not exist!"
+ log_failure_msg "$0: $USER user does not exist!"
exit 1
fi
fi
@@ -82,7 +93,7 @@
# sanity check
#if [ ! -d ${PIDFILE%/*} ]; then
-# echo "$0: directory ${PIDFILE%/*} does not exist!"
+# log_failure_msg "$0: directory ${PIDFILE%/*} does not exist!"
# exit 1
#fi
@@ -108,45 +119,45 @@
pid=`cat $PIDFILE | sed -e 's/\s.*//'|head -n1`
PIDDIR=/proc/$pid
if [ -d ${PIDDIR} -a "$(readlink -f ${PIDDIR}/exe)" = "${DAEMON}" ]; then
- echo "fetchmail already started; not starting."
+ log_failure_msg "fetchmail already started; not starting."
exit 0
else
- echo "Removing stale PID file $PIDFILE."
+ log_warning_msg "Removing stale PID file $PIDFILE."
rm -f $PIDFILE
fi
fi
- echo -n "Starting mail retrieval agent: fetchmail"
+ log_begin_msg "Starting mail retriever agent" "fetchmail"
if start-stop-daemon -S -o -q -p $PIDFILE -x $DAEMON -u $USER -a /bin/su -- -c "$DAEMON $OPTIONS" $USER; then
- echo "."
+ log_end_msg 0
else
- echo " (failed)."
+ log_end_msg 1
exit 1
fi
;;
stop)
if ! test -e $PIDFILE ; then
- echo "Pidfile not found! Is fetchmail running?"
+ log_failure_msg "Pidfile not found! Is fetchmail running?"
exit 0
fi
- echo -n "Stopping mail retrieval agent: fetchmail"
+ log_begin_msg "Stopping mail retriever agent" "fetchmail"
if start-stop-daemon -K -o -q -p $PIDFILE -x $DAEMON -u $USER; then
- echo "."
+ log_end_msg 0
else
- echo " (failed)."
+ log_end_msg 1
exit 1
fi
;;
force-reload|restart)
- echo -n "Restarting mail retrieval agent: fetchmail"
+ log_begin_msg "Restarting mail retriever agent" "fetchmail"
if ! start-stop-daemon -K -o -q -p $PIDFILE -x $DAEMON -u $USER; then
- echo " (failed on stop)."
+ log_end_msg 1
exit 1
fi
sleep 1
if start-stop-daemon -S -q -p $PIDFILE -x $DAEMON -u $USER -a /bin/su -- -c "$DAEMON $OPTIONS" $USER; then
- echo "."
+ log_end_msg 0
else
- echo " (failed on start)."
+ log_end_msg 1
exit 1
fi
;;
@@ -162,13 +173,13 @@
$0 start
;;
awaken)
- echo -n "Awakening mail retrieval agent: fetchmail"
+ log_begin_msg "Awakening mail retriever agent" "fetchmail"
if [ -s $PIDFILE ]; then
start-stop-daemon -K -s 10 -q -p $PIDFILE -x $DAEMON
- echo "."
+ log_end_msg 0
exit 0
else
- echo " (not running)."
+ log_end_msg 1
exit 1
fi
;;
@@ -202,13 +213,13 @@
exit 0
;;
*)
- echo "Usage: /etc/init.d/fetchmail {start|stop|restart|force-reload|awaken|debug-run}"
- echo " start - starts system-wide fetchmail service"
- echo " stop - stops system-wide fetchmail service"
- echo " restart, force-reload - starts a new system-wide fetchmail service"
- echo " awaken - tell system-wide fetchmail to start a poll cycle immediately"
- echo " debug-run [strace [strace options...]] - start a debug run of the"
- echo " system-wide fetchmail service, optionally running it under strace"
+ log_warning_msg "Usage: /etc/init.d/fetchmail {start|stop|restart|force-reload|awaken|debug-run}"
+ log_warning_msg " start - starts system-wide fetchmail service"
+ log_warning_msg " stop - stops system-wide fetchmail service"
+ log_warning_msg " restart, force-reload - starts a new system-wide fetchmail service"
+ log_warning_msg " awaken - tell system-wide fetchmail to start a poll cycle immediately"
+ log_warning_msg " debug-run [strace [strace options...]] - start a debug run of the"
+ log_warning_msg " system-wide fetchmail service, optionally running it under strace"
exit 1
;;
esac
--- control.ori 2006-09-22 20:38:24.834775816 +0200
+++ control 2006-09-22 20:38:44.234947736 +0200
@@ -9,7 +9,7 @@
Package: fetchmail
Architecture: any
-Depends: ${shlibs:Depends}, debianutils (>= 1.7), adduser (>= 3.34), gettext
+Depends: ${shlibs:Depends}, debianutils (>= 1.7), adduser (>= 3.34), gettext, lsb-base (>= 3.0-6)
Conflicts: popclient, fetchmail-common, logcheck (<< 1.1.1-9), fetchmail-ssl (<= 6.2.5-12)
Replaces: fetchmail-common, fetchmail-ssl
Provides: fetchmail-ssl
More information about the pkg-fetchmail-maint
mailing list