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

How do you add new files, eg custom init script into .deb package that you're building?

share|improve this question
Depends on how you're building the .deb file. Please give more details, but generally, you just adjust the "rules" file or the ".install" files. – Kees Cook Sep 25 '11 at 6:27

Flint, the simplest way is to add the file to debian/install, or debian/binary-package-name.install. The format of the file is

source/relative/to/source/root destination/relative/to/system/root

So if you want to put contrib/scripts/admintool into /usr/bin/foo-admintool You'd do:

contrib/scripts/admintool usr/bin/foo-admintool

dh_install, which reads these, is fairly smart and will try to set permissions to the right values.

Specifically for init scripts, there is dh_installinit. You should probably read man dh_installinit to understand it fully, but basically if you have


It will be installed as /etc/init.d/foo and setup to start on installation/boot.

Subsequently, if you write an upstart job


Will be put in as /etc/init/foo.conf

And a symlink will be created as /etc/init.d/foo that points to an upstart wrapper for sysv compatibility.

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.