LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   How-to download all installed packages? (https://www.linuxquestions.org/questions/debian-26/how-to-download-all-installed-packages-267915/)

Outabux 12-18-2004 10:59 PM

How-to download all installed packages?
 
I have a system where I have kept /var/cache/apt/archives clean. Only thing is that sometimes packages disappear from the archives (Im SID) or older versions are desirable. Having gotten a dvd-ram for backup, I would like to now keep those on the dvd-ram.

Question, although, I have used dpkg -l and even pumped that output to a file, how do I take that and use that info to get it into a apt-get install --reinstall -d type script or whatever. There are too many to just use an editor and remove the non-needed info.


Thanks.

corfe 12-19-2004 05:09 PM

Are "dpkg --get-selections" and "dpkg --set-selections" what you want? get-selections outputs to a file, and set-selections reads from it. Then to download you can probably just do about any old action with "apt-get --reinstall -d", like you said. I think it will see all those selections set with dpkg. I haven't personally tried this, but the man pages look like it's close to what you want.

Hope this helps.

Outabux 12-19-2004 05:49 PM

How do I easily remove the "install" or "deinstall" from the file.


corfe 12-20-2004 11:31 AM

I think that the output from get-selections is automagically parsed by set-selections, so you shouldn't have to change the format or anything at all if you're using set-selections.

But if you're using the output from that command to give you a list of packages you can directly "apt-get install", I'm trying to find a solution - it seems this sort of works:

apt-get --reinstall -d install `dpkg --get-selections | grep -v deinstall | sed -e s/'install'//g`

The `dpkg --get-selections | grep -v deinstall | sed -e s/'install'//g` part feeds the list of packages that I believe you're looking for to the apt-get command. When I run this, I'm getting a bunch of errors about the packages not being able to be reinstalled, but I think this is because I already have the dpkg files in my cache folder. I deleted one, but my "php4" package has broken dependencies, so apt can't continue when I try to install that. Anyways, try the above command, let's see what it gives you!

Outabux 12-22-2004 01:06 PM

Thanks, great direction!
 
In light of your suggestion and after an apt-get update, upgrade, clean cycle, I tried the command line. It returned an error about watch--> that is was part of another package.

I then pumped that output to a file, and simply removed watch (or any other offensive packages in future).

Afterwards, I uncommented those entries in my sources.list that were not used currently but needed none the less.

Then,
Code:

RAVEN:/home/jchap# apt-get --reinstall -t unstable -d install `cat package.list`
Reading Package Lists... Done
Building Dependency Tree... Done
Reinstallation of kernel-image-2.6.9-pristine+adk is not possible, it cannot be downloaded.
Reinstallation of kmyfirewall-0.9.6.2 is not possible, it cannot be downloaded.
Reinstallation of libdvdcss2 is not possible, it cannot be downloaded.
The following NEW packages will be installed:
  check
0 upgraded, 1 newly installed, 774 reinstalled, 0 to remove and 0 not upgraded.
Need to get 612MB/612MB of archives.
...

Somehow I got check in there...will have to check on that. Otherwise, great!
The kernel-image and kmyfirewall are those packages compiled from source, libdvdcss2 ...

Anyway, thanks. I'll have to really study upon the formating commands like grep and sed.

This all came about by wanting to create a SID system based upon my packages on another machine. I will keep these files on dvd-ram or dvd-r(w). Dunno yet. Although I found/installed a superior replacement for pixie-plus (showimg), it took a lil time in finding just the right package. If I should find a package has been removed from archives, it may not be removed from mine! Yeah!

Thanks again.

Outabux 12-22-2004 02:09 PM

Here is another! apt-cache pkgnames
 
apt-cache pkgnames does it too without the install, reinstall, deinstall, blah blah blah


Yeah! Still thanks as it put me on right track and those text parsing/formating tools.


All times are GMT -5. The time now is 05:45 PM.