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 apt-get.
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 postinst, 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 useapt-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
.deb:ar -x flashplugin-nonfree_$version_i386.deb. This will result in three files,debian-binary,data.tar.gzandcontrol.tar.gz. You can delete thedebian-binaryfile. - Move
data.tar.gzinto/tmp/flashplugin-nonfree_$version_i386/debian/and thecontrol.tar.gzfile into/tmp/flashplugin-nonfree_$version_i386/debian/DEBIAN. Unpack the archives in these locations and delete the tarballs. - You can now edit the
postinstscript in/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
/tmp/flashplugin-nonfree_$version_i386/and rundpkg-deb --build debian. This should create a file in thedebian/subdirectory calleddebian.deb. You may see some warnings about thecontrolfile containing user-defined fields – these can be safely ignored. - Now move the
debian.debfile into/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-nonfreeorapt-get upgradeand the package will be installed using the new.debfile complete with proxy information in thepostinstscript to enable downloading the binary.
Pingback: Sam Pearson: Random and Irrelevant » Blog Archive » Installing the Flash plug-in on Ubuntu from behind a proxy
Pingback: Hacking .deb files | Debian-News.net - Your one stop for news about Debian