You are not logged in.

#1 2019-05-18 18:37:53

cowile
Member
Registered: 2019-05-01
Posts: 15

[SOLVED] Upgrade packages using cache only

I have a cron job that downloads new packages every morning.

0 6 * * * pacman --noprogress -Sqyw

I don't want to install them automatically, but I want them already downloaded for when I do install them. However, when I do

pacman -Su

The upgradable packages are downloaded again instead of using the already downloaded packages in the cache. The pacman man page says it is intended behavior for SYNC to always download packages. I can use UPGRADE, but that leaves the problem of figuring out which packages in the cache are the newly upgradable ones.

I can grab packages recently downloaded by using find.

find /var/cache/pacman/ -mindepth 2 -ctime -1 | xargs pacman -U

But this is a hack that will also catch anything else new in the cache.

How can I upgrade packages directly from the cache using the version numbers of the packages themselves?

Last edited by cowile (2019-05-18 20:39:17)


The Linux motto is "Laugh in the face of danger." Oops, wrong one. "Do it yourself." Yes, that's it. -- Linus Torvalds

Offline

#2 2019-05-18 18:43:00

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: [SOLVED] Upgrade packages using cache only

There's no way `pacman -Su` would download new packages unless either 1) the download specified in the cron job failed, 2) something cleared packages from the pacman cache, or 3) some other process is running `pacman -Sy`.

However, all of this is just a very bad design from the start.  You are putting yourself at risk of partial ugprades if you ever try to install a new package with `pacman -S $pkgname`.

Last edited by Trilby (2019-05-18 18:56:51)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2019-05-18 18:48:54

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,845
Website

Re: [SOLVED] Upgrade packages using cache only

pacman --noprogress -Sqyw

I don't think this does what you think it does. You need to tell pacman *what* you want to download.

As Trilby states, this setup increases the risk of partial updates, you would be better off using checkupdates to get up-to-date repo lists, and using those to download the package that can be updated. IIRC, someone has modified checkupdates to include a flag to do this for you, but it hasn't made it's way into the Arch project yet (or else hasn't been released yet).

EDIT: https://git.archlinux.org/pacman-contri … 374a716124

Should be in the next release of pacman-contrib, but in the meantime you could switch to pacman-contrib-git

Last edited by WorMzy (2019-05-18 18:53:28)


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#4 2019-05-18 18:56:35

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: [SOLVED] Upgrade packages using cache only

WorMzy wrote:

I don't think this does what you think it does.

Oops.  Nevermind my three options, as it seems that command doesn't do what I thought it did either.

Cowile, I suspect the command you'd want in your cron job to acheive your goals would be `pacman -Syuw`.  This would avoid the problem you present in this thread - but it'd still not be a good idea due to the risk of partial upgrades.

A safe way to acheive much of what you seem to be intending would be to use

pacman -Syuw --dbpath /path/to/somewhere && \
   mv /path/to/somewhere/*.pkg.tar.xz /var/cache/pacman/pkg/

Last edited by Trilby (2019-05-18 18:59:51)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2019-05-18 20:38:51

cowile
Member
Registered: 2019-05-01
Posts: 15

Re: [SOLVED] Upgrade packages using cache only

Ok, I think I have a better understanding of what to do in this case. Marking solved for the idea of using --dbpath.

Trilby was right in the strikethrough of his first post. pacman SYNC does use packages if they exist in the cache and I only thought it didn't because the cron job failed.


The Linux motto is "Laugh in the face of danger." Oops, wrong one. "Do it yourself." Yes, that's it. -- Linus Torvalds

Offline

#6 2019-05-19 00:34:57

amish
Member
Registered: 2014-05-10
Posts: 470

Re: [SOLVED] Upgrade packages using cache only

@cowile

I have similar cron job but in job I run this:

/usr/bin/pacman -Syuwq --noprogressbar --color=never --noconfirm

May be you are missing that 'u'.

Offline

Board footer

Powered by FluxBB