1#!/bin/sh 2# ************************************************************* 3# 4# Licensed to the Apache Software Foundation (ASF) under one 5# or more contributor license agreements. See the NOTICE file 6# distributed with this work for additional information 7# regarding copyright ownership. The ASF licenses this file 8# to you under the Apache License, Version 2.0 (the 9# "License"); you may not use this file except in compliance 10# with the License. You may obtain a copy of the License at 11# 12# http://www.apache.org/licenses/LICENSE-2.0 13# 14# Unless required by applicable law or agreed to in writing, 15# software distributed under the License is distributed on an 16# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17# KIND, either express or implied. See the License for the 18# specific language governing permissions and limitations 19# under the License. 20# 21# ************************************************************* 22 23# First parameter: Root path that will be removed 24# MY_ROOT=/export/home/is/root 25 26if [ $# -ne 1 -o -z "$1" ] 27then 28 echo "One parameter required" 29 echo "Usage:" 30 echo "1. parameter: Path to the local root directory" 31 echo "All packages in local database will be removed!" 32 exit 2 33fi 34 35MY_ROOT=$1 36 37cd `dirname $0` 38DIRECTORY=`pwd` 39 40GETUID_SO=/tmp/getuid.so.$$ 41linenum=??? 42tail +$linenum `basename $0` > $GETUID_SO 43 44PKGLIST=`pkginfo -R $MY_ROOT | cut -f 2 -d ' ' | grep -v core` 45COREPKG=`pkginfo -R $MY_ROOT | cut -f 2 -d ' ' | grep core` 46COREPKG01=`pkginfo -R $MY_ROOT | cut -f 2 -d ' ' | grep core01` 47 48echo "#############################################" 49echo "# Deinstallation of Office packages #" 50echo "#############################################" 51echo 52echo "Path to the root directory : " $MY_ROOT 53echo 54echo "Packages to deinstall:" 55for i in $PKGLIST $COREPKG; do 56 echo $i 57done 58 59INSTALL_DIR=$MY_ROOT`pkginfo -R $MY_ROOT -r $COREPKG01` 60 61# Restore original bootstraprc 62mv -f $INSTALL_DIR/program/bootstraprc.orig $INSTALL_DIR/program/bootstraprc 63 64for i in $PKGLIST $COREPKG; do 65 LD_PRELOAD=$GETUID_SO /usr/sbin/pkgrm -n -R $MY_ROOT $i 66done 67 68# Removing old root directory, very dangerous! 69# rm -rf $MY_ROOT 70 71# removing library in temp directory 72rm -f $GETUID_SO 73 74echo 75echo "Deinstallation done..." 76 77exit 0 78