Scripting bsdinstall in FreeBSD 9.0 for custom installation CD

Starting with FreeBSD 9.0, the default installer for FreeBSD has changed from sysinstall to bsdinstall. While there has been mixed reactions from old time users, the process of creating a custom install CD for FreeBSD has become a lot easier (although longer). bsdinstall uses a set of shell scripts which can be modified as per requirements.

First step is to install a fresh 9.0 RELEASE, and select the src to be installed along with the base system. Once the system with source is installed (by default /usr/src) execute the following commands

# cd /usr/src
# make buildworld buildkernel

Installation scripts are located at /usr/src/usr.sbin/bsdinstall/scripts/ . First file to run is ‘auto’, which then calls other files. Almost all of them are shell scripts. Remember, you do not need to repeat ‘make buildworld buildkernel’ if you are just making changes to the install script file.

# cd /usr/src/release
# make release

Once the release has been built we now copy the iso / usb image / ftp files to the desired directory

# make install DESTDIR=/usr/freebsd-snapshot clean

This creates the iso file, memory stick image and ftp folder for ftp install. In case you are wondering how to use the memory stick image, see this blog post:



3 thoughts on “Scripting bsdinstall in FreeBSD 9.0 for custom installation CD

  1. Yes, you can upgrade to the RC’s, but the use is imo not rupposted. But I could be wrong about that. The official things is that it supports upgrading between -RELEASE’s. I know that at some point you can also upgrade to a -BETAX but the moment a new version is out, you can no longer use the old version.I’ll try to poke Colin to see what is the official policy wrt. FreeBSD-update.Cheers Thanks,Remko


  2. HelloI figure you mean third party paecagks as installed by tools like portmanager etc? You can use portupgrade (I know how that works, the rest I do not know, advise welcome) to automatically upgrade all installed paecagks: portupgrade -af will force upgrade all installed ports.If you do not mean this, can you please tell me what you are looking for?Thanksremko


  3. William: you are correct that /bin/sh is the most pobrtale way to write but I was speaking more generally about using more feature rich interpreters which can be found all over the system.Kurin: On our FreeBSD 4 systems at work it’s in /usr/bin but I didn’t install the systems so it could have been a mistake. Regardless the point is really that it varies from system to system.UmberGryphon: Once you take in all the user written perl, python, and ruby scripts that run under non-priveleged accounts on production system they well outweight the volume of /bin/sh scripts being run by root. If you’re a sysadmin this tip doesn’t really apply, hence the caveat, but if you’re a programmer at an ISV then scripts running under non-priveleged accounts are pretty much your world and that’s where the advice applies.


Comments are closed.