You are not logged in.

#1 2011-09-26 03:13:21

ibrunton
Member
From: Canada
Registered: 2011-05-05
Posts: 270

How to remove all packages in a group except x, y, and z?

When I installed Arch, I installed KDE.  Since then, I've switched to tiling WMs (Awesome, then DWM), and I really have no need of most of KDE any more.  I still really like Dolphin, though.  Is there a simple way to tell pacman to remove the kde group except for dolphin and its dependencies? (i.e., rather than just removing all of kde and reinstalling the few bits I want.)

Offline

#2 2011-09-26 03:16:03

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: How to remove all packages in a group except x, y, and z?

You can create a list of all packages in kde group minus those needed for packages you want to keep.

Offline

#3 2011-09-26 05:59:58

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: How to remove all packages in a group except x, y, and z?

Try

#!/bin/bash

groups="kde"
packages="kdebase-dolphin kdeutils-kcalc"

comm -23 <(comm -12 <(pacman -Sgq $groups|sort) <(pacman -Qq) | sort) <(for i in $packages; do pactree -u  $i; done | sort)
<thisscriptname> | sudo pacman -Rns -

It allowed me to remove 344 of 396 packages I installed with 'pacman -S kde', both dolphin and kcalc seem to work (they at least start up ;P).
Of course you need to modify which group(s) you want to remove and which packages you want to keep, as well as pacman options - I'm fine with '-Rns' but you may prefer different ones.

Offline

Board footer

Powered by FluxBB