You are not logged in.

#1 2020-06-06 09:40:07

Spheerys
Member
Registered: 2012-05-01
Posts: 92

[Pacman] Using mounted cachedir if exist, and local cachedir if not

Hi,

I have a several Arch computers at home and I have a NAS with NFS mount
To avoid to download several times the same new packages with pacman and yay, I'm using an alias like this :

alias up='sudo mount -a && sudo pacman -Syu  --cachedir /media/NAS/pacman/pkg --cachedir /var/cache/pacman/pkg && yay -Syua  --cachedir /media/NAS/pacman/pkg --cachedir /var/cache/pacman/pkg'

If the mount is not there, the second cachedir is used.

It's working well but I would prefer to set globally the different cachedir priorized  to use pacman and yay command directly if I need, instead of my "up" alias

I have found the pacman the parameter CacheDir :

CacheDir    = /media/NAS/pacman/pkg/
CacheDir    = /var/cache/pacman/pkg/

The problem is when the NAS is not mounted (because out of home), when using pacman or yay I have this warning :

warning : the cache /media/NAS/pacman/pkg/ directory doesn't exist, creating it...

And as result, the package is created locally on /media/NAS/pacman/pkg/, but not on the second specified CacheDir /var/cache/pacman/pkg/

What is the best way to have a universal and robust solution for this purpose ?

Last edited by Spheerys (2020-06-06 15:58:45)

Offline

#2 2020-06-06 18:07:58

Awebb
Member
Registered: 2010-05-06
Posts: 6,688

Re: [Pacman] Using mounted cachedir if exist, and local cachedir if not

This might sound like solid cowboy admin stuff, but have you ever tried to mount a share to a folder with files in it?

Make a folder and touch a folder/file, then mount a share to folder/ and touch a folder/anotherfile. Unmount folder and see what happens.

You might want to have a look at pacserve in the AUR. I'm not sure if Xyne still puts time into it, but it might be better than your approach.

Offline

Board footer

Powered by FluxBB