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