You are not logged in.

#1 2008-12-18 03:58:09

handy
Member
From: Oz
Registered: 2008-03-26
Posts: 719

[SOLVED] Script to clear all but the current packages from cache?

Has anyone written, found such a script, or like to write one? smile cool

It just has to delete all older duplicate packages in /var/cache/pacman/pkg/ .  After which keeping a superseded copy of packages just comes down to when you use the script.

It would keep the /var/cache/pacman/pkg/ directory slimmer, (though it would still have more than is required in it I know) & ensure a quick recovery through downgrading to a known good package when required.

It would be so easy to run the script before an -Syu --aur  so that if you have any problems you still have the superseded version of whatever, that you can downgrade to until the problem is solved


__________________

Last edited by handy (2008-12-18 07:37:10)


I used to be surprised that I was still surprised by my own stupidity, finding it strangely refreshing.
Well, now I don't find it refreshing.
I'm over it!

Offline

#2 2008-12-18 04:07:43

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,672
Website

Re: [SOLVED] Script to clear all but the current packages from cache?

man pacman wrote:

SYNC OPTIONS
       -c, --clean
           Remove packages that are no longer installed from the cache as well
           as currently unused sync databases to free up disk space. When
           pacman downloads packages, it saves them in a cache directory. In
           addition, databases are saved for every sync DB you download from,
           and are not deleted even if they are removed from the configuration
           file pacman.conf(5). Use one --clean switch to only remove packages
           that are no longer installed; use two to remove all packages from
           the cache. In both cases, you will have a yes or no option to
           remove packages and/or unused downloaded databases.

           If you use a network shared cache, see the CleanMethod option in
           pacman.conf(5).

Does "pacman -Sc" not do what you are suggesting?

Offline

#3 2008-12-18 07:07:57

Denacke
Member
Registered: 2008-04-09
Posts: 106

Re: [SOLVED] Script to clear all but the current packages from cache?

I don't think it is.

He still wants to be able to downgrade. The problem is, right now I have for example, 6 kernel packages. It would be handy to only have the latest 2, so you could still be able to downgrade.

Offline

#4 2008-12-18 07:17:53

handy
Member
From: Oz
Registered: 2008-03-26
Posts: 719

Re: [SOLVED] Script to clear all but the current packages from cache?

Allan wrote:

Does "pacman -Sc" not do what you are suggesting?

Yes thanks Alan, I think, that this should do the job for me, if I don't clean the .../pkg/ directory until I'm sure that I don't have to downgrade anything after an -Syu , then I will have a backup of what I know works & can leave that there until I'm sure of the latest system upgrade.

Thanks for taking the time to educate me about something that I really should have found out for myself. ;-)  I have always been looking for something else whenever I have done any reading on Pacman/Yaourt & missed it.


I used to be surprised that I was still surprised by my own stupidity, finding it strangely refreshing.
Well, now I don't find it refreshing.
I'm over it!

Offline

#5 2008-12-18 07:25:08

handy
Member
From: Oz
Registered: 2008-03-26
Posts: 719

Re: [SOLVED] Script to clear all but the current packages from cache?

Denacke wrote:

I don't think it is.

He still wants to be able to downgrade. The problem is, right now I have for example, 6 kernel packages. It would be handy to only have the latest 2, so you could still be able to downgrade.

Well, as written above, I think it probably will do me.  I only need to keep the last known good, when a problem comes in I can downgrade if I have to, when the problem(s) are sorted I can do away with the cache.

If you want to be able to access redundant kernels here is a how-to I stole & posted on the Ubuntu forums back when we had the kernel bug:

http://ubuntuforums.org/showthread.php?t=954481


I used to be surprised that I was still surprised by my own stupidity, finding it strangely refreshing.
Well, now I don't find it refreshing.
I'm over it!

Offline

#6 2008-12-18 12:26:00

erythrocyte
Member
Registered: 2008-10-21
Posts: 25

Re: [SOLVED] Script to clear all but the current packages from cache?

Just wondering if this thread helps http://bbs.archlinux.org/viewtopic.php?id=29555

Offline

#7 2008-12-19 02:13:04

handy
Member
From: Oz
Registered: 2008-03-26
Posts: 719

Re: [SOLVED] Script to clear all but the current packages from cache?

erythrocyte wrote:

Just wondering if this thread helps http://bbs.archlinux.org/viewtopic.php?id=29555

Thanks for that link erythrocyte smile it is a beauty.

Unfortunately I didn't find that page when I searched.


I used to be surprised that I was still surprised by my own stupidity, finding it strangely refreshing.
Well, now I don't find it refreshing.
I'm over it!

Offline

#8 2008-12-23 14:59:57

erythrocyte
Member
Registered: 2008-10-21
Posts: 25

Re: [SOLVED] Script to clear all but the current packages from cache?

handy wrote:
erythrocyte wrote:

Just wondering if this thread helps http://bbs.archlinux.org/viewtopic.php?id=29555

Thanks for that link erythrocyte smile it is a beauty.

Unfortunately I didn't find that page when I searched.

You're welcome smile .

Offline

Board footer

Powered by FluxBB