I am working on Debian packaging source to install few files on user machine. There is common logic that is being used by debconf/config script and postinst script. So, I placed the common logic in a separate file and added it as part of the package under /usr/share/pkg-name/.
Now when I install the package using dpkg everything works fine. First the package is unpacked and the file containing common code base is placed at the said path. Next the debconf/config script reads the file and then prompts the user accordingly.
When I place the file inside a APT repo the same procedure is reversed when I install using apt-get. The package is not unpacked first, instead the debconf prompt is shown and config script is unable to find the script containing common code base.
I want to know why there is a difference in the installation procedure? Is there a way to get the same sequence when installing through apt-get ? All three files are shell scripts.
Is there a better way to handle such common code base to be used by various maintainer scripts ?