1e4af8f11SPedro Giffuni#!/bin/sh 2*b31e36b3SAndrew Rist# ************************************************************* 3*b31e36b3SAndrew Rist# 4*b31e36b3SAndrew Rist# Licensed to the Apache Software Foundation (ASF) under one 5*b31e36b3SAndrew Rist# or more contributor license agreements. See the NOTICE file 6*b31e36b3SAndrew Rist# distributed with this work for additional information 7*b31e36b3SAndrew Rist# regarding copyright ownership. The ASF licenses this file 8*b31e36b3SAndrew Rist# to you under the Apache License, Version 2.0 (the 9*b31e36b3SAndrew Rist# "License"); you may not use this file except in compliance 10*b31e36b3SAndrew Rist# with the License. You may obtain a copy of the License at 11*b31e36b3SAndrew Rist# 12*b31e36b3SAndrew Rist# http://www.apache.org/licenses/LICENSE-2.0 13*b31e36b3SAndrew Rist# 14*b31e36b3SAndrew Rist# Unless required by applicable law or agreed to in writing, 15*b31e36b3SAndrew Rist# software distributed under the License is distributed on an 16*b31e36b3SAndrew Rist# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17*b31e36b3SAndrew Rist# KIND, either express or implied. See the License for the 18*b31e36b3SAndrew Rist# specific language governing permissions and limitations 19*b31e36b3SAndrew Rist# under the License. 20*b31e36b3SAndrew Rist# 21*b31e36b3SAndrew Rist# ************************************************************* 22cdf0e10cSrcweir 23cdf0e10cSrcweirUSAGE="Usage: $0" 24cdf0e10cSrcweir 25cdf0e10cSrcweirSCRIPTNAME=`basename "$0"` 26cdf0e10cSrcweirPROGRAMDIR=`dirname "$0"` 27cdf0e10cSrcweirOFFICEDIR="$PROGRAMDIR/.." 28cdf0e10cSrcweirEXTENSIONDIR=$OFFICEDIR/share/extension/install 29cdf0e10cSrcweirUNOPKG=$PROGRAMDIR/unopkg 30cdf0e10cSrcweir 31cdf0e10cSrcweirhelp() 32cdf0e10cSrcweir{ 33cdf0e10cSrcweir echo 34cdf0e10cSrcweir echo "Uninstallation script for office extensions located in <office>/share/extension/install" 35cdf0e10cSrcweir echo 36cdf0e10cSrcweir echo "This uninstallation script can be executed after successful installation of packages." 37cdf0e10cSrcweir echo "Please execute this script, before uninstallation of packages." 38cdf0e10cSrcweir echo "Usage: $0" 39cdf0e10cSrcweir echo "No parameter required." 40cdf0e10cSrcweir echo 41cdf0e10cSrcweir} 42cdf0e10cSrcweir 43cdf0e10cSrcweir# 44cdf0e10cSrcweir# This script is only for root installations 45cdf0e10cSrcweir# (How about installations done with user privileges?) 46cdf0e10cSrcweir# 47cdf0e10cSrcweir 48cdf0e10cSrcweir# if [ $UID -ne 0 ] 49cdf0e10cSrcweir# then 50cdf0e10cSrcweir# printf "\nThis script is for installation only wiht administrative rights only\n" 51cdf0e10cSrcweir# help 52cdf0e10cSrcweir# exit 2 53cdf0e10cSrcweir# fi 54cdf0e10cSrcweir 55cdf0e10cSrcweir# 56cdf0e10cSrcweir# Checking existence of unopkg in program directory 57cdf0e10cSrcweir# 58cdf0e10cSrcweir 59cdf0e10cSrcweirif [ ! -f "$UNOPKG" ]; then 60cdf0e10cSrcweir echo "Error: File $UNOPKG does not exist" 61cdf0e10cSrcweir exit 1 62cdf0e10cSrcweirfi 63cdf0e10cSrcweir 64cdf0e10cSrcweirif [ ! -x "$UNOPKG" ]; then 65cdf0e10cSrcweir echo "Error: File $UNOPKG is not an executable file" 66cdf0e10cSrcweir exit 1 67cdf0e10cSrcweirfi 68cdf0e10cSrcweir 69cdf0e10cSrcweir# 70cdf0e10cSrcweir# Collecting all files located in share/install/extensions 71cdf0e10cSrcweir# 72cdf0e10cSrcweir 73cdf0e10cSrcweirFILELIST=`find $EXTENSIONDIR -type f -name "*.oxt" -print` 74cdf0e10cSrcweir 75cdf0e10cSrcweirif [ -z "$FILELIST" ] 76cdf0e10cSrcweirthen 77cdf0e10cSrcweir printf "\n$0: No extensions found in $EXTENSIONDIR\n" 78cdf0e10cSrcweir exit 2 79cdf0e10cSrcweirfi 80cdf0e10cSrcweir 81cdf0e10cSrcweirecho 82cdf0e10cSrcweirecho "Uninstalling:" 83cdf0e10cSrcweirfor i in $FILELIST; do 84cdf0e10cSrcweir echo `basename $i` 85cdf0e10cSrcweirdone 86cdf0e10cSrcweirecho 87cdf0e10cSrcweir 88cdf0e10cSrcweirfor i in $FILELIST; do 89cdf0e10cSrcweir COMMAND="$UNOPKG remove --shared `basename $i`" 90cdf0e10cSrcweir echo $COMMAND 91cdf0e10cSrcweir $COMMAND 92cdf0e10cSrcweirdone 93cdf0e10cSrcweir 94cdf0e10cSrcweirecho 95cdf0e10cSrcweirecho "Uninstallation done ..." 96cdf0e10cSrcweirecho 97cdf0e10cSrcweir 98cdf0e10cSrcweirexit 0 99