Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to creat a .deb that, as part of its installation process, pings an external server.

So I have an install_foobar script which does the install.

However, I can't get install_foobar to curl out to the server, or, for that matter, echo out to /tmp.

What is the environment that is created? I am wondering if its some sort of pbuilder-esque world that is removed after the install finishes...

share|improve this question
Paul, you need to clarify here. There are preinstall, and postinstall scripts that run.. Where is install_foobar script running? How did you package it? I suggest reading this page, specifically section 7.6: – balloons Feb 22 '12 at 19:56
@balloons: I haven't the faintest idea. I was handed the package and I'm working on getting it working correctly. I can assure you I've read the debian guide cover to cover and I have not found illumination in it. I'm building it with dpkg-buildpackage. The rules file is the %: dh $@ rules. – Paul Nathan Feb 22 '12 at 22:56
If this is an open source package, you might get a bit more help if you link out or otherwise include the package info. I'm afraid I can't give you anymore info as-is -- it's too vague for me at least to follow what your trying to do. Sorry mate :-( – balloons Feb 27 '12 at 22:21
@balloons: I am sorry too! This is an in-house package. One of my colleagues says that dpkg -i executes in a sort of chroot environment. – Paul Nathan Feb 28 '12 at 2:43
@PaulNathan Does the package have any postinstall or preinstall scripts in the debian/ folder, if so, what are the contents of them? – arand Jun 25 '12 at 20:22

In order to perform any actions besides unpacking files at install/remove time you will need to make use of package maintainer scripts

(Note, "pinging home" is often seen as somewhat dubious practice by software if done without the consent of the user, though seeing as this is an in-house package, I guess that's not really an issue).

A rough example would be using a packagename.postinst something like this:

# postinst script for #PACKAGE#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <postinst> `abort-remove'
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see or
# the debian-policy package

case "$1" in
    echo foo > /tmp/foo # ETC.


        echo "postinst called with unknown argument \`$1'" >&2
        exit 1

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.


exit 0

Obviously you'd need a corresponding removal in the pre/postrm scripts if you added any permanent files in the pre/postinstall scripts.

Templates for preinst, postinst, prerm and postrm scripts are available via the dh-make package, in the files

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.