Re-2: Ports question ....

steve freebsd-questions at
Fri Aug 29 14:20:43 UTC 2014

-------- Original Message --------
Subject: Re: Ports question .... (29-Aug-2014 14:45)
From:    Arthur Chance <freebsd at>
To:      freebsd-questions at

> On 29/08/2014 13:59, William A. Mahaffey III wrote:
> [huge snip]
> > I have been using portsnap, I just couldn't figure out how to get it to
> > tell me what ports had been updated since I last fetched (w/o fetching
> > again) ....
> It's my experience that you don't want to be told which ports have been 
> updated, as most updates are to ports you're not the slightest bit 
> interested in. There are nearly 25,000 ports according to FreshPorts and 
> I personally have only about 400 installed on my desktop machine (and 
> far fewer on my servers). That means on average I'm totally uninterested 
> in 98+% of all port updates.
> What you need to know is what *installed* ports are out of date with 
> respect to the new ports tree. That's where the 400.status-pkg periodic 
> script is useful. I update my ports tree via a crontab entry at 23:00 on 
> Fridays, and the weekly periodic script runs at 4:15 on Saturday, so I 
> get mail every Saturday morning telling me which installed ports are out 
> of date.

For what it's worth I have two scripts I've created.

# ll /usr/local/sbin/scs-check-for-*

# less /usr/local/sbin/
/usr/sbin/portsnap cron update && /usr/sbin/pkg version -vIL=

# less /usr/local/sbin/
/usr/sbin/portsnap fetch update && /usr/sbin/pkg version -vIL=
read -r -p "Press Enter key to continue..." key
less /usr/ports/UPDATING

and then I have a symlink set to call the cron version on a daily basis.

ll /etc/periodic/daily/*scs-check-for-ports*
lrwxr-xr-x  1 root  wheel    51B Jan 14  2013 /etc/periodic/daily/ -> /usr/local/sbin/

The use of the cron command vs a simple fetch means portsnap waits a random time between 0 and 3600 seconds (1 hour) before fetching. This helps to prevent everyone hitting the port tree servers at exactly the same time (usually we admins cron on the hour).

# portsnap
usage: portsnap [options] command ... [path]

  -d workdir   -- Store working files in workdir
                  (default: /var/db/portsnap/)
  -f conffile  -- Read configuration options from conffile
                  (default: /etc/portsnap.conf)
  -I           -- Update INDEX only. (update command only)
  -k KEY       -- Trust an RSA key with SHA256 hash of KEY
  -l descfile  -- Merge the specified local describes file into the INDEX.
  -p portsdir  -- Location of uncompressed ports tree
                  (default: /usr/ports/)
  -s server    -- Server from which to fetch updates.
  path         -- Extract only parts of the tree starting with the given
                  string.  (extract command only)
  fetch        -- Fetch a compressed snapshot of the ports tree,
                  or update an existing snapshot.
  cron         -- Sleep rand(3600) seconds, and then fetch updates.
  extract      -- Extract snapshot of ports tree, replacing existing
                  files and directories.
  update       -- Update ports tree to match current snapshot, replacing
                  files and directories which have changed.

Because this script is cron daily in my "[HOSTNAME] daily run output" email I get every morning I see something like....

amavisd-new-2.8.0_2,1              <   needs updating (index has 2.9.1,1)
syslog-ng-                  <   needs updating (index has 3.5.6_3)



To: freebsd at
    wam at
    freebsd-questions at

This email is for the use of the intended recipient(s) only. If you have received this email in error, please notify the sender immediately and then delete it. 
If you are not the intended recipient, you must not keep, use, disclose, copy or distribute this email without the authors prior permission. 
We have taken precautions to minimise the risk of transmitting software viruses, but we advise you to carry out your own virus checks on any attachment to this message.
We cannot accept liability for any loss or damage caused by software viruses.
The information contained in this communication may be confidential and may be subject to the attorney-client privilege. 
If you are the intended recipient and you do not wish to receive similar electronic messages from us in future then please respond to the sender to this effect.

More information about the freebsd-questions mailing list