We have a script we is installing multiple packages, but should skip any actions in postinstall scripts.

I tried this:

touch /var/lib/dpkg/info/packagename.postinst
chmod +x /var/lib/dpkg/info/packagename.postinst
/usr/bin/apt-get --force-yes --assume-yes install packagename

But it seems to ovewrite /var/lib/dpkg/info/packagename.postinst

Apt gets dpkg to extract the packages afresh each time it installs. You'll have to use dpkg directly and get it to split the process:

apt-get download <package>
sudo dpkg --unpack <package>*.deb
sudo rm /var/lib/dpkg/info/<package>.postinst -f
sudo dpkg --configure <package>
sudo apt-get install -yf #To fix dependencies

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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