You are not logged in.

#1 2008-06-01 16:57:25

MetalRandomist
Member
Registered: 2007-08-16
Posts: 30

Automatically '-Scc' After Successful Install/Upgrade

How would I make yaourt/pacman automatically clean cache and remove unused repositories after successfully installing or upgrading packages?

Offline

#2 2008-06-01 17:02:38

dyscoria
Member
Registered: 2008-01-10
Posts: 1,007

Re: Automatically '-Scc' After Successful Install/Upgrade

'&&' can be used to run the command only if the first is successful:

pacman -Syu && pacman -Scc --noconfirm

Or you can put this in ~/.bashrc so that when you run the command 'update' the cache will be cleaned after:

alias update='pacman -Syu && pacman -Scc --noconfirm'

Last edited by dyscoria (2008-06-01 17:03:11)


flack 2.0.6: menu-driven BASH script to easily tag FLAC files (AUR)
knock-once 1.2: BASH script to easily create/send one-time sequences for knockd (forum/AUR)

Offline

#3 2008-06-02 19:29:42

MetalRandomist
Member
Registered: 2007-08-16
Posts: 30

Re: Automatically '-Scc' After Successful Install/Upgrade

Much thanks.
I figured out another way, while I was at it:

alias pacman='yaourt'

yaourt () {
        if /usr/bin/yaourt $*; then
                if [[ "$1" == "S" || "$1" == *y* || "$1" == *u* ]]; then
                        /usr/bin/yaourt -SccCc --noconfirm
                fi
        fi
}

Last edited by MetalRandomist (2008-06-02 19:32:23)

Offline

#4 2008-06-04 01:15:52

droog
Member
Registered: 2004-11-18
Posts: 877

Re: Automatically '-Scc' After Successful Install/Upgrade

It looks like with the yaourt -SccCc you will be deleting all your new .pacnew files. I would manually do that or you might have problems later on.

Offline

#5 2008-06-04 04:41:04

Navi
Member
Registered: 2008-02-07
Posts: 10

Re: Automatically '-Scc' After Successful Install/Upgrade

I wouldn't recommend automatically deleting your cache after an upgrade anyways.  What if you need/want to revert?

Offline

#6 2008-06-09 11:22:49

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: Automatically '-Scc' After Successful Install/Upgrade

Navi wrote:

I wouldn't recommend automatically deleting your cache after an upgrade anyways.  What if you need/want to revert?

They are f*cked wink


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

Board footer

Powered by FluxBB