[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Custom Debian package installation



Hi,

On Wed, Apr 09, 2008 at 09:35:53PM +1000, David Schulberg wrote:
> So how can I actually check in my initscript that it is running during
> the installation process so I can skip the start of my service at that
> time?

Using debhelper I'm not sure if that's possible at all.  I would not
consider it a bug if it isn't, because there's no good reason to ever
need the information.  You don't want "is this run during the
installation?", but "is the configuration file already set up?".

The usual method for doing this is described in the e-mail you quoted,
and I quote it again below.  The reason to do it this way, and not how
you suggest, is that you cannot rely on the user to edit the
configuration file before the next reboot.  What if the user is in a
hurry, but just installs the package and then shuts down.  The next time
he boots, he plans to edit the config file.  But then the service is
started with the default, which was wrong.

This is easily avoided: if the default configuration is wrong (so it's
really just a template), then the init script should not start until
it's edited, no matter how oft it's tried.  Another solution is to use
debconf to create a sensible configuration file during the install.
Then it is fine to start it after the install, because by that time a
good file will be installed.

Thanks,
Bas

> -----Original Message-----
> On Mon, Apr 07, 2008 at 07:43:34AM +1000, David Schulberg wrote:
> > I have a Debian package which starts a service set up by having
> > ‘dh_installinit’ in my rules file.
> > 
> > I want the service to start every time my computer boots up.
> > 
> > Does it also have to fire up straight after I install the package?
> > 
> > I have a configuration file that is part of my package which needs
> > to be customised before I run the service that  is installed by
> > the package so I don’t want to run the service until I have done
> > that.
> 
> The way this is usually tackled is to either have the initscript
> refuse to start the service if not yet configured (but still exit
> with an okay return value so package installation succeeds), or ship
> a file in /etc/default/ sourced by the initscript and containing a
> switch variable to make the initscript's start function a no-op
> (until edited to turn it on).
> -- 

-- 
I encourage people to send encrypted e-mail (see http://www.gnupg.org).
If you have problems reading my e-mail, use a better reader.
Please send the central message of e-mails as plain text
   in the message body, not as HTML and definitely not as MS Word.
Please do not use the MS Word format for attachments either.
For more information, see http://pcbcn10.phys.rug.nl/e-mail.html

Attachment: signature.asc
Description: Digital signature


Reply to: