PORTSNAP(8) | MidnightBSD System Manager's Manual | PORTSNAP(8) |
portsnap
— fetch
and extract compressed snapshots of the ports tree
portsnap |
[-I ] [-d
workdir] [-f
conffile] [-k
KEY] [-l
descfile] [-p
portsdir] [-s
server] command ...
[path] |
The portsnap
tool is used to fetch and
update compressed snapshots of the mports tree, and extract and update an
uncompressed mports tree.
In a normal update operation, portsnap
will routinely restore modified files to their unmodified state and delete
unrecognized local files.
The following options are supported:
-d
workdir-f
conffile-I
update
command, update INDEX files, but
not the rest of the mports tree.-k
KEY-l
descfilemake describe
in each of the local port
directories.-p
portsdir-s
serverextract
command only, operate only on parts of
the mports tree starting with path. (e.g.
portsnap
extract
sysutils/port would extract sysutils/portsman,
sysutils/portsnap, sysutils/portupgrade, etc.)--interactive
The command
can be any one of the
following:
cron
command.fetch
command was specified. As the name
suggests, this command is designed for running from
cron(8); the random delay
serves to minimize the probability that a large number of machines will
simultaneously attempt to fetch updates.Only run this command to initialize your portsnap-maintained mports tree for the first time, if you wish to start over with a clean, completely unmodified tree, or if you wish to extract a specific part of the tree (using the path option).
extract
command. You must run this command to apply changes to your mports tree
after downloading updates via the fetch
or
cron
commands. Again, note that in the parts of
the mports tree which are being updated, any local changes or additions
will be removed.fetch
or cron
depending on whether stdin is a terminal; then run
update
or extract
depending on whether portsdir exists.0 3 * * * root /usr/sbin/portsnap
cron
to /etc/crontab is a good way to make sure you always have an up-to-date snapshot of the mports tree available which can quickly be extracted into /usr/mports. If your clock is set to UTC, please pick a random time other than 3AM, to avoid overly imposing an uneven load on the server(s) hosting the snapshots.
Note that running portsnap
cron
or portsnap
fetch
does not apply the changes that were
received: they only download them. To apply the changes, you must follow
these commands with portsnap
update
. The portsnap
update
command is normally run by hand at a time
when you are sure that no one is manually working in the mports
tree.
portsnap
update
from cron(8) is a bad
idea -- if you are ever installing or updating a port at the time the cron
job runs, you will probably end up in a mess when
portsnap
updates or removes files which are being
used by the port build. However, running portsnap
-I
update
is probably
safe, and can be used together with
pkg-version(8) to
identify installed software which is out of date.portsnap
to keep
a large number of machines up to date, you may wish to set up a caching
HTTP proxy. Since portsnap
uses
fetch(1) to download
updates, setting the HTTP_PROXY
environment
variable will direct it to fetch updates from the given proxy. This is
much more efficient than
mirroring the
files on the portsnap server, since the vast majority of files are not
needed by any particular client.As an unavoidable part of its operation, a machine running
portsnap
will make its public IP address and the
list of files it fetches available to the server from which it fetches
updates. Using these it may be possible to recognize a machine over an
extended period of time, determine when it is updated, and identify which
portions of the MidnightBSD ports tree, if any, are being ignored using
"REFUSE" directives in portsnap.conf. In
addition, the MidnightBSD release level is transmitted to the server.
Statistical data generated from information collected in this manner may be published, but only in aggregate and after anonymizing the individual systems.
Fetch the snapshots and create the mports(7) tree under /usr/mports:
portsnap
fetch extract
Update the mports tree:
portsnap
fetch update
Colin Percival <cperciva@FreeBSD.org>
July 1, 2018 | MidnightBSD |