1#!/bin/sh 2 3USAGE="Usage: $0" 4 5SCRIPTNAME=`basename "$0"` 6PROGRAMDIR=`dirname "$0"` 7OFFICEDIR="$PROGRAMDIR/.." 8EXTENSIONDIR=$OFFICEDIR/share/extension/install 9UNOPKG=$PROGRAMDIR/unopkg 10 11help() 12{ 13 echo 14 echo "Uninstallation script for office extensions located in <office>/share/extension/install" 15 echo 16 echo "This uninstallation script can be executed after successful installation of packages." 17 echo "Please execute this script, before uninstallation of packages." 18 echo "Usage: $0" 19 echo "No parameter required." 20 echo 21} 22 23# 24# This script is only for root installations 25# (How about installations done with user privileges?) 26# 27 28# if [ $UID -ne 0 ] 29# then 30# printf "\nThis script is for installation only wiht administrative rights only\n" 31# help 32# exit 2 33# fi 34 35# 36# Checking existence of unopkg in program directory 37# 38 39if [ ! -f "$UNOPKG" ]; then 40 echo "Error: File $UNOPKG does not exist" 41 exit 1 42fi 43 44if [ ! -x "$UNOPKG" ]; then 45 echo "Error: File $UNOPKG is not an executable file" 46 exit 1 47fi 48 49# 50# Collecting all files located in share/install/extensions 51# 52 53FILELIST=`find $EXTENSIONDIR -type f -name "*.oxt" -print` 54 55if [ -z "$FILELIST" ] 56then 57 printf "\n$0: No extensions found in $EXTENSIONDIR\n" 58 exit 2 59fi 60 61echo 62echo "Uninstalling:" 63for i in $FILELIST; do 64 echo `basename $i` 65done 66echo 67 68for i in $FILELIST; do 69 COMMAND="$UNOPKG remove --shared `basename $i`" 70 echo $COMMAND 71 $COMMAND 72done 73 74echo 75echo "Uninstallation done ..." 76echo 77 78exit 0 79