FreeBSD From Scratch
Prev |  | Next

# 5 Stage Two: Ports Installation

> Note: 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.:

    www mozilla make WITHOUT_MAILNEWS=yes WITHOUT_CHATZILLA=yes install

In fact you can specify arbitrary shell commands, so you are not restricted to simple `make` invocations:

    java jdk16            echo true > files/license.sh; make install BATCH=yes < /dev/null
    print acroread8       yes accept | make install PAGER=ls
    x11-fonts gnu-unifont make install && mkfontdir /usr/local/lib/X11/fonts/local
    news inn-stable       CONFIGURE_ARGS="--enable-uucp-rnews --enable-setgid-inews" make install

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

    news inn-stable make CONFIGURE_ARGS="--enable-uucp-rnews --enable-setgid-inews" install

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.

    # vim: syntax=sh
    # $Id: stage_2.conf.default,v 1.2 2004/03/06 12:50:30 toor Exp toor $
    # $FreeBSD: doc/en_US.ISO8859-1/articles/fbsd-from-scratch/stage_2.conf.default,v 1.4 2008/12/03 21:59:51 schweikh Exp $
    ports-mgmt portaudit
    devel ccache
    shells zsh
    devel gettext
    archivers unzip
    archivers zip
    security sudo
    x11 xorg
    x11-servers xorg-server
    x11-fonts xorg-fonts-100dpi
    x11-fonts xorg-fonts-75dpi
    x11-fonts xorg-fonts-miscbitmaps
    x11-fonts xorg-fonts-truetype
    x11-fonts xorg-fonts-type1
    x11-fonts gnu-unifont make install && mkfontdir /usr/local/lib/X11/fonts/local
    x11-fonts urwfonts
    x11-fonts webfonts
    x11-toolkits open-motif
    x11-wm ctwm
    x11 wdm
    security openssh-askpass
    astro xplanet
    astro xephem
    editors vim
    print ghostscript8
    print psutils-a4
    print a2ps-a4
    print gv
    print transfig
    print teTeX
    print cups-base
    emulators linux_base-fc6
    print acroread8 yes accept | make install PAGER=ls
    java jdk16 echo true > files/license.sh; make install BATCH=yes < /dev/null
    www apache22
    www amaya
    www firefox3
    www checkbot
    www p5-HTML-Parser
    www validator
    www mplayer-plugin
    math p5-Math-Combinatorics
    math p5-Bit-Vector
    graphics evince
    graphics xfig
    graphics xv
    graphics gphoto2
    multimedia xawtv
    lang expect
    lang gawk
    lang python
    news tin
    net freebsd-uucp
    net cvsup-without-gui
    net rsync
    ftp wget
    textproc ispell
    german ispell-neu
    german ispell-alt
    textproc docproj
    sysutils samefile
    sysutils smartmontools
    sysutils pstree
    sysutils cdrtools
    sysutils dvd+rw-tools
    sysutils grub
    sysutils lsof
    devel subversion-freebsd
    devel bcc
    devel ddd
    devel gindent
    devel ctags
    devel ElectricFence
    devel strace
    devel perltidy
    mail procmail
    mail metamail
    mail mutt-devel
    ports-mgmt portupgrade
    news inn CONFIGURE_ARGS="--enable-uucp-rnews --enable-setgid-inews" make BATCH=yes install < /dev/null
    misc figlet-fonts
    security gpa
    mail spamoracle
    textproc rman
    multimedia mplayer
    multimedia mplayer-fonts
    multimedia acidrip
    multimedia ogle
    multimedia ogle-gui
    audio pacpl
    audio p5-CDDB_get
    audio cowbell
    shells bash
    editors openoffice.org-3-RC
    java eclipse
    java netbeans

Download `stage_2.conf.default`.

Prev | Home | Next
Stage One: System Installation |  | Stage Three