This is a follow-up to my previous post about downloading the Ubuntu Flash plugin package from behind a proxy. Rather than having to go through a failed installation, editing the
postinst script then re-installing, here is an alternative method where the package is downloaded, unpacked, the script edited then the package rebuilt and installed in the normal way using
The procedure below uses
flashplugin-nonfree as an example package, but this process could be used to edit any
.deb with a little care – just change the package name.
Having said that, it’s a quick-and-dirty fix-up and as such only really suitable if you only need to make simple changes to the control scripts such as
prerm, etc, in an existing package. Major changes to a package’s structure or contents will need more care and you should take a look at the Debian Maintainers Guide or any of the other HOWTOs and FAQs available on the web for detailed information on how to do this.
Needless to say you’ll need to do much of this as
root. Have a care.
- Download the updated debian package using
apt-get -d install flashplugin-nonfree. This will place the latest version of the package in
/var/cache/apt/archiveswithout actually installing it. Note that if you have multiple updates to do, you can use
apt-get -d upgradeinstead; this will also download any other packages that are currently due an upgrade at the same time – this is fine, they will be installed normally at the end of the process along with the modified package.
- Change your working directory to
/var/cache/apt/archivesthen make a backup:
cp flashplugin-nonfree_$version_i386.deb /root/
- Create a tempory directory structure where you can unpack the archive:
mkdir -p /tmp/flashplugin-nonfree_$version_i386/debian/DEBIAN
- Extract the contents of the
ar -x flashplugin-nonfree_$version_i386.deb. This will result in three files,
control.tar.gz. You can delete the
/tmp/flashplugin-nonfree_$version_i386/debian/DEBIAN. Unpack the archives in these locations and delete the tarballs.
- You can now edit the
/tmp/flashplugin-nonfree_$version_i386/debian/DEBIANto include the proxy settings as outlined in Installing the Flash plug-in on Ubuntu from behind a proxy.
- Now you are ready to rebuild the package. Change directory to
dpkg-deb --build debian. This should create a file in the
debian.deb. You may see some warnings about the
controlfile containing user-defined fields – these can be safely ignored.
- Now move the
/var/cache/atp/archivesusing the same filename as the original package:
mv debian.deb /var/cache/atp/archives/flashplugin-nonfree_$version_i386.deb.
- You should now be able to run
apt-get install flashplugin-nonfreeor
apt-get upgradeand the package will be installed using the new
.debfile complete with proxy information in the
postinstscript to enable downloading the binary.