1*e4af8f11SPedro Giffuni#!/bin/sh 2cdf0e10cSrcweir 3cdf0e10cSrcweir# First parameter: Root path that will be removed 4cdf0e10cSrcweir# MY_ROOT=/export/home/is/root 5cdf0e10cSrcweir 6cdf0e10cSrcweirif [ $# -ne 1 -o -z "$1" ] 7cdf0e10cSrcweirthen 8cdf0e10cSrcweir echo "One parameter required" 9cdf0e10cSrcweir echo "Usage:" 10cdf0e10cSrcweir echo "1. parameter: Path to the local root directory" 11cdf0e10cSrcweir echo "All packages in local database will be removed!" 12cdf0e10cSrcweir exit 2 13cdf0e10cSrcweirfi 14cdf0e10cSrcweir 15cdf0e10cSrcweirMY_ROOT=$1 16cdf0e10cSrcweir 17cdf0e10cSrcweircd `dirname $0` 18cdf0e10cSrcweirDIRECTORY=`pwd` 19cdf0e10cSrcweir 20cdf0e10cSrcweirGETUID_SO=/tmp/getuid.so.$$ 21cdf0e10cSrcweirlinenum=??? 22cdf0e10cSrcweirtail +$linenum `basename $0` > $GETUID_SO 23cdf0e10cSrcweir 24cdf0e10cSrcweirPKGLIST=`pkginfo -R $MY_ROOT | cut -f 2 -d ' ' | grep -v core` 25cdf0e10cSrcweirCOREPKG=`pkginfo -R $MY_ROOT | cut -f 2 -d ' ' | grep core` 26cdf0e10cSrcweirCOREPKG01=`pkginfo -R $MY_ROOT | cut -f 2 -d ' ' | grep core01` 27cdf0e10cSrcweir 28cdf0e10cSrcweirecho "#############################################" 29cdf0e10cSrcweirecho "# Deinstallation of Office packages #" 30cdf0e10cSrcweirecho "#############################################" 31cdf0e10cSrcweirecho 32cdf0e10cSrcweirecho "Path to the root directory : " $MY_ROOT 33cdf0e10cSrcweirecho 34cdf0e10cSrcweirecho "Packages to deinstall:" 35cdf0e10cSrcweirfor i in $PKGLIST $COREPKG; do 36cdf0e10cSrcweir echo $i 37cdf0e10cSrcweirdone 38cdf0e10cSrcweir 39cdf0e10cSrcweirINSTALL_DIR=$MY_ROOT`pkginfo -R $MY_ROOT -r $COREPKG01` 40cdf0e10cSrcweir 41cdf0e10cSrcweir# Restore original bootstraprc 42cdf0e10cSrcweirmv -f $INSTALL_DIR/program/bootstraprc.orig $INSTALL_DIR/program/bootstraprc 43cdf0e10cSrcweir 44cdf0e10cSrcweirfor i in $PKGLIST $COREPKG; do 45cdf0e10cSrcweir LD_PRELOAD=$GETUID_SO /usr/sbin/pkgrm -n -R $MY_ROOT $i 46cdf0e10cSrcweirdone 47cdf0e10cSrcweir 48cdf0e10cSrcweir# Removing old root directory, very dangerous! 49cdf0e10cSrcweir# rm -rf $MY_ROOT 50cdf0e10cSrcweir 51cdf0e10cSrcweir# removing library in temp directory 52cdf0e10cSrcweirrm -f $GETUID_SO 53cdf0e10cSrcweir 54cdf0e10cSrcweirecho 55cdf0e10cSrcweirecho "Deinstallation done..." 56cdf0e10cSrcweir 57cdf0e10cSrcweirexit 0 58