debian ubuntu deb deb-package preinst postinst prerm
Source
-
unpack the .deb archive to a temporary directory
mkdir tmp sudo dpkg-deb -R my-package.deb tmp
-
edit the scripts inside the temporary directory
-
optionally: fix the permissions on the maintainer scripts to be
>=0555
and<=0755
, e.g.sudo chmod 0755 tmp/DEBIAN/preinst
-
package the files in the temporary directory into a .deb archive again
sudo dpkg-deb -b tmp my-package-fixed.deb
-
then simply install the fixed package as usual
sudo apt-get install ./my-package-fixed.deb