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