Skip to content

Instantly share code, notes, and snippets.

@bdha
Created January 6, 2012 23:02
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save bdha/1572856 to your computer and use it in GitHub Desktop.
Save bdha/1572856 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.
ISO=<PATH TO ISO>
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 $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
### Copy 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/
# Update the SMF repo to set ttya to 9600 instead of 11500.
#
# You will need to have boot_archive mounted first.
#
# See smartos_update_image.txt for full instructions on mounting the boot_archive.
svccfg
svc:> repository /mnt/smartos_boot/etc/svc/repository.db
svc:> select system/console-login:ttya
svc:/system/console-login:ttya> setprop ttymon/label=9600
svc:/system/console-login:ttya> end
vi /mnt/smartos_boot/boot/solaris/bootenv.rc
# Add: setprop console 'ttya'
# Finish updating usr.lgz or boot_archive, as defined in the Updating SmartOS
# images document.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment