Ubuntu – Ignore apt-get postinstall scripts automatically

aptdpkg

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

Best Answer

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
Related Question