1. Automating FreeBSD release downloads with a '.netrc' file
1.1 Introduction
Many years ago for the first time, I did a ftp install of FreeBSD 4.x. using the two floppies. I instructed 'sysinstall' to retrieve the installation files from a FreeBSD ftp mirror on the internet. Previously I had installed FreeBSD a few times from CD. At that time I was using a new ISDN modem, which was fast with 64Kb, at least compared with the 14k4 old modem.
Because the system did not boot, I must have made a mistake somewhere. Not looking forward to a couple of repeated ftp downloads with the ISDN modem, I decided to download the release files once and for all on a FreeBSD Pentium-Pro box. Some simple configuration steps turned the Pentium-Pro into a local ftp server.
This method has become my favorite way to install FreeBSD as well as OpenBSD. First download the files making up the FreeBSD release to a ftp server in my local network. Boot 'sysinstall' with the install floppies, and install FreeBSD by fetching the installation files from the local ftp server.
A nice side effect is speed. Transfer over the network turned out to be much faster than reading from a 10x speed CD on a Pentium I box.
1.2 File hierarchy of a FreeBSD release
In the standardized ftp structure, we find the release files in '/pub/FreeBSD/releases/<arch>/<release>/', where <arch> stands for the hardware architecture like 'i386' or 'amd64', and <release> is a release tag, e.g. '7.2-RELEASE' or '8.0-RELEASE'.
A summary of the files:
Downloading all these files with the command line 'ftp' would be rather tedious. For a long time I used 'wget' to fetch the files. A couple of years later I discovered how to use a '.netrc' file to script ftp commands.
- 1.1 Introduction
- 1.2 File hierarchy of a FreeBSD release
- 1.3 A '.netrc' file to download a FreeBSD release
- 1.4 Transcript of '.netrc' processing
- 1.5 '.netrc' commands to download boot-only-iso image
- 1.6 A merge of the two '.netrc' files
- 1.7 The '.netrc' file generator script
- 1.8 Example of usage
1.1 Introduction
Many years ago for the first time, I did a ftp install of FreeBSD 4.x. using the two floppies. I instructed 'sysinstall' to retrieve the installation files from a FreeBSD ftp mirror on the internet. Previously I had installed FreeBSD a few times from CD. At that time I was using a new ISDN modem, which was fast with 64Kb, at least compared with the 14k4 old modem.
Because the system did not boot, I must have made a mistake somewhere. Not looking forward to a couple of repeated ftp downloads with the ISDN modem, I decided to download the release files once and for all on a FreeBSD Pentium-Pro box. Some simple configuration steps turned the Pentium-Pro into a local ftp server.
This method has become my favorite way to install FreeBSD as well as OpenBSD. First download the files making up the FreeBSD release to a ftp server in my local network. Boot 'sysinstall' with the install floppies, and install FreeBSD by fetching the installation files from the local ftp server.
A nice side effect is speed. Transfer over the network turned out to be much faster than reading from a 10x speed CD on a Pentium I box.
1.2 File hierarchy of a FreeBSD release
In the standardized ftp structure, we find the release files in '/pub/FreeBSD/releases/<arch>/<release>/', where <arch> stands for the hardware architecture like 'i386' or 'amd64', and <release> is a release tag, e.g. '7.2-RELEASE' or '8.0-RELEASE'.
Code:
lrwxr-xr-x 1 1006 3000 1 May 1 2009 7.2-RELEASE -> .
-r--r--r-- 1 1006 3000 4877 May 1 2009 ERRATA.HTM
-r--r--r-- 1 1006 3000 3514 May 1 2009 ERRATA.TXT
-r--r--r-- 1 1006 3000 186567 May 1 2009 HARDWARE.HTM
-r--r--r-- 1 1006 3000 114717 May 1 2009 HARDWARE.TXT
-r--r--r-- 1 1006 3000 19736 May 1 2009 README.HTM
-r--r--r-- 1 1006 3000 14311 May 1 2009 README.TXT
-r--r--r-- 1 1006 3000 60037 May 1 2009 RELNOTES.HTM
-r--r--r-- 1 1006 3000 31407 May 1 2009 RELNOTES.TXT
drwxrwxr-x 2 1006 3000 1024 May 1 2009 base
drwxrwxr-x 2 1006 3000 512 May 1 2009 catpages
-rw-r--r-- 1 1006 3000 25 May 1 2009 cdrom.inf
drwxrwxr-x 2 1006 3000 512 May 1 2009 dict
drwxrwxr-x 2 1006 3000 1536 May 1 2009 doc
-r--r--r-- 1 1006 3000 3704 May 1 2009 docbook.css
drwxrwxr-x 2 1006 3000 512 May 1 2009 floppies
drwxrwxr-x 2 1006 3000 512 May 1 2009 games
drwxrwxr-x 2 1006 3000 512 May 1 2009 info
drwxrwxr-x 2 1006 3000 1024 May 1 2009 kernels
drwxrwxr-x 2 1006 3000 512 May 1 2009 manpages
lrwxr-xr-x 1 1006 3000 40 May 2 2009 packages ->
../../../ports/i386/packages-7.2-release
drwxrwxr-x 2 1006 3000 512 May 1 2009 ports
drwxrwxr-x 2 1006 3000 512 May 1 2009 proflibs
drwxrwxr-x 2 1006 3000 2560 May 1 2009 src
A summary of the files:
- There are two links. The first one, '7.2-RELEASE' points to the current directory, and identifies the release. The 'packages' link points to the pre-compiled packages.
- A collection of files like 'ERRRATA', 'RELNOTES' in both text and html formats.
- A 'cdrom.inf' file and 'docbook.css', a cascading style sheet for the html documents.
- Directories like 'base', 'catpages' and 'src'.
A look inside 'base':
Code:1869 May 1 2009 CHECKSUM.MD5 3199 May 1 2009 CHECKSUM.SHA256 1425408 May 1 2009 base.aa 1425408 May 1 2009 base.ab 1425408 May 1 2009 base.ac 1425408 May 1 2009 base.ad [snip] 1425408 May 1 2009 base.ax 1425408 May 1 2009 base.ay 1425408 May 1 2009 base.az 1425408 May 1 2009 base.ba [snip] 1425408 May 1 2009 base.bh 202680 May 1 2009 base.bi 1053 May 1 2009 base.inf 1315055 May 1 2009 base.mtree 438 Apr 15 2009 install.sh
MD5 and SHA256 checksum files for each individual 'base.??'. All 'base.??' files, from 'base.aa' to 'base.bi' are chunks of a 'tar' archive. A peek into 'install.sh', reveals how these pieces are glued together to a single tar file. and how subsequently this tar archive is unpacked:
Code:cat base.?? | tar --unlink -xpzf - -C ${DESTDIR:-/}
Downloading all these files with the command line 'ftp' would be rather tedious. For a long time I used 'wget' to fetch the files. A couple of years later I discovered how to use a '.netrc' file to script ftp commands.