office-gobmx/setup_native/source/opensolaris/bundledextensions/svc-ooo_bundled_extensions
Ivo Hinkelmann d9e6f47543 CWS-TOOLING: integrate CWS jl133
2009-10-20 11:47:23 +0200 jl  r277045 : CWS-TOOLING: rebase CWS jl133 to branches/OOO320@276942 (milestone: OOO320:m2)
2009-09-30 12:23:43 +0200 jl  r276551 : #i103747# added dependency to local filesystem service
2009-09-14 14:12:18 +0200 jl  r276113 : #i103747#
2009-09-14 14:09:41 +0200 jl  r276112 : #i103747#
2009-09-14 13:24:20 +0200 jl  r276108 : #i103747#
2009-09-11 08:27:43 +0200 jl  r276049 : #i103747# changes for opensolaris bundled extensions
2009-09-11 08:21:36 +0200 jl  r276048 : #i103747# changes for opensolaris bundled extensions
2009-10-27 18:23:06 +00:00

108 lines
4.3 KiB
Bash

#!/sbin/sh
. /lib/svc/share/smf_include.sh
#The start method is used for installing and updating the
#extensions. The service keeps a list
#(share/extensions/install/installed) of the extensions which were
#already installed. During installation, the bundled extensions are
#copied to the install folder (share/extensions/install). Finally this
#service, which is part of the office installation package, will be
#started and the start "method" of this script is called. Then all
#extensions in the "install" folder are checked if they are already
#installed by reading the list "installed". Because the list is empty
#at this time, all the extensions will be installed.
#
#If this service is restarted then the script checks if there is an
#extensions which is not yet installed, that is there is no entry for
#it in the 'installed' file. Only if this is the case then that
#extensions will be installed and its path is added to 'installed'.
#
#In case of an update, new versions of existing extensions and
#completely new extensions may be copied to the 'install' folder. Also
#a new 'installed' file will be copied which replaces the existing
#file. The new 'installed' file does not contain any entries of
#installed extensions. Therefore the next time when the start method is
#run all extensions contained in share/extensions/install will be
#installed.
#Create the folder which contains the temporary user installation
INSTDIR=`/usr/bin/mktemp -d "/tmp/userinstall.XXXXXX"`
OOO_BASE_DIR="/opt/openoffice.org/basis${OOOBASEVERSION}"
case "$1" in
'start')
EXTENSIONDIR=/opt/openoffice.org${OOOBRANDPACKAGEVERSION}/share/extension/install
for FILE in $EXTENSIONDIR/*.oxt
do
#We check if the file exist, because if there is no extension
#then $FILE will contain "<..>/*.oxt"
if [ -f "$FILE" ]; then
#Determine if this extension is already installed. We do
#that by checking the file "installed" which contains a
#list of all installed extensions including the full path
EXTENSIONFILE=`basename $FILE`
INSTALLED=`sed -n "/$EXTENSIONFILE/p" $EXTENSIONDIR/installed`
if [ -z "$INSTALLED" ]; then
#We have not found the name of the extension in the
#list. That is, it has not been installed (with unopkg) yet.
#Therefore we do it now.
echo installing $FILE
/opt/openoffice.org${OOOBRANDPACKAGEVERSION}/program/unopkg add --shared --bundled "$FILE" '-env:UserInstallation=file://$INSTDIR' '-env:UNO_JAVA_JFW_INSTALL_DATA=$OOO_BASE_DIR/share/config/javasettingsunopkginstall.xml' '-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1'
#Let us remember that this extensions has been installed
#by adding the path name of the extension to the file
#installed
echo $FILE >> $EXTENSIONDIR/installed
fi
fi
done
#Now check for extensions which need to be uninstalled
#(unopkg). This is the case if the list of extensions in the file
#installed contains the name of an extension which does not exist
#in the the folder <..>/share/extension/install.
# LINE=""
# NEWCONTENT=""
# REMOVED=""
# LIST=`cat $EXTENSIONDIR/installed`
# #remove blank lines
# LIST=`echo "$LIST" | sed '/^[:blank:]*$/d'`
# echo "$LIST" | while [ 1 ]
# do
# read LINE || break
# if [ ! -f "$LINE" ]; then
# #The extension file has been removed from
# #share/extension/install. Now we remove the installed
# #extension
# echo removing `basename $LINE`
# /opt/openoffice.org${OOOBRANDPACKAGEVERSION}/program/unopkg remove --shared --bundled "`basename $LINE`" '-env:UserInstallation=file://$INSTDIR' '-env:UNO_JAVA_JFW_INSTALL_DATA=$OOO_BASE_DIR/share/config/javasettingsunopkginstall.xml' '-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1'
# REMOVED=1
# else
# NEWCONTENT+=$LINE
# NEWCONTENT+="\n"
# fi
# done
# #Write the new list to the file "installed". It now has all names
# #remove which refered to previously removed extensions (removed
# #from .../share/extension/install)
# if [ "$REMOVED" ]; then
# #remove the last empty line
# NEWCONTENT=`echo "$NEWCONTENT" | sed '/^[:space:]*$/d'`
# echo "$NEWCONTENT" > $EXTENSIONDIR/installed
# fi
;;
'stop')
echo "#### stop ####"
;;
*)
echo "Usage: $0 { start | stop }"
exit 1
;;
esac
exit $SMF_EXIT_OK