It is also possible to install the (precompiled)
packages at this stage, instead of compiling ports. In this case,
stage_2.sh
would be nothing more than a list of
pkg_add
commands. I trust you know how to write
such a script. Here we concentrate on the more flexible and
traditional way of using the ports.
The following stage_2.sh
script is how I
install my favorite ports. It can be run any number of times and
will skip all ports that are already installed. It supports the
dryrun option (-n
) to just
show what would be done. You run it like stage_1.sh
with exactly one argument to denote a config file, e.g.
#
./stage_2.sh default
which will read the list of ports from
stage_2.conf.default
.
The list of ports consists of lines with two or more space
separated words: the category and the port, optionally followed by
an installation command that will compile and install the port
(default: make install BATCH=yes < /dev/null
).
Empty lines and lines
starting with # are ignored. Most of the time it suffices to only
name category and port. A few ports however can be fine tuned by
specifying make
variables, e.g.:
In fact you can specify arbitrary shell commands, so you are
not restricted to simple make
invocations:
The first two lines are examples how you can handle ports
asking you to accept a licence. Note how the line for
news/inn-stable
is an example
for a one-shot shell variable assignment to
CONFIGURE_ARGS
. The port
Makefile
will use this as an initial value
and augment some other essential args. The difference to
specifying a make variable on the command line
with
is that the latter will override instead of augment. It depends on the particular port which method you want.
Be careful that your ports do not use an interactive install, i.e.
they should not try to read from stdin other than what you explicitly
give them on stdin. If they do, they will read the next line(s) from
your list of ports in the here-document and get confused. If
stage_2.sh
mysteriously skips a port or stops
processing, this is likely the reason.
Below is stage_2.conf.default
. A log file named
LOGDIR/category+port
is created for each port
it actually installs.
Download stage_2.conf.default
.
This, and other documents, can be downloaded from http://ftp.FreeBSD.org/pub/FreeBSD/doc/
For questions about FreeBSD, read the
documentation before
contacting <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.