Upgrading OpenSolaris 2008.05 Build 86 to Build 95

I’ve just managed to upgrade my OpenSolaris 2008.05 machine from build 86 to build 95. The instructions were inspired by Updating Your System to OpenSolaris Development Builds. The process was a little finicky, so here’s the script I used:

#!/bin/bash

set -e

if [ -z $1 ]; then
  echo "ERROR: You didn't specify the name of the be you'd like to create!"
  exit 1
fi

newbe=$1

BUILD=$( uname -v | sed s/snv_// )

if [ '86' != ${BUILD} ]; then
  echo "ERROR: This is only for build 86!"
  exit 2
fi

mntpt="/tmp/mnt$$"
beadm create ${newbe}
mkdir ${mntpt}
beadm mount ${newbe} ${mntpt}
pkg -R ${mntpt} rebuild-index # This step was missing from the original instructions.
pkg -R ${mntpt} image-update
${mntpt}/boot/solaris/bin/update_grub -R ${mntpt}
beadm unmount ${newbe}
beadm activate ${newbe}

Once I ran this script I rebooted (init 6) and the upgrade took effect.