Feeding the output of "diff" or "cat" command to dpkg --purge
I created a list of packages installed on my system (say A) with the following command:
Code:
dpkg --get-selections > packages_on_A.txt Code:
dpkg --get-selections > packages_on_B.txt Then I diff'ed the above two files: Code:
diff packages_on_A.txt packages_on_B.txt Code:
splashy I can do it manually by running dpkg --purge couple of times. But I was wondering if there is any way by which I can pass the output of the diff command to dpkg --purge as arguments. I know this is a very trial task but somehow I am not able to figure out. I am using Debian etch (stable). I use apt-get and I DON'T intend to use aptitude or dselect. |
Shell scripting
you could create a shell script with something like this in it
Code:
#!/bin/bash Hope this helps and don't forget to make this file executable using Code:
chmod +x uninstall.sh |
Try with: dpkg -P `diff packages_on_A.txt packages_on_B.txt | awk '{print $2}'|sed -e '1d'`
NB, those are backticks. |
Thank you guys for your inputs. I would try not to use shell script because that will mean that I have to carry/copy the script where ever I do this. I have to do this on a regular basis on 10s of systems so would be nice to have a simple command line.
|
If you want to skip awk and sed you can do it manually in steps:
Code:
diff packages_on_A.txt packages_on_B.txt > packdiff Code:
dpkg -P `cat packdiff` |
Quote:
Thanks Makuyl. |
could have just used the standard dselect-upgrade method to make the package sets match
dpkg --get selections > selections.txt on the box you want as the master package list.. dpkg --set-selections < selections.txt - Sets the package list on the new machine to match the list you created apt-get dselect-upgrade - on the new machine Quote:
No it's not a purge but a few config files don't add up to much. |
Quote:
Quote:
Quote:
|
Nice..
I was looking to see if aptitude supported the dselect-upgrade function and I was unable to find mention of support for that command in the docs.. do you know of a way to do that function with aptitude ? |
Quote:
Quote:
Code:
sudo dpkg -P `dpkg -l|grep ^r|awk '{print $2}'` |
All times are GMT -5. The time now is 11:51 PM. |