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

Re: HOWTO: Source a common shell script between DEBIAN/config and DEBIAN/preinst



Hi,

your questions are probably better answered on
debian-mentors@lists.debian.org.

On Tue, 18 Jan 2011, harish badrinath wrote:
> Given that i was told that you can deterministically determine which
> file would run first DEBIAN/control _or_ DEBIAN/preinst, I have this
> following query.

You meant DEBIAN/config (and not control). This information is true
but why do you care about the preinst ?

The config script will be called before the "postinst" and that's all
that usually matters.

> I want to source a common file between these two scripts to ensure
> that  if the package cant automatically detect sane values, it prompt
> the user for input as the last resort.

The "DEBIAN" directory is for meta-information, it's definitely not a
good place to store a shell library that shall be shared between a config
script and a preinst script.

> The values given itself are
> trivial in nature, but if not done correctly would make the system
> unusable by locking all the users out of the machine.

When do you expect to use those values? Usually we use values to update a
configuration file and we do that in the postinst. Without the
configuration file the service/program is inactive and should definitely
not lock all users out of the machine.

> ./DEBIAN/preinst
> #!/bin/bash
> # Source debconf library.
> . /usr/share/debconf/confmodule
> . test
> 
> sayhello "sekon:preinst" "ohai"

You have no guaranty that debconf is available when the preinst is run.
You should not use debconf as if it was there for sure.

Note however that if you run debconf here, it will execute the config
script if it has not yet been run. (Your log showed the config script
being executed)

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Follow my Debian News ▶ http://RaphaelHertzog.com (English)
                      ▶ http://RaphaelHertzog.fr (Français)


Reply to: