netbless
Fri Jan 07, 2011 · 494 words

In my previous post, I alluded to a tool that we use to make NetBooting different machines with their correct OS quite a bit simpler. Here's what it is and how to use it. But first a few words about my workflow:

The Setup

Making it Run

With things organized this way, it's now very simple to match any machine to it's corresponding installation media. To automate this, I created a tool that consists of two parts:

The web service couldn't be any simpler, it just lists the available NBIs:

<?php
    $datadir="/data/nb";
    header("Content-type: text/plain");
    foreach (glob("${datadir}/*.nbi") as $nb)
    {
        $images[] = basename($nb);
    }
    echo implode(" ", $images)

By default, the client-side tool tries to match the current machine to a set on the server:

$ sudo ./netbless.sh 
Error: model MacBookPro3,1 not found on the NetBoot server

… meaning I haven't ripped the media for this machine yet. In these cases I can force the tool to use a specific NBI. To do that, I'll probably need to know what is available:

sudo ./netbless.sh list
Available images: 10.5.6_retail.nbi MacBook3,1.nbi MacBook7,1.nbi MacBookAir2,1.nbi MacBookPro5,2.nbi MacBookPro6,2.nbi MacBookPro7,1.nbi Macmini3,1.nbi Macmini4,1.nbi boot.nbi iMac11,3.nbi retail_10.6.3.nbi retail_10.6.3_2.nbi

So, to boot to the 10.5.6 installer, I would say:

sudo ./netbless.sh 10.5.6_retail

The script makes some assuptions (for instance of the NetBoot and web services being on the same server) but is general enough to customise it to any environment. If you're image library is comprehensive enough, using netbless is usually just a matter of:

$ sudo ./netbless && reboot

And yes, using this requires a bootable system to start with (say your known-good diagnostics partition). Ideally, netbless would be an EFI-binary that you could run off a memstick, without an OS, but my EFI-programming skills aren't quite up to snuff yet…


back · essays · credits ·