List of packages upgraded last time `pkg upgrade` was executed

Mike Andrews mandrews at bit0.com
Thu Jan 28 00:00:10 UTC 2021


On Wed, 27 Jan 2021, Yasuhiro Kimura wrote:

> From: Freddie Cash <fjwcash at gmail.com>
> Subject: Re: List of packages upgraded last time `pkg upgrade` was executed
> Date: Tue, 26 Jan 2021 17:26:29 -0800
>
>> /var/log/messages and I think /var/log/daemon include the output of the pkg
>> commands. If you have the log files backed up from the last time it was
>> run, you could grep for pkg in those.
>>
>> No idea if this info is also stored in the sqlite databases pkg uses.
>
> Thank you for reply. But my intention is to write shell script that
> gets the list of upgraded packages and does something by using
> it. Because of that the list need to be gotton without any user
> interaction. So unfortunately your method is not applicable to my
> case.

Try something like this as a starting point for a shell script:

sqlite3 /var/db/pkg/local.sqlite \
  "select datetime(time,'unixepoch'),origin,version from packages \
  where datetime(time,'unixepoch')>=date('now','-7 day') \
  order by time desc"


More information about the freebsd-ports mailing list