Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

chmod +x /usr/bin/program.sh

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
add comment

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 

or

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.

vi test.sh
dpkg -i file.deb
/usr/bin/program.sh

and run it as ./test.sh

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
add comment

Your Answer

 
discard

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.