#!/bin/ksh
#
# Script for starting a postponed post-installation command in
# a Live-Upgrade-safe environment
#
# 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
# or http://www.opensolaris.org/os/licensing.
# 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 2004-2005 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
export PATH=/usr/bin
postrun_root_found=no
if [ "$PKG_INSTALL_ROOT" != "" ]; then
pkginfo -q -R $PKG_INSTALL_ROOT SUNWpostrun-root && postrun_root_found=yes
else
pkginfo -q SUNWpostrun-root && postrun_root_found=yes
fi
if [ $postrun_root_found = no ]; then
echo 'WARNING: postrun could not find SUNWpostrun-root'
echo ' You will need to execute the following commands as root'
echo ' after installation:'
echo '---- commands follow ----'
cat
echo '---- commands end ----'
exit 0
fi
if [ "$PKG_INSTALL_ROOT" != "" ]; then
POSTRUN_ROOT_BASEDIR=`pkginfo -R $PKG_INSTALL_ROOT -l SUNWpostrun-root \
| grep BASEDIR: | sed 's/BASEDIR:[ ]*//' | sed 's/ *//'`
else
POSTRUN_ROOT_BASEDIR=`pkginfo -l SUNWpostrun-root \
| grep BASEDIR: | sed 's/BASEDIR:[ ]*//' | sed 's/ *//'`
fi
test -x $PKG_INSTALL_ROOT$POSTRUN_ROOT_BASEDIR/var/lib/postrun/postrun || {
echo "ERROR: SUNWpostrun-root is installed in $POSTRUN_ROOT_BASEDIR"
echo " but $PKG_INSTALL_ROOT$POSTRUN_ROOT_BASEDIR/var/lib/postrun/postrun not found"
exit 1
}
exec $PKG_INSTALL_ROOT$POSTRUN_ROOT_BASEDIR/var/lib/postrun/postrun "${@}"