You are not logged in.

#1 2013-10-05 11:00:43

nTia89
Banned
From: varese, italy
Registered: 2008-12-22
Posts: 1,230

[solved] script clean /var

hi folks,

I don't have much space on my /var so I have need to "clean" it frequently,
removing packages from pacman's cache. I remove only if exist an updated version of (as local backup).
e.g.:

youtube-dl-2013.08.14-1-any.pkg.tar.xz
youtube-dl-2013.08.17-1-any.pkg.tar.xz
youtube-dl-2013.09.10-1-any.pkg.tar.xz
youtube-dl-2013.09.16-1-any.pkg.tar.xz
youtube-dl-2013.09.17-1-any.pkg.tar.xz
youtube-dl-2013.09.17-2-any.pkg.tar.xz
youtube-dl-2013.09.17-3-any.pkg.tar.xz
youtube-dl-2013.09.20.1-1-any.pkg.tar.xz
youtube-dl-2013.09.24.2-1-any.pkg.tar.xz

become

youtube-dl-2013.09.24.2-1-any.pkg.tar.xz

any idea on how to create a bash/zsh script ???

thanks

Last edited by nTia89 (2013-10-05 15:04:52)


+pc: custom | AMD Opteron 175 | nForce4 Ultra | 2GB ram DDR400 | nVidia 9800GT 1GB | ArchLinux x86_64 w/ openbox
+laptop: Apple | MacBook (2,1) | 2GB ram | Mac OS X 10.4 -> DIED
+ultrabook: Dell | XPS 13 (9343) | 8GB ram | 256GB ssd | FullHD display | Windows 8.1 64bit ArchLinux x86_64 w/ Gnome

Offline

#2 2013-10-05 11:04:03

msthev
Member
Registered: 2012-04-05
Posts: 177

Offline

#3 2013-10-05 12:16:44

teateawhy
Member
From: GER
Registered: 2012-03-05
Posts: 1,138
Website

Re: [solved] script clean /var

paccache --help

Offline

#4 2013-10-05 12:53:03

nTia89
Banned
From: varese, italy
Registered: 2008-12-22
Posts: 1,230

Re: [solved] script clean /var

teateawhy wrote:
paccache --help

paccache doesn't remove the latest three packages....

instead -c does it but remove also not installed packages....


+pc: custom | AMD Opteron 175 | nForce4 Ultra | 2GB ram DDR400 | nVidia 9800GT 1GB | ArchLinux x86_64 w/ openbox
+laptop: Apple | MacBook (2,1) | 2GB ram | Mac OS X 10.4 -> DIED
+ultrabook: Dell | XPS 13 (9343) | 8GB ram | 256GB ssd | FullHD display | Windows 8.1 64bit ArchLinux x86_64 w/ Gnome

Offline

#5 2013-10-05 13:00:31

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

Re: [solved] script clean /var

nTia89 wrote:

paccache doesn't remove the latest three packages....

By default ...

nTia89 wrote:

but remove also not installed packages....

Is this a problem?

Offline

#6 2013-10-05 13:03:43

nTia89
Banned
From: varese, italy
Registered: 2008-12-22
Posts: 1,230

Re: [solved] script clean /var

I don't see any option:

[mattia@arch-dekstop ~]$ paccache --help
usage: paccache <operation> [options] [targets...]

paccache is a flexible pacman cache cleaning utility, which has numerous
options to help control how much, and what, is deleted from any directory
containing pacman package tarballs.

  Operations:
    -d, --dryrun            perform a dry run, only finding candidate packages.
    -m, --move <dir>        move candidate packages to 'movedir'.
    -r, --remove            remove candidate packages.

  Options:
    -a, --arch <arch>       scan for 'arch' (default: all architectures).
    -c, --cachedir <dir>    scan 'cachedir' for packages (default: /var/cache/pacman/pkg).
    -f, --force             apply force to mv(1) and rm(1) operations.
    -h, --help              display this help message and exit.
    -i, --ignore <pkgs>     ignore 'pkgs', comma separated. Alternatively, specify '-' to
                              read package names from stdin, newline delimited.
    -k, --keep <num>        keep 'num' of each package in 'cachedir' (default: 3).
    --nocolor               remove color from output.
    -u, --uninstalled       target uninstalled packages.
    -v, --verbose           increase verbosity. specify up to 3 times.
    -z, --null              use null delimiters for candidate names (only with -v and -vv)

yes, I want to keep not installed packages


+pc: custom | AMD Opteron 175 | nForce4 Ultra | 2GB ram DDR400 | nVidia 9800GT 1GB | ArchLinux x86_64 w/ openbox
+laptop: Apple | MacBook (2,1) | 2GB ram | Mac OS X 10.4 -> DIED
+ultrabook: Dell | XPS 13 (9343) | 8GB ram | 256GB ssd | FullHD display | Windows 8.1 64bit ArchLinux x86_64 w/ Gnome

Offline

#7 2013-10-05 13:04:35

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

Re: [solved] script clean /var

nTia89 wrote:

I don't see any option

Read again.

Offline

#8 2013-10-05 13:09:04

nTia89
Banned
From: varese, italy
Registered: 2008-12-22
Posts: 1,230

Re: [solved] script clean /var

karol wrote:
nTia89 wrote:

I don't see any option

Read again.

....sorry....

shame on me


+pc: custom | AMD Opteron 175 | nForce4 Ultra | 2GB ram DDR400 | nVidia 9800GT 1GB | ArchLinux x86_64 w/ openbox
+laptop: Apple | MacBook (2,1) | 2GB ram | Mac OS X 10.4 -> DIED
+ultrabook: Dell | XPS 13 (9343) | 8GB ram | 256GB ssd | FullHD display | Windows 8.1 64bit ArchLinux x86_64 w/ Gnome

Offline

#9 2013-10-05 13:23:00

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

Re: [solved] script clean /var

Does it work then? Is paccache what you want?

Offline

#10 2013-10-05 15:04:39

nTia89
Banned
From: varese, italy
Registered: 2008-12-22
Posts: 1,230

Re: [solved] script clean /var

yes, but I can't test it because I've already clean the cache with -Sc

so to be sure I need updates....


+pc: custom | AMD Opteron 175 | nForce4 Ultra | 2GB ram DDR400 | nVidia 9800GT 1GB | ArchLinux x86_64 w/ openbox
+laptop: Apple | MacBook (2,1) | 2GB ram | Mac OS X 10.4 -> DIED
+ultrabook: Dell | XPS 13 (9343) | 8GB ram | 256GB ssd | FullHD display | Windows 8.1 64bit ArchLinux x86_64 w/ Gnome

Offline

#11 2013-10-05 15:12:20

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

Re: [solved] script clean /var

You can copy a package to create some faux packages with a lower (older) version e.g.

-rw-r--r-- 1  252K Oct  5 17:08 xz-1.0.5-1-i686.pkg.tar.xz
-rw-r--r-- 1  252K Oct  5 17:08 xz-2.0.5-1-i686.pkg.tar.xz
-rw-r--r-- 1  252K Oct  5 17:08 xz-3.0.5-1-i686.pkg.tar.xz
-rw-r--r-- 1  252K Oct  5 17:08 xz-4.0.5-1-i686.pkg.tar.xz
-rw-r--r-- 1  252K Jun 30 21:49 xz-5.0.5-1-i686.pkg.tar.xz

and

]$ sudo paccache -dv -k2
==> Candidate packages:

<snip>

xz-1.0.5-1-i686.pkg.tar.xz
xz-2.0.5-1-i686.pkg.tar.xz
xz-3.0.5-1-i686.pkg.tar.xz

Offline

#12 2013-10-05 16:27:48

nTia89
Banned
From: varese, italy
Registered: 2008-12-22
Posts: 1,230

Re: [solved] script clean /var

perfect! thank you karol

fully solved


+pc: custom | AMD Opteron 175 | nForce4 Ultra | 2GB ram DDR400 | nVidia 9800GT 1GB | ArchLinux x86_64 w/ openbox
+laptop: Apple | MacBook (2,1) | 2GB ram | Mac OS X 10.4 -> DIED
+ultrabook: Dell | XPS 13 (9343) | 8GB ram | 256GB ssd | FullHD display | Windows 8.1 64bit ArchLinux x86_64 w/ Gnome

Offline

Board footer

Powered by FluxBB