summaryrefslogtreecommitdiff
path: root/setup_native/source/opensolaris/bundledextensions/svc-ooo_bundled_extensions
diff options
context:
space:
mode:
Diffstat (limited to 'setup_native/source/opensolaris/bundledextensions/svc-ooo_bundled_extensions')
-rw-r--r--setup_native/source/opensolaris/bundledextensions/svc-ooo_bundled_extensions108
1 files changed, 108 insertions, 0 deletions
diff --git a/setup_native/source/opensolaris/bundledextensions/svc-ooo_bundled_extensions b/setup_native/source/opensolaris/bundledextensions/svc-ooo_bundled_extensions
new file mode 100644
index 000000000000..696277011133
--- /dev/null
+++ b/setup_native/source/opensolaris/bundledextensions/svc-ooo_bundled_extensions
@@ -0,0 +1,108 @@
+#!/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