Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have installed some 3rd party deb packages from a PPA, which now have deleted the packages.

Is it somehow possible to reconstruct the packages as I have host where they are installed on?

share|improve this question
add comment

4 Answers

up vote 6 down vote accepted

It is possible the packages are still in your local .deb cache. See if it is there first before trying to rebuild it.

Try looking in /var/cache/apt/archives. That's where the apt cache is located on my Debian boxes (it should be in the same location on Ubuntu).

As @Zoredache mentions: If you are in the habit of running apt-get clean your local cache will be empty. Please see his answer on how to rebuild the package using the control file and scripts.

share|improve this answer
    
Bah that is the easy answer, you are assuming the archive is in the cache. :) It isn't wrong, but it assumes you don't run apt-get clean frequently. The cache location is identical on Ubuntu. –  Zoredache Nov 29 '11 at 18:00
    
I was always taught to "solve the easy problem" first... but you get my upvote for technical correctness and complete-ness. –  kce Nov 29 '11 at 19:37
add comment

You could track down where the packages drop stuff, and use FPM

I just did this to build a deb from an installed webapp. fpm -s dir -t deb -n "webapp1" -v 1.0-mywebapp /var/www/pathtowebapp

share|improve this answer
add comment

It should be possible, but it will be a bit tricky.

A properly created Debian package when installed will leave most of the important details you need to do this in /var/lib/dpkg/info.

The first important file is /var/lib/dpkg/info/foo.list which should be a list of all the files included in the original package that were installed on your system. So start making a copy of all this files into some temporary directory.

The binary version of a Debian package will include a control archive that includes several scripts. Grab /var/lib/dpkg/info/foo.(postinst|postrm|preinst|prerm) those are your install/uninstall scripts. Another way to get a list is to run dpkg-query -c foo.

The other file you would need to create a Debian package is the control file. AFAIK, the package control file is not stored anywhere on the system, but you can get something close enough that you can reconstruct it by running the command dpkg-query -s foo | grep -v 'Status:'.

Anyway, with the file installed by the package and all the control files you should be able to re-construct the package. This Debian Binary Package Building HOWTO should give you enough details on how to use dpkg-deb to do this.

share|improve this answer
add comment

Under debian you have dpkg-repack for this task. Its just a perl-script and runs since debian/sarge. It also should do the trick under ubuntu.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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