Re: BEGIN INIT INFO

Jeff Licquia <[email protected]> Tue, 13 May 2014 13:22:05 -0400
Newsgroups gmane.linux.debian.devel.lsb
Message-ID <[email protected]>
On 05/08/2014 08:24 AM, Sorin Sbârnea wrote:
> I was looking for a way to run multiple instances of the same services and
> be able to reuse the init.d scripts.
> 
> I do have an init.d script that can be copied (or symlinked) that cam
> manage different instances (without interation).
> 
> Now there is only one problem:
> 
> # Provides:          scriptname
> 
> This doesn't seem to be dynamic in any way, the name there cannot be an
> environment variable (obviously the script itself is not executed in order
> to parse BEGIN INIT INFO
> 
> All I need is the ability to tell the parser to use the *filename* instead.
> 
> This should be easy to implement and could be triggered by a line like:
> 
> # Provides: $scriptname
> 
> What do you think about this? -- without this you cannot clone multiple
> services without having to modify each init.d script.

This would introduce a bit of complexity due to the common practice of
symlinking init scripts to per-runlevel directories (which Debian does
as well).  I doubt you're looking for "Provides: S30foobar" here.

That could probably be overcome, but especially with the move to
systemd, I'm not seeing that there's much interest in adding the kind of
complexity we'd need here.

You would need a process anyway for copying/symlinking the init.d
script; it wouldn't be too hard to switch out something like:

  cp foo.init /etc/init.d/foo

for:

  sed s,@SCRIPTNAME@,foo, < foo.init > /etc/init.d/foo
  chmod +x /etc/init.d/foo

and setting your init script's Provides line to:

  # Provides: @SCRIPTNAME@
signature.asc (application/pgp-signature, 884 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJTclTEAAoJEJMoI5Uw8xGu5zkQALUh9lzbcYbAuMrmr7jZ9HFW
6MRVBky76CFds0pvHZP45jjQdfhlgAQzuU8Bl8QipyTVmBCgwwn09zC2E+dD2E8N
TVvGvqFpU+pqlUxyyBOExSG3AMpF/ISOgAz16K0BAIH8Ls+nveVw0s3bfk6pL+xN
psCeAT2MeQxrBHDBRH5HIQd0eP73SIDMczdlzTFjlYza7PV8R3A0nDfM5VQlvqIB
1JXNZfDcAFX4E1n/bW5THpUGUW0+giGuKmxbCWyemtDLUUeIZN9HToW/80qU0aqZ
NhWWvNVe0ub+6yMcZ69/MU+D5KfZPwj0wHpMq8J2wRDRTcJ4d8TzsgBa+PZi9QAv
VL0Ma/mOYPUcsQJik1Qu4oJH1MyMKhRwXhQ7OsA58NRclkCktorofBeQ4eB5/YqS
KnahsH/KsLrPQNIiVcUCzCmZH/ExXGEVoUqNSdpDqdRHbSBEeaJeKuvp9I6kgCzM
zkwR2RRVf230MlJtDdSWKkW7Z8/Z7M5FoehPuH2ObNm1OAdeV1O/6Bh8k24ekL5n
s+HK8xbqk5NVy35dBToQWTNQyiQI/lNOYauUo8Jr1QqLsMMpKwUWjuUTJ00jDXMl
aUhJNJMnLjKGL9j2DY1ldPv30MsE3fgdt5c8a1nHkJyQ3BPtWPsdsejjXZB4wUo8
hjd7mGTNENoZhSGUniTD
=XjB5
-----END PGP SIGNATURE-----