Skip to content

Instantly share code, notes, and snippets.

@bdha
Created December 24, 2011 18:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bdha/1518074 to your computer and use it in GitHub Desktop.
Save bdha/1518074 to your computer and use it in GitHub Desktop.
# This document describes updating the SmartOS boot_archive and /usr volumes.
#
# The boot_archive effectively contains /. If you want to make changes to SMF
# or so forth, you need to update the boot_archive.
#
# If you want to add things to /usr, such as drivers, you will need to update
# usr.lgz. It is compressed, so note the lofiadm -U and -C calls below. Once
# you have updated usr.lgz you will need to copy it back to the mounted
# boot_arhive.
#
# This work must be done on a Solaris system.
TODAY=$( date +%Y%m%d )
WORKDIR="/export/smartos/$TODAY"
mkdir -p /mnt/smartos
mkdir -p /mnt/smartos_boot
mkdir -p /mnt/smartos_usr
mkdir -p $WORKDIR
LOFI_ISO=$( lofiadm -a /export/scratch/smartos.iso )
mount -F hsfs $LOFI_ISO /mnt/smartos
cp /mnt/smartos/platform/i86pc/amd64/boot_archive $WORKDIR
mount -F ufs $WORKDIR/boot_archive /mnt/smartos_boot
cp /mnt/smartos_boot/usr.lgz $WORKDIR/
cd $WORKDIR
lofiadm -U usr.lgz
LOFI_USR=$( lofiadm -a $WORKDIR/usr.lgz )
mount -F ufs -o nologging $LOFI_USR /mnt/smartos_usr
### DO STUFF
umount /mnt/smartos_usr
lofiadm -d $LOFI_USR
cd $WORKDIR
lofiadm -C usr.lgz
rm /mnt/smartos_boot/usr.lgz
sleep 2
cp usr.lgz /mnt/smartos_boot/
### Back up the previous builds.
scp boot-int:/tftpboot/smartos/platform/i86pc/amd64/boot_archive $WORKDIR/boot_archive.previous
scp boot-int:/tftpboot/smartos/platform/i86pc/kernel/amd64/unix $WORKDIR/unix.previous
### The new platform directory over.
rsync -ae ssh --delete /mnt/smartos/platform/ boot-int:/tftpboot/smartos/platform
umount /mnt/smartos
lofiadm -d $LOFI_ISO
# Overwrite the boot_archive with our own.
umount /mnt/smartos_boot
scp $WORKDIR/boot_archive boot-int:/tftpboot/smartos/platform/i86pc/amd64/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment