Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 8cd36ce204
Fetching contributors…

Cannot retrieve contributors at this time

executable file 42 lines (35 sloc) 1.252 kb
#!/bin/bash
#
# Copyright (c) 2010,2011 Joyent Inc., All Rights Reserved.
#
BUILDSTAMP=$2
if [ -z "${BUILDSTAMP}" ]; then
BUILDSTAMP=`TZ=UTC date "+%Y%m%dT%H%M%SZ"`
fi
rdmnt=$1
if [ -z "${rdmnt}" ]; then
echo "Usage: $0 <rdmnt directory> [buildstamp]"
exit 1
fi
echo "Customizing ${rdmnt}"
pfexec cp /dev/null ${rdmnt}/etc/mnttab
pfexec cp /dev/null ${rdmnt}/var/log/syslog
pfexec cp /dev/null ${rdmnt}/var/adm/wtmpx
# This rebuilds the man index but needs to work around the fact that
# isaexec binaries don't work properly in a chroot.
(cd ${rdmnt}/usr/bin && pfexec mv sh sh.$$ && ln -s bash sh)
pfexec mount -F lofs /dev ${rdmnt}/dev
# If we're in a GZ there will be a /devices we need to
if [[ -d /devices ]]; then
pfexec mount -F lofs /devices ${rdmnt}/devices
fi
pfexec chroot ${rdmnt} /usr/bin/catman -M /usr/share/man:/opt/local/man:/smartdc/man -T /usr/share/lib/tmac/ansun
if [[ -d /devices ]]; then
pfexec umount ${rdmnt}/devices
fi
pfexec umount ${rdmnt}/dev
(cd ${rdmnt}/usr/bin && pfexec rm sh && pfexec mv sh.$$ sh)
pfexec chown root:root ${rdmnt}
pfexec gsed -i -e "s/ [0-9]\{8\}T[0-9]\{6\}Z/ ${BUILDSTAMP}/" ${rdmnt}/etc/motd
pfexec gsed -i -e "s/ [0-9]\{8\}T[0-9]\{6\}Z/ ${BUILDSTAMP}/" ${rdmnt}/etc/issue
exit 0
Jump to Line
Something went wrong with that request. Please try again.