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