DebianThis forum is for the discussion of Debian Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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.
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.
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:
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!
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!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.