Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Well, I like to mark /usr/bin/ as executable using following command:

chmod +x /usr/bin/

I want the above command to be executed at the end of installation of the Debian package.

Is there a painless way to inject the command into the deb?

Thanks for looking!

share|improve this question

1 Answer 1

up vote 5 down vote accepted

use dpkg-deb to extract the .deb file

Create a temp dir

mkdir temp

Extract the .deb file to temp directory

dpkg-deb -x file.deb temp/
cd temp/
dpkg-deb -e file.deb

Now change the DEBAIN/postinst file. This script be called right after the installation of package. So add the code which is needed for you.

Rebuild the package

dpkg-deb -b . file.deb 


If you don't want to edit .deb file. Create a simple shell script to call the .deb and the command you want to run.

dpkg -i file.deb

and run it as ./

Hope this helps

share|improve this answer
Clean answer, thanks a lot! –  Naveen Oct 16 '12 at 11:14
@Naveen glad that helped. –  devav2 Oct 16 '12 at 11:27

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.