1 #!/bin/ksh 2 # 3 # Script for starting a postponed post-installation command in 4 # a Live-Upgrade-safe environment 5 # 6 # CDDL HEADER START 7 # 8 # The contents of this file are subject to the terms of the 9 # Common Development and Distribution License, Version 1.0 only 10 # (the "License"). You may not use this file except in compliance 11 # with the License. 12 # 13 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 14 # or http://www.opensolaris.org/os/licensing. 15 # See the License for the specific language governing permissions 16 # and limitations under the License. 17 # 18 # When distributing Covered Code, include this CDDL HEADER in each 19 # file and include the License file at usr/src/OPENSOLARIS.LICENSE. 20 # If applicable, add the following below this CDDL HEADER, with the 21 # fields enclosed by brackets "[]" replaced with your own identifying 22 # information: Portions Copyright [yyyy] [name of copyright owner] 23 # 24 # CDDL HEADER END 25 # 26 # 27 # Copyright 2004-2005 Sun Microsystems, Inc. All rights reserved. 28 # Use is subject to license terms. 29 # 30 31 export PATH=/usr/bin 32 33 postrun_root_found=no 34 if [ "$PKG_INSTALL_ROOT" != "" ]; then 35 pkginfo -q -R $PKG_INSTALL_ROOT SUNWpostrun-root && postrun_root_found=yes 36 else 37 pkginfo -q SUNWpostrun-root && postrun_root_found=yes 38 fi 39 40 if [ $postrun_root_found = no ]; then 41 echo 'WARNING: postrun could not find SUNWpostrun-root' 42 echo ' You will need to execute the following commands as root' 43 echo ' after installation:' 44 echo '---- commands follow ----' 45 cat 46 echo '---- commands end ----' 47 exit 0 48 fi 49 50 if [ "$PKG_INSTALL_ROOT" != "" ]; then 51 POSTRUN_ROOT_BASEDIR=`pkginfo -R $PKG_INSTALL_ROOT -l SUNWpostrun-root \ 52 | grep BASEDIR: | sed 's/BASEDIR:[ ]*//' | sed 's/ *//'` 53 else 54 POSTRUN_ROOT_BASEDIR=`pkginfo -l SUNWpostrun-root \ 55 | grep BASEDIR: | sed 's/BASEDIR:[ ]*//' | sed 's/ *//'` 56 fi 57 58 test -x $PKG_INSTALL_ROOT$POSTRUN_ROOT_BASEDIR/var/lib/postrun/postrun || { 59 echo "ERROR: SUNWpostrun-root is installed in $POSTRUN_ROOT_BASEDIR" 60 echo " but $PKG_INSTALL_ROOT$POSTRUN_ROOT_BASEDIR/var/lib/postrun/postrun not found" 61 exit 1 62 } 63 64 exec $PKG_INSTALL_ROOT$POSTRUN_ROOT_BASEDIR/var/lib/postrun/postrun "${@}" 65