Minor improvements to all stages and documentation.

This commit is contained in:
Jens Schweikhardt 2004-01-21 19:39:26 +00:00
parent 829da6853b
commit 978f249f2c
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=19774
6 changed files with 181 additions and 73 deletions

View file

@ -181,7 +181,8 @@
you have to consider the downtime caused by stage two. The ports
compiled by <filename>stage_2.conf.default</filename> below require
about 4 hours to build on an AMD1800+ SCSI system with 10krpm disks
and 1GB of RAM.</para>
and 1GB of RAM. If you prefer to install packages instead of ports,
you can significantly reduce the downtime to about 10 minutes.</para>
</listitem>
</itemizedlist>
@ -248,7 +249,7 @@
<filename>stage_1.conf.default</filename> and write a log to
<filename>stage_1.log.default</filename>.</para>
<para>The following is my <filename>stage_1.conf.default</filename>.
<para>Further below you find my <filename>stage_1.conf.default</filename>.
You need to customize it in various places to match your idea of the
<quote>perfect system</quote>. I have tried to extensively comment
the places you should adapt. The configuration script must provide
@ -286,15 +287,16 @@
<para>What you want immediately after booting the new system and
even before starting stage two. The reason for not simply
installing all my beloved ports during stage one is that in
theory and in practice there are bootstrap and consistency
issues: stage one has your old kernel running, but the chrooted
environment consists of new binaries and headers. If the new
system for example supports a new system call (according to its
headers), some configure-type script might try to use it and get
killed because it executes on the old kernel. I have seen other
issues when I tried building <filename
role="package">lang/perl5</filename>.</para>
chrooting to the new system during stage one and installing
all my beloved ports is that in theory and in practice there
are bootstrap and consistency issues: stage one has your old
kernel running, but the chrooted environment consists of new
binaries and headers. If the new binaries use a new system
call, these binaries will die with <literal>SIGSYS, Bad
system call</literal>, because the old kernel does not have
that system call. I have seen other issues when I tried
building <filename role="package">lang/perl5</filename>.</para>
</listitem>
</itemizedlist>
@ -568,10 +570,24 @@ Creating bzip'd tar ball in '/usr/ports/editors/staroffice52/staroffice-5.2_1.tb
is only available for base system files, not for anything installed
by ports. Some third party software seems to be especially designed
to keep me on my toes by changing the config file format every
fortnight. All you can do is be alert, especially when the major
version number bumps. In the past I had to tweak or rewrite files
for web servers, news servers and readers. All software actively
maintained is a prime candidate for config file scrutiny.</para>
fortnight. To detect such silent changes, I keep a copy of the
modified config files in the same place where I keep
<filename>stage_3.mk</filename> and compare the result with a
<application>make</application> rule, e.g. for
<application>apache</application>'s <filename>httpd.conf</filename>
in target <command>config_apache</command> with</para>
<programlisting>
@if ! cmp -s /usr/local/etc/apache2/httpd.conf httpd.conf; then \
echo "ATTENTION: the httpd.conf has changed. Please examine if"; \
echo "the modifications are still correct. Here is the diff:"; \
diff -u /usr/local/etc/apache2/httpd.conf httpd.conf; \
fi
</programlisting>
<para>If the diff is innocuous I can make the message go away with
<command>cp /usr/local/etc/apache2/httpd.conf
httpd.conf</command>.</para>
<para>I have used &scratch.ap; several times to update a
<literal>5-CURRENT</literal> to <literal>5-CURRENT</literal>, i.e.

View file

@ -1,6 +1,6 @@
# This file: stage_1.conf.default, sourced by stage_1.sh.
#
# $Id: stage_1.conf.default,v 1.1 2004-01-03 15:46:31 schweikh Exp $
# $Id: stage_1.conf.default,v 1.2 2004-01-21 19:39:26 schweikh Exp $
# $FreeBSD$
# Root mount point where you create the new system. Because it is only
@ -26,25 +26,22 @@ create_file_systems () {
# Change DEVICE names or risk foot shooting.
# You must use newfs -O 1 for the root fs if you want to boot it from grub.
DEVICE=/dev/da0s1a
mkdir -p ${DESTDIR}
mkdir -m 755 -p ${DESTDIR}
chown root:wheel ${DESTDIR}
newfs -O 1 ${DEVICE}
tunefs -n enable ${DEVICE}
newfs -U -O 1 ${DEVICE}
mount -o noatime ${DEVICE} ${DESTDIR}
# Additional file systems and initial mount points. Optional.
DEVICE=/dev/da0s1e
newfs ${DEVICE}
tunefs -n enable ${DEVICE}
mkdir -m 755 ${DESTDIR}/var
mkdir -m 755 -p ${DESTDIR}/var
chown root:wheel ${DESTDIR}/var
newfs -U ${DEVICE}
mount -o noatime ${DEVICE} ${DESTDIR}/var
DEVICE=/dev/da2s1e
newfs ${DEVICE}
tunefs -n enable ${DEVICE}
mkdir -m 755 ${DESTDIR}/usr
mkdir -m 755 -p ${DESTDIR}/usr
chown root:wheel ${DESTDIR}/usr
newfs -U ${DEVICE}
mount -o noatime ${DEVICE} ${DESTDIR}/usr
}
@ -67,7 +64,7 @@ create_etc_fstab () {
/dev/vinum/ncvs /home/ncvs ufs rw,noatime 0 2
/dev/vinum/ports /usr/ports ufs rw,noatime 0 2
/dev/ad0s1 /2k ntfs ro,noauto 0 0
/dev/ad0s6 /linux ext2fs ro 0 0
/dev/ad0s6 /linux ext2fs ro,noauto 0 0
#
/dev/cd0 /cdrom cd9660 ro,noauto 0 0
/dev/cd1 /dvd cd9660 ro,noauto 0 0
@ -162,13 +159,21 @@ all_remaining_customization () {
# 'vinum makedev' can only create devices in /dev, thus use cpio.
cd /dev; find vinum -print | cpio -pv ${DESTDIR}/dev
fi
# Make the floppy group wheel writable.
chown root:wheel ${DESTDIR}/dev/fd0*
chmod g+w ${DESTDIR}/dev/fd0*
;;
5.*)
# Starting with FreeBSD 5.x, perl lives in /usr/local/bin but many scripts
# use a hardcoded #!/usr/bin/perl; use a symlink to make them work.
# Effectively mandatory.
cd ${DESTDIR}/usr/bin; ln -s ../local/bin/perl
# Make the floppy group wheel writable.
printf '%s\n' 'own fd0 root:wheel' >> ${DESTDIR}/etc/devfs.conf
printf '%s\n' 'perm fd0 0660' >> ${DESTDIR}/etc/devfs.conf
;;
*)
printf '%s\n' "REVISION ${REVISION} not supported"
exit 1
;;
esac

View file

@ -5,7 +5,8 @@
# will read ./stage_1.conf.profile
# and write ./stage_1.log.profile
#
# $Id: stage_1.sh,v 1.3 2004-01-03 15:46:31 schweikh Exp $
# Author: Jens Schweikhardt
# $Id: stage_1.sh,v 1.4 2004-01-21 19:39:26 schweikh Exp $
# $FreeBSD$
PATH=/bin:/usr/bin:/sbin:/usr/sbin
@ -45,6 +46,7 @@ step_two () {
chflags -R 0 ${TEMPROOT}
rm -rf ${TEMPROOT}
fi
export MAKEDEVPATH="/bin:/sbin:/usr/bin"
mergemaster -i -m ${SRC}/etc -t ${TEMPROOT} -D ${DESTDIR}
cap_mkdb ${DESTDIR}/etc/login.conf
pwd_mkdb -d ${DESTDIR}/etc -p ${DESTDIR}/etc/master.passwd
@ -123,6 +125,7 @@ do_steps () {
echo "TYPE=${TYPE}"
echo "REVISION=${REVISION}"
echo "BRANCH=${BRANCH}"
echo "RELDATE=${RELDATE}"
step_one
step_two
step_three
@ -141,14 +144,21 @@ set -x -e -u # Stop for any error or use of an undefined variable.
# Determine a few variables from the sources that were used to make the
# world. The variables can be used to modify actions, e.g. depending on
# whether we install a 4.x or 5.x system. The result of the eval will be
# something like
# whether we install a 4.x or 5.x system. The __FreeBSD_version numbers
# for RELDATE are documented in the Porter's Handbook,
# doc/en_US.ISO8859-1/books/porters-handbook/freebsd-versions.html.
# Scheme is: <major><two digit minor><0 if release branch, otherwise 1>xx
# The result will be something like
#
# TYPE="FreeBSD"
# REVISION="4.9"
# BRANCH="RC"
# BRANCH="RC" { "CURRENT", "STABLE", "RELEASE" }
# RELDATE="502101"
#
eval $(awk '/^(TYPE|REVISION|BRANCH)=/' ${SRC}/sys/conf/newvers.sh)
RELDATE=$(awk '/^[ \t]*#[ \t]*define[ \t][ \t]*__FreeBSD_version[ \t]/ {
print $3
}' ${SRC}/sys/sys/param.h)
echo "=> Logging to stage_1.log.${PROFILE}"
do_steps 2>&1 | tee stage_1.log.${PROFILE}

View file

@ -1,5 +1,5 @@
# vim: syntax=sh
# $Id: stage_2.conf.default,v 1.1 2004-01-03 15:46:31 schweikh Exp $
# $Id: stage_2.conf.default,v 1.2 2004-01-21 19:39:26 schweikh Exp $
# $FreeBSD$
shells zsh
lang perl5 make install; use.perl port
@ -8,8 +8,8 @@ archivers zip
security sudo
x11-servers XFree86-4-Server
x11 wrapper
x11 XFree86-4-libraries
x11 XFree86-4-clients
x11 XFree86-4-documents
x11-fonts XFree86-4-font75dpi
x11-fonts XFree86-4-font100dpi
x11-fonts XFree86-4-fontScalable
@ -49,6 +49,7 @@ news tin
net freebsd-uucp
net cvsup-without-gui
net pathchar make NO_CHECKSUM=yes install
net smokeping
ftp wget
ftp ncftp3
textproc ispell
@ -76,3 +77,5 @@ textproc gmat
security gpa
mail spamoracle
multimedia mplayer make WITHOUT_RUNTIME_CPUDETECTION=yes WITH_GUI=yes BATCH=yes install
multimedia mplayer-fonts
audio wavplay

View file

@ -1,30 +1,28 @@
#!/bin/sh
#
# stage_2.sh - FreeBSD From Scratch, Stage 2: Ports Installation.
# Usage: ./stage_2.sh {configname}
# Usage: ./stage_2.sh [-hnp] configname
#
# $Id: stage_2.sh,v 1.2 2004-01-03 15:46:31 schweikh Exp $
# Author: Jens Schweikhardt
# $Id: stage_2.sh,v 1.3 2004-01-21 19:39:26 schweikh Exp $
# $FreeBSD$
DBDIR="/var/db/pkg"
PORTS="/usr/ports"
: ${PACKAGES:=${PORTS}/packages}
LOGDIR="/home/root/setup/ports.log"; mkdir -p ${LOGDIR}
# The linprocfs appears to be required for certain java/jdk* ports.
if mount | grep '^linprocfs'; then
: # linprocfs already mounted.
else
mount /compat/linux/proc
fi
PKG_PATH="/cdrom/packages/All:/dvd/packages/All"
PKG=
MYNAME="$(basename $0)"
usage () {
exec >&2
echo "usage: ${MYNAME} [-hn] configname"
echo "usage: ${MYNAME} [-hnp] configname"
echo ""
echo " Options:"
echo " -h Print this help text."
echo " -n Dryrun: just show what would be done."
echo " -p Install a precompiled package if one can be found."
echo ""
echo " The config file (stage_2.conf.configname) is a list of"
echo " ports to install with one entry per line. Each line"
@ -34,15 +32,38 @@ usage () {
exit 1
}
args=`getopt hn $*`
# Look for a package in these locations in sequence.
# Returns as soon as the first is found. Result on stdout.
#
# ${PORTS}/${CATEGORY}/${NAME}
# ${PACKAGES}/All
# ${PACKAGES}/${CATEGORY}
# ${PKG_PATH}
#
find_package () {
echo "${PORTS}/${CATEGORY}/${NAME}:${PACKAGES}/All:${PACKAGES}/${CATEGORY}:${PKG_PATH}" |
tr : '\n' |
while read d; do
test -d "${d}" || continue
PKG=$(ls ${d}/${PKGNAME}.* 2>/dev/null)
test $? -eq 0 && echo "${PKG}" && return
done
}
#
# Parse command line arguments.
#
args=`getopt hnp $*`
if test $? != 0; then
usage
fi
set -- $args
DRYRUN=
CHKPKG=
for i; do
case "$i" in
-n) DRYRUN="yes"; shift;;
-p) CHKPKG="yes"; shift;;
--) shift; break;;
*) usage;;
esac
@ -53,6 +74,9 @@ else
usage
fi
#
# Loop over the ports list.
#
while read CATEGORY NAME CMD; do
case "${CATEGORY}" in
\#*) continue;;
@ -65,16 +89,21 @@ while read CATEGORY NAME CMD; do
fi
cd ${DIR}
PKGNAME=`make -V PKGNAME`
if test -n "${CHKPKG}"; then
PKG=$(find_package)
else
PKG=""
fi
if test -d "${DBDIR}/${PKGNAME}"; then
echo "${CATEGORY}/${NAME} already installed as ${PKGNAME}"
continue
fi
LOG="${LOGDIR}/${CATEGORY}+${NAME}"
echo "===> Installing ${CATEGORY}/${NAME}; logging to ${LOG}"
test -n "${CMD}" || CMD="make install < /dev/null"
test -n "${CMD}" || CMD="make package-recursive < /dev/null"
if test -n "${DRYRUN}"; then
if ls ${PKGNAME}.* >/dev/null 2>&1; then
echo pkg_add -v ${PKGNAME}.*
if test -n "${PKG}"; then
echo pkg_add -v ${PKG}
else
echo "${CMD}"
fi
@ -82,12 +111,12 @@ while read CATEGORY NAME CMD; do
fi
date "++++ Started %v %T +++" > ${LOG}
STARTED=$(date +%s)
echo "CMD: ${CMD}" >> ${LOG}
(
if ls ${PKGNAME}.* >/dev/null 2>&1; then
echo "Found package" ${PKGNAME}.*
pkg_add -v ${PKGNAME}.*
if test -n "${PKG}"; then
echo "Found package ${PKG}"
pkg_add -v ${PKG}
else
echo "CMD: ${CMD}"
make clean
eval "${CMD}"
make clean # Uncomment if diskspace is tight under ${PORTS}.

View file

@ -2,10 +2,12 @@
# Usage: make -f stage_3.mk all (config everything)
# or make -f stage_3.mk target (to just config target)
#
# Author: Jens Schweikhardt
#
# It is a good idea to make sure any target can be made more than
# once without ill effect.
#
# $Id: stage_3.mk,v 1.2 2004-01-03 15:46:31 schweikh Exp $
# $Id: stage_3.mk,v 1.3 2004-01-21 19:39:26 schweikh Exp $
# $FreeBSD$
.POSIX:
@ -19,6 +21,7 @@ message:
@echo "config_nullplugin"
@echo "config_privoxy"
@echo "config_sgml"
@echo "config_smokeping"
@echo "config_sudo"
@echo "config_TeX"
@echo "config_tin"
@ -34,6 +37,7 @@ all: \
config_nullplugin \
config_privoxy \
config_sgml \
config_smokeping \
config_sudo \
config_TeX \
config_tin \
@ -42,15 +46,27 @@ all: \
config_apache:
# 1. Modify httpd.conf.
perl -pi \
-e 's/#ServerName new.host.name/ServerName hal9000.s.shuttle.de/;' \
-e 's/^ServerAdmin.*/ServerAdmin schweikh\@schweikhardt.net/;' \
-e 's/^Listen.*/Listen 127.0.0.1:80/;' \
-e 's/^\s*ServerAdmin.*/ServerAdmin schweikh\@schweikhardt.net/;' \
-e 's/^\s*Listen.*/Listen 127.0.0.1:80/;' \
-e 's/^\s*StartServers.*/StartServers 2/;' \
-e 's/^\s*MinSpareServers.*/MinSpareServers 2/;' \
-e 's,/usr/local/www/cgi-bin/,/home/opt/www/cgi-bin/,;' \
/usr/local/etc/apache2/httpd.conf
# 2. Restore symlinks to web pages.
cd /usr/local/www/data; \
ln -fs /home/schweikh/prj/homepage schweikhardt.net; \
ln -fs /home/opt/www/test .
# Test if the httpd.conf has changed.
@if ! cmp -s /usr/local/etc/apache2/httpd.conf httpd.conf; then \
echo "ATTENTION: the httpd.conf has changed. Please examine if"; \
echo "the modifications are still correct. Here is the diff:"; \
diff -u /usr/local/etc/apache2/httpd.conf httpd.conf; \
fi
if test -f /var/run/httpd.pid; then \
/usr/local/etc/rc.d/apache2.sh restart; \
else \
/usr/local/etc/rc.d/apache2.sh start; \
fi
config_firebird:
# Make this group wheel writable to allow extensions being installed.
@ -94,15 +110,15 @@ config_inn:
"shuttle/news2.shuttle.de:!junk,!control:B32768/512,Tf,Wfb:" \
>/usr/local/news/etc/newsfeeds
# Configure inn.conf.
perl -pi \
-e 's/^(organization:\s*).*/$$1 "An Open Pod Bay Door"/;' \
-e 's/^(pathhost:\s*).*/$$1 hal9000.schweikhardt.net/;' \
-e 's/^(server:).*/$$1 localhost/;' \
-e 's/^(domain:).*/$$1 schweikhardt.net/;' \
-e 's/^(fromhost:).*/$$1 schweikhardt.net/;' \
-e 's,^(moderatormailer:).*,$$1 \%s\@moderators.isc.org,;' \
-e 's,^(pathdb:\s*).*,$$1/share/news/db,;' \
-e 's,/usr/local/news/spool,/share/news/spool,;' \
perl -pi \
-e 's/^#*\s*(organization:\s*).*/$$1"An Open Pod Bay Door"/;' \
-e 's/^#*\s*(pathhost:\s*).*/$$1hal9000.schweikhardt.net/;' \
-e 's/^#*\s*(server:).*/$$1 localhost/;' \
-e 's/^#*\s*(domain:).*/$$1 schweikhardt.net/;' \
-e 's/^#*\s*(fromhost:).*/$$1 schweikhardt.net/;' \
-e 's,^#*\s*(moderatormailer:).*,$$1 \%s\@moderators.isc.org,;' \
-e 's,^#*\s*(pathdb:\s*).*,$$1/share/news/db,;' \
-e 's,/usr/local/news/spool,/share/news/spool,;' \
/usr/local/news/etc/inn.conf
# Create empty history, if none there.
# See post-install in /usr/ports/news/inn-stable/Makefile.
@ -116,11 +132,22 @@ config_inn:
mv history.n.$${s} history.$${s}; \
done; \
fi
# Configure send-uucp.
echo shuttle:shuttle >/usr/local/news/etc/send-uucp.cf
# Satisfy inncheck:
cd /usr/local/news/etc; \
chown news:news *; \
chmod 640 control.ctl expire.ctl nntpsend.ctl readers.conf
/usr/local/news/bin/inncheck
# Test if the inn.conf has changed.
@if ! cmp -s /usr/local/news/etc/inn.conf inn.conf; then \
echo "ATTENTION: the inn.conf has changed. Please examine if"; \
echo "the modifications are still correct. Here is the diff:"; \
diff -u /usr/local/news/etc/inn.conf inn.conf; \
fi
if ! test -f /usr/local/news/run/innd.pid; then \
/usr/local/etc/rc.d/innd.sh start; \
fi
config_javaplugin:
# Mozilla Firebird:
@ -135,6 +162,7 @@ config_javaplugin:
# this suppresses popup dialogs for unavailable plugins (flash, shockwave, ...)
NULLPLUGINS = /usr/X11R6/lib/mozilla/libnullplugin.so \
/usr/X11R6/lib/mozilla/plugins/libnullplugin.so
config_nullplugin:
for p in $(NULLPLUGINS); do \
if test -r $$p; then \
@ -143,13 +171,22 @@ config_nullplugin:
done
config_privoxy:
install -C -o root -g wheel -m 644 config /usr/local/etc/privoxy
install -C -o root -g wheel -m 755 privoxy.sh /usr/local/etc/rc.d
install -C -o root -g wheel -m 644 conf/privoxy/config \
/usr/local/etc/privoxy
install -C -o root -g wheel -m 755 conf/privoxy/privoxy.sh \
/usr/local/etc/rc.d
/usr/local/etc/rc.d/privoxy.sh restart
config_sgml:
cp -p /usr/local/share/gmat/sgml/ISO_8879-1986/entities/* \
/usr/local/share/sgml/docbook/4.1
config_smokeping:
cp conf/smokeping/config conf/smokeping/basepage.html \
/usr/local/etc/smokeping
/usr/local/etc/rc.d/smokeping.sh stop
/usr/local/etc/rc.d/smokeping.sh start
config_sudo:
if ! grep -q schweikh /usr/local/etc/sudoers; then \
echo 'schweikh ALL = (ALL) NOPASSWD: ALL' >> /usr/local/etc/sudoers; \
@ -160,11 +197,17 @@ config_TeX:
# change the following settings to the listed values:
perl -pi \
-e 's/^% original texmf.cnf/% texmf.cnf/;' \
-e 's/^(hash_extra\s*=).*/$$1 60000/;' \
-e 's/^(pool_size\s*=).*/$$1 1000000/;' \
-e 's/^(max_strings\s*=).*/$$1 70000/;' \
-e 's/^(save_size\s*=).*/$$1 10000/;' \
-e 's/^(hash_extra\s*=).*/$${1}60000/;' \
-e 's/^(pool_size\s*=).*/$${1}1000000/;' \
-e 's/^(max_strings\s*=).*/$${1}70000/;' \
-e 's/^(save_size\s*=).*/$${1}10000/;' \
/usr/local/share/texmf/web2c/texmf.cnf
# Test if the texmf.cnf has changed.
@if ! cmp -s /usr/local/share/texmf/web2c/texmf.cnf texmf.cnf; then \
echo "ATTENTION: the texmf.cnf has changed. Please examine if"; \
echo "the modifications are still correct. Here is the diff:"; \
diff -u /usr/local/share/texmf/web2c/texmf.cnf texmf.cnf; \
fi
config_tin:
# Point tin to our files.
@ -176,6 +219,8 @@ config_tin:
config_uucp:
cd /etc/mail; make install SENDMAIL_MC=/etc/mail/hal9000.mc
# Make the uucp user's shell the correct uucico, so su(1) works.
chpass -s /usr/local/libexec/uucp/uucico uucp
# UUCP expects to find /usr/bin/rnews.
cd /usr/bin; ln -fs ../local/news/bin/rnews .
# Actual UUCP configuration.