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

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



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.

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 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 i build a test package, called test and try to install it
I get the following output
dpkg -i test_0.1_all.deb
(Reading database ... 70118 files and directories currently installed.)
Unpacking test (from test_0.1_all.deb) ...
/var/lib/dpkg/tmp.ci/config: line 5: ./test: No such file or directory
dpkg: error processing test_0.1_all.deb (--install):
 subprocess new pre-installation script returned error exit status 1
Errors were encountered while processing:
 test_0.1_all.deb



find ./DEBIAN/ -name "*" -print -exec cat '{}' \;
gives

./DEBIAN/test
function sayhello () { echo "(a)$#"; echo "(b) ${1}"; }
echo "file sourced"
./DEBIAN/control
Package: test
Version: 0.1
Section: base
Priority: optional
Architecture: all
Depends: bash,debconf
Maintainer: test team <packages-test@sekon.in>
Description: test package hai je

./DEBIAN/postinst
# Source debconf library.
. /usr/share/debconf/confmodule
. test

sayhello "sekon:postinst" "ohai"

./DEBIAN/config
#!/bin/sh -e

# Source debconf library.
. /usr/share/debconf/confmodule
. ./test

sayhello "sekon:config" "ohai"

./DEBIAN/preinst
#!/bin/bash
# Source debconf library.
. /usr/share/debconf/confmodule
. test

sayhello "sekon:preinst" "ohai"

Also, if i place the test script in $TEMPDIR/tmp/test and then build
and try to install the package i get
/var/lib/dpkg/tmp.ci/config: line 5: /tmp/test: No such file or directory
dpkg: error processing test_0.1_all.deb (--install):
 subprocess new pre-installation script returned error exit status 1
Errors were encountered while processing:
 test_0.1_all.deb

Am i doing anything wrong here ?? searching for "debian control files
source scripts"  is of very little utility.

thank you,
have a great day
Harish Badri Nath


Reply to: