Duplicate provides in init.d scripts - a summary and proposal

Petter Reinholdtsen pere at hungry.com
Tue Aug 25 12:22:52 UTC 2009


[Kel Modderman]
>> Most of these are bugs, but I suspect some of them should be handle
>> by defining new virtual provides in /etc/insserv.conf.d/.  The
>> point is to provide a way for several scripts to provide the same
>> service while still having unique provides strings to avoid the
>> problems with duplicate provides.  My proposal is to introduce at
>> least these:
>> 
>>   $mail-transport-agent  - for the MTAs like exim, postfix, etc
>
> $mta or $mail maybe

Perhaps.  I've checked the insserv source, and I believe - is allowed
in virtual facilities, and because of this propose to move ahead with
the full name $mail-transport-agent.  It allow us to set the
precedence that the new virtual facilities should use the same name as
the virtual package dependency with a $ added to the front.  I suspect
it would be useful in the future when deciding which name to use.

I proposed this untested patch for postfix to be the first to
implement it in #543472.

diff -uNr postfix-2.6.3/debian/init.d postfix-2.6.3-pere/debian/init.d
--- postfix-2.6.3/debian/init.d 2009-08-25 12:37:19.000000000 +0200
+++ postfix-2.6.3-pere/debian/init.d    2009-08-25 12:41:56.798914411 +0200
@@ -6,7 +6,7 @@
 # based on sendmail's init.d script

 ### BEGIN INIT INFO
-# Provides:          postfix mail-transport-agent
+# Provides:          postfix
 # Required-Start:    $local_fs $remote_fs $syslog $named $network $time
 # Required-Stop:     $local_fs $remote_fs $syslog $named $network
 # Should-Start:      postgresql mysql clamav-daemon postgrey spamassassin
diff -uNr postfix-2.6.3/debian/postfix.dirs postfix-2.6.3-pere/debian/postfix.dirs
--- postfix-2.6.3/debian/postfix.dirs   2009-08-25 12:37:19.000000000 +0200
+++ postfix-2.6.3-pere/debian/postfix.dirs      2009-08-25 12:45:01.225362312 +0200
@@ -1,5 +1,6 @@
 DEBIAN
 etc/init.d
+etc/insserv.conf.d
 etc/ppp/ip-up.d
 etc/ppp/ip-down.d
 etc/network/if-up.d
diff -uNr postfix-2.6.3/debian/postfix.insserv.conf
+postfix-2.6.3-pere/debian/postfix.insserv.conf
--- postfix-2.6.3/debian/postfix.insserv.conf   1970-01-01 01:00:00.000000000 +0100
+++ postfix-2.6.3-pere/debian/postfix.insserv.conf      2009-08-25 12:42:45.055741452
++0200
@@ -0,0 +1 @@
+$mail-transport-agent postfix
diff -uNr postfix-2.6.3/debian/rules postfix-2.6.3-pere/debian/rules
--- postfix-2.6.3/debian/rules  2009-08-25 12:37:19.000000000 +0200
+++ postfix-2.6.3-pere/debian/rules     2009-08-25 12:44:01.427380791 +0200
@@ -133,6 +133,7 @@
        install -m 0644 conf/main.cf.tls $(sharedir)/main.cf.tls
        install -m644 debian/postfix.ufw.profile debian/postfix/etc/ufw/applications.d/postfix
        install -m644 debian/rsyslog.conf debian/postfix/etc/rsyslog.d/postfix.conf
+       install -m644 debian/postfix.insserv.conf debian/postfix/etc/insserv.conf.d/postfix

        install man/man1/*.1 ${base}/usr/share/man/man1
        install man/man5/*.5 ${base}/usr/share/man/man5

The way it is done is to add a file /etc/insserv.conf.d/packagename
with the fragment of the virtual dependency that the package want to
take responsibility for, in this case $mail-transport-agent is mapped
to a required dependency on postfix (no + in front mean hard
dependency).  This should make it possible for packages to depend on
$mail-transport-agent.

This is the way I propose to use when several packages want to provide
the same service, and I post it here to get feedback and make the
proposal more known.

Happy hacking,
-- 
Petter Reinholdtsen




More information about the initscripts-ng-devel mailing list