I am writing a debian binary package for my application (foo). The postinst (post install) script wants to ask the user few questions and get the answers as well. I am trying to achieve this using debconf. But I am not able to see the UI screen, prompting user with questions. I doubt if my config and templates are even called by dpkg. I am using all the instructions as per the link debconf tutorial Could someone please clarify me on the below questions:
- I am placing the “config” script and “templates “ file inside /debian/tmp/DEBIAN/ . So is it the correct location in debian hierarchy? Are the names correct?
- Are my below scripts correct?
Snippet of control file (only relevant fields I am posting)
Depends: debconf (>= 0.2.17)
Snippet of config file
#!/bin/sh
set -e
#echo "Config being called"
# Source debconf library.
. /usr/share/debconf/confmodule
# Do you like debian?
db_input medium foo/like_debian || true
db_go
# Check their answer.
db_get foo/like_debian
if [ "$RET" = "false" ]; then
# Poor misguided one..
db_input high foo/why_debian_is_great || true
db_go
fi
Snippet of templates file
Template: foo/like_debian
Type: boolean
Description: Do you like Debian?
We'd like to know if you like the Debian GNU/Linux system.
Template: foo/why_debian_is_great
Type: note
Description: Poor misguided one. Why are you installing this package?
Debian is great. As you continue using Debian, we hope you will
discover the error in your ways.
Snippet of preinst:
#!/bin/sh
set -e
#echo "Stage preinst" $1
exit 0
Snippet of postinst:
#!/bin/sh
set -e
#echo "Stage postinst" $1
# Source debconf library.
. /usr/share/debconf/confmodule
db_get foo/like_debian
if [ "$RET" = "false" ]; then
touch "/home/myhome/ITWORKED"
fi
exit 0
Snippet of prerm:
#!/bin/sh
set -e
#echo "Stage prerm" $1
exit 0
Snippet of postrm:
#!/bin/sh
set -e
#echo "postrm" $1
exit 0
Thanks, -Sandeep