Re: removing in postrm rc*.d symlinks that I did not create

2004-12-17 Thread Thomas Hood
It has been suggested that you install symlinks[*] but provide an
/etc/default/foo file with an environment variable that forcibly
disables the service when set to off or whatever, and that the
initscript be written so that it overrides this forced disabling
when run from the command line.  Of course this can be made to
work but it is a bad hack.  Bad because it doesn't use Debian's
standard mechanism for configuring services.  The idea behind
initscripts is that they do what they are told when they are run.
sysv-rc and file-rc implement two different schemes for
determining when they are run and with what arguments.  I don't
see why people keep trying to undermine the standard mechanism.

Under the circumstances you describe it is reasonable to refrain
from installing symlinks[*] in runlevel directories.  I think you
are justified in deleting the symlinks on purge too, so I suggest
you simply override lintian and linda.

[*] (or do the file-rc equivalent, which happens automatically
if file-rc is installed because you use update-rc.d)

-- 
Thomas Hood




Re: removing in postrm rc*.d symlinks that I did not create

2004-12-17 Thread Michal Politowski
On Fri, 17 Dec 2004 10:49:13 +0100, Thomas Hood wrote:
[...]
 The idea behind
 initscripts is that they do what they are told when they are run.
 sysv-rc and file-rc implement two different schemes for
 determining when they are run and with what arguments.  I don't
 see why people keep trying to undermine the standard mechanism.
 
 Under the circumstances you describe it is reasonable to refrain
 from installing symlinks[*] in runlevel directories.  I think you
 are justified in deleting the symlinks on purge too, so I suggest
 you simply override lintian and linda.

Amen. Well, almost.
Under current sysv-rc semantics invoke-rc.d defauls to running the script
if neither S nor K links are present. And there were reasonable arguments
given for this behaviour.

Thus, if Nicolas would want to use invoke-rc.d to maybe run the init script
of his package on upgrades, it would be necessary to install K links by
default.
But maybe just not running the script on upgrade even if the S link is present
is the correct solution for athcool. I don't know.

-- 
Micha Politowski
Talking has been known to lead to communication if practised carelessly.


signature.asc
Description: Digital signature


Re: removing in postrm rc*.d symlinks that I did not create

2004-12-16 Thread Adrian von Bidder
On Thursday 16 December 2004 00.34, Nicolas Boullis wrote:
[de-installing run-level links that weren't installed]

How about installing links as /etc/rc?.d/K??foo - so the links are there and 
are properly manageable, but the init script will only be called as 'K??foo 
stop'

-- vbi

-- 
Segunda ley ecológica: Nunca nada se va del todo.
  -- Commoner.


pgpxgdJd9s49O.pgp
Description: PGP signature


Re: removing in postrm rc*.d symlinks that I did not create

2004-12-16 Thread Javier Fernández-Sanguino Peña
On Thu, Dec 16, 2004 at 02:11:06AM +0100, Nicolas Boullis wrote:
 Hi,
 
 On Wed, Dec 15, 2004 at 04:33:49PM -0800, Russ Allbery wrote:
  
  A technique that I've used in packages with this issue is to install the
  rc*.d symlinks by default, but also have the init script check a file in
  /etc/default to see whether or not to actually start at boot.  If you
  install a default /etc/default file that says not to start, you accomplish
  the same thing, don't have this problem, and make it just as easy for
  users to enable the package.
 
 Thanks for your suggestion.
 I already thought about it, but I fnind it quite confusing when I cannot 
 run /etc/init.d/foobar by hand as soon as it is not enabled on startup.

Well, you could have a message saying that you need to enable foo and a
'force-start' action that started it regardless of what's in /etc/default.
Moreover, the script could check if it's being called on startup (it's name 
is 'S') and heed the default value and start anyway if called from the 
command line. There are plenty of ways to avoid that confusion.

Regards

Javier


signature.asc
Description: Digital signature


Re: removing in postrm rc*.d symlinks that I did not create

2004-12-16 Thread Nicolas Boullis
Hi,

On Wed, Dec 15, 2004 at 08:47:43PM -0600, John Hasler wrote:
 Your script should check $PRERUNLEVEL.  It will be N if you are booting.

That's a nice idea, but do you know how fine it would behave with 
things like file-rc?


Nicolas




Re: removing in postrm rc*.d symlinks that I did not create

2004-12-16 Thread Nicolas Boullis
Hi,

On Thu, Dec 16, 2004 at 09:32:08AM +0100, Javier Fernández-Sanguino Peña wrote:
 
 Well, you could have a message saying that you need to enable foo and a
 'force-start' action that started it regardless of what's in /etc/default.

That might be a solution. Users would certainly be less confused, but 
some scripts they would have written would still be...


 Moreover, the script could check if it's being called on startup (it's name 
 is 'S') and heed the default value and start anyway if called from the 
 command line.

I think such a solution was suggested in an ancient thread, and it was 
concluded that it would not work with file-rc...


 There are plenty of ways to avoid that confusion.

There certainly are some workarounds, but my initial question is still 
unanswered: is it ok to remove the links if I did not create them but 
told the user how to create them?


Nicolas




Re: removing in postrm rc*.d symlinks that I did not create

2004-12-16 Thread Nicolas Boullis
On Thu, Dec 16, 2004 at 12:53:27AM -0500, sean finney wrote:
 On Thu, Dec 16, 2004 at 12:34:21AM +0100, Nicolas Boullis wrote:
  But a user felt concerned that, in the future, he may remove the package 
  and forget to delete the links. Then I thought I could remove the links 
  in postrm on purge, considering they are part of the package's 
  configuration (their absence being the default configuration).
 
 if the package is removed, the init script should just exit with 0
 status.  removing the links during purge would also be appropriate.

So you think lintian is wrong to complain?


 you could also install the links by default, but have some other
 variable in /etc/default/$package control whether or not it actually
 starts (i think somebody else has mentioned this too).

Yes, I know such solutions but don't like them much. But if my 
solution is proved to be wrong, I'll implement such a workaround...


Nicolas




Re: removing in postrm rc*.d symlinks that I did not create

2004-12-16 Thread Nicolas Boullis
Hi,

On Thu, Dec 16, 2004 at 09:13:43AM +0100, Adrian von Bidder wrote:
 On Thursday 16 December 2004 00.34, Nicolas Boullis wrote:
 [de-installing run-level links that weren't installed]
 
 How about installing links as /etc/rc?.d/K??foo - so the links are there and 
 are properly manageable, but the init script will only be called as 'K??foo 
 stop'

Unfortunately, athcool is not a deamon but a program that modifies some 
low-level configuration. Hence, running /etc/init.d/athcool stop 
actually does something (and might break the system) as badly as 
/etc/init.d/athcool start...

I like the idea, but I'm afraid it's not appropriate for athcool, at 
least without reworking the init script...


Cheers,

Nicolas




Re: removing in postrm rc*.d symlinks that I did not create

2004-12-16 Thread sean finney
On Fri, Dec 17, 2004 at 02:16:00AM +0100, Nicolas Boullis wrote:
  if the package is removed, the init script should just exit with 0
  status.  removing the links during purge would also be appropriate.
 
 So you think lintian is wrong to complain?

no, i think lintian is correct to complain, but that you're also
within reason to remove those symlinks if the package is purged.

  you could also install the links by default, but have some other
  variable in /etc/default/$package control whether or not it actually
  starts (i think somebody else has mentioned this too).
 
 Yes, I know such solutions but don't like them much. But if my 
 solution is proved to be wrong, I'll implement such a workaround...

what's so bad about such a solution?  i think it's simple to implement,
easy to understand, and less prone to break.  


sean

-- 


signature.asc
Description: Digital signature


Re: removing in postrm rc*.d symlinks that I did not create

2004-12-16 Thread John Hasler
I wrote:
 Your script should check [$PREVLEVEL].  It will be N if you are booting.

Nicolas writes:
 That's a nice idea, but do you know how fine it would behave with things
 like file-rc?

It should work fine.  Note that this method _only_ controls script
execution at boot time.  If you also want to prevent the service from being
started on a runlevel change you have to do something else such as checking
$0.
-- 
John Hasler




Re: removing in postrm rc*.d symlinks that I did not create

2004-12-16 Thread John Hasler
I wrote:
 If you also want to prevent the service from being started on a runlevel
 change you have to do something else such as checking $0.

Init exports RUNLEVEL, PREVLEVEL, and INIT_VERSION.  Thus INIT_VERSION will
be set if you are booting or changing runlevels.
-- 
John Hasler




Re: removing in postrm rc*.d symlinks that I did not create

2004-12-15 Thread Russ Allbery
Nicolas Boullis [EMAIL PROTECTED] writes:

 A package of mine installs an init script. But as the corresponding
 programs plays with the motherboard's chipset configuration, it is quite
 prone to break the system. So I chose not to install rc*.d symlinks by
 default.

A technique that I've used in packages with this issue is to install the
rc*.d symlinks by default, but also have the init script check a file in
/etc/default to see whether or not to actually start at boot.  If you
install a default /etc/default file that says not to start, you accomplish
the same thing, don't have this problem, and make it just as easy for
users to enable the package.

-- 
Russ Allbery ([EMAIL PROTECTED]) http://www.eyrie.org/~eagle/




Re: removing in postrm rc*.d symlinks that I did not create

2004-12-15 Thread Nicolas Boullis
Hi,

On Wed, Dec 15, 2004 at 04:33:49PM -0800, Russ Allbery wrote:
 
 A technique that I've used in packages with this issue is to install the
 rc*.d symlinks by default, but also have the init script check a file in
 /etc/default to see whether or not to actually start at boot.  If you
 install a default /etc/default file that says not to start, you accomplish
 the same thing, don't have this problem, and make it just as easy for
 users to enable the package.

Thanks for your suggestion.
I already thought about it, but I fnind it quite confusing when I cannot 
run /etc/init.d/foobar by hand as soon as it is not enabled on startup.


Cheers,

Nicolas




Re: removing in postrm rc*.d symlinks that I did not create

2004-12-15 Thread John Hasler
Nicolas writes:
 I already thought about it, but I fnind it quite confusing when I cannot
 run /etc/init.d/foobar by hand as soon as it is not enabled on startup.

Your script should check $PRERUNLEVEL.  It will be N if you are booting.
-- 
John Hasler




Re: removing in postrm rc*.d symlinks that I did not create

2004-12-15 Thread John Hasler
I wrote:
 Your script should check $PRERUNLEVEL.  It will be N if you are booting.
    
That should be $PREVLEVEL.
-- 
John Hasler




Re: removing in postrm rc*.d symlinks that I did not create

2004-12-15 Thread sean finney
On Thu, Dec 16, 2004 at 12:34:21AM +0100, Nicolas Boullis wrote:
 But a user felt concerned that, in the future, he may remove the package 
 and forget to delete the links. Then I thought I could remove the links 
 in postrm on purge, considering they are part of the package's 
 configuration (their absence being the default configuration).

if the package is removed, the init script should just exit with 0
status.  removing the links during purge would also be appropriate.

you could also install the links by default, but have some other
variable in /etc/default/$package control whether or not it actually
starts (i think somebody else has mentioned this too).


sean


-- 


signature.asc
Description: Digital signature