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