root_archive.ksh revision 7c478bd95313f5f23a4c958a745db2134aa03244
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License"). You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#pragma ident "%Z%%M% %I% %E% SMI"
# both ufs and hsfs (iso9660) format archives are unpacked
# only ufs archives are generated
#
# usage: pack <archive> <root>
# unpack <archive> <root>
# packmedia <solaris_image> <root>
# unpackmedia <solaris_image> <root>
#
# Where <root> is the directory to unpack to and will be cleaned out
# if it exists.
#
# Solaris media and all the things that don't go into the ramdisk image
# are (un)cpio'd as well
#
usage()
{
printf "usage: root_archive pack <archive> <root>\n"
printf " root_archive unpack <archive> <root>\n"
printf " root_archive packmedia <solaris_image> <root>\n"
printf " root_archive unpackmedia <solaris_image> <root>\n"
}
{
MEDIA=$1
MINIROOT=$2
cd ${MINIROOT}
# archive package databases to conserve memory
#
${MEDIA}/${RELEASE}/Tools/Boot/pkg_db.cpio.bz2
# create the graphics and non-graphics X archive
#
${MEDIA}/${RELEASE}/Tools/Boot/X.cpio.bz2
${MEDIA}/${RELEASE}/Tools/Boot/X_small.cpio.bz2
cd ../..
# clear out 64 bit support to conserve memory
#
# XXX fix as soon as we deliver boot/grub/install_menu
#
cp ${MINIROOT}/boot/grub/install_menu \
fi
ln -sf ../../../boot/x86.miniroot
# XXX fix once SUNWgzip is included in the miniroot
fi
}
{
MEDIA=$1
# unpack X
#
cd ${UNPACKED_ROOT}/usr
# unpack package databases
#
}
{
cd $MNT
cd $BASE
}
unpack()
{
if [ ! -f "${MR}" ] ; then
exit 1
fi
if [ $? != 0 ] ; then
exit 2
fi
else
printf "invalid root archive\n"
fi
}
pack()
{
if [ ! -d "${UNPACKED_ROOT}" -o "X${MR}" = "X" ] ; then
exit 1
fi
if [ $? != 0 ] ; then
exit 2
fi
cd $BASE
}
# main
#
if [ $# != 3 ] ; then
exit 1
fi
BASE=`pwd`
MR=$2
fi
fi
case $1 in
pack ;;
*) usage ;;
esac