Originally Posted by
ManamiVixen
If the mediabuntu was a seperate ppa, you could use the ppa-purge command provided by ppa-purge to remove uneeded ppa's and their packages at the same time.
Yes, ppa-purge is the best way to remove all packages installed from a PPA. Unfortunately, medibuntu is not a PPA and cannot be, for legal reasons.
The most straightforward way to purge everything installed from medibuntu is using synaptic. You can filter packages in Synaptic by origin, so it's basically matter of clicking on Origin in the category selector pane on the left and selecting medibuntu repository, then sorting packages by their status (first field in the package selector pane), installed first, and marking all installed packages for complete removal (click on the first package, Shift+click on the last, right click and select Mark for complete removal). You also may define a custom filter either from inside Synaptic (Settings>Filters, click on the New button) or write it in a text file:
Code:
filter "Medibuntu" {
status::flags 0x401;
pattern::patterns {Origin; "medibuntu"; false;};
};
Save it as medibuntu.filter to your home folder, then start Synaptic with
Code:
gksudo synaptic -f ~/medibuntu.filter -iMedibuntu
Doing the same from the command line is relatively easy as long as you don't mix packages for different architectures (e.g. 32-bit and 64-bit packages, see Multiarch).
The command below will do it only for the native architecture:
Code:
sudo apt-get purge `sed -n s/^Package://p /var/lib/apt/lists/*.medibuntu.*_Packages`
In the multiarch environment, the following commands won't purge packages that have siblings from a foreign architecture installed:
Code:
sed -nr 's/^Package:\s*(.*)/\1 purge/p' /var/lib/apt/lists/*.medibuntu.*_Packages|
sudo dpkg --set-selections 2>/dev/null
sudo dpkg -Pa
To include those packages, the sed expression gets rather unwieldly:
Code:
sed -n '
/^Package:\s*/,/^$/{
//{s///;h};/^Architecture:\s*/{s///;H;g;s/[ \t]*\n/:/;s/$/ purge/p}
}' /var/lib/apt/lists/packages.medibuntu.org_*_Packages
And awk is not much better:
Code:
awk -F':[ \t]*' '/^Package:/,/^$/{
if(/^Package:/){p=$2;a=""}
if(/^Architecture:/)a=":"$2
if(/^$/)print p a
}' /var/lib/apt/lists/packages.medibuntu.org_*_Packages
Starting from quantal, installing aptitude will help. The following aptitude command will purge all packages from medibuntu repository:
Code:
sudo aptitude purge ~OMedibuntu
Hopefully this also works the same way in precise, but I'm not quite sure as aptitude got the full multiarch support after precise was released.
In precise, the best command line tool I could come up with for this task (or rather a set of tools) are dctrl-tools, particularly grep-dctrl and tbl-dctrl
Code:
sudo apt-get purge `grep-dctrl -sPackage,Architecture '' /var/lib/apt/lists/*.medibuntu.*Packages|tbl-dctrl -Hd:`
Alternatively, do it the ppa-purge way:
Code:
sed -n s/^Package://p /var/lib/apt/lists/*.medibuntu.*Packages|sort -u|xargs -r dpkg-query -W 2>/dev/null|awk '$2,$0=$1" purge"'|
sudo dpkg --set-selections
sudo dpkg -Pa
In the case of Medibuntu, there is a workaround that may not work with other 3rd party repositories. Maintainer of all packages but one in Medibuntu is Medibuntu Packaging Team, so it's possible to select just packages maintained by them:
Code:
dpkg-query -Wf'${binary:Package}${Maintainer;9}\n'|sed -n 's/Medibuntu$/ purge/p'|sudo dpkg --set-selections
sudo dpkg -Pa
The only package in Medibuntu repsitory that has another maintainer is medibuntu-keyring. To include it, run
Code:
sudo apt-get purge medibuntu-keyring `dpkg-query -Wf'${binary:Package}${Maintainer;9}\n'|sed -n 's/Medibuntu$//p'`
Bookmarks