1 #!/sbin/sh 2 3 . /lib/svc/share/smf_include.sh 4 5 #The start method is used for installing and updating the 6 #extensions. The service keeps a list 7 #(share/extensions/install/installed) of the extensions which were 8 #already installed. During installation, the bundled extensions are 9 #copied to the install folder (share/extensions/install). Finally this 10 #service, which is part of the office installation package, will be 11 #started and the start "method" of this script is called. Then all 12 #extensions in the "install" folder are checked if they are already 13 #installed by reading the list "installed". Because the list is empty 14 #at this time, all the extensions will be installed. 15 # 16 #If this service is restarted then the script checks if there is an 17 #extensions which is not yet installed, that is there is no entry for 18 #it in the 'installed' file. Only if this is the case then that 19 #extensions will be installed and its path is added to 'installed'. 20 # 21 #In case of an update, new versions of existing extensions and 22 #completely new extensions may be copied to the 'install' folder. Also 23 #a new 'installed' file will be copied which replaces the existing 24 #file. The new 'installed' file does not contain any entries of 25 #installed extensions. Therefore the next time when the start method is 26 #run all extensions contained in share/extensions/install will be 27 #installed. 28 29 #Create the folder which contains the temporary user installation 30 INSTDIR=`/usr/bin/mktemp -d "/tmp/userinstall.XXXXXX"` 31 32 OOO_BASE_DIR="/opt/openoffice.org/basis${OOOBASEVERSION}" 33 34 case "$1" in 35 'start') 36 EXTENSIONDIR=/opt/openoffice.org${OOOBRANDPACKAGEVERSION}/share/extension/install 37 for FILE in $EXTENSIONDIR/*.oxt 38 do 39 #We check if the file exist, because if there is no extension 40 #then $FILE will contain "<..>/*.oxt" 41 if [ -f "$FILE" ]; then 42 #Determine if this extension is already installed. We do 43 #that by checking the file "installed" which contains a 44 #list of all installed extensions including the full path 45 EXTENSIONFILE=`basename $FILE` 46 INSTALLED=`sed -n "/$EXTENSIONFILE/p" $EXTENSIONDIR/installed` 47 48 if [ -z "$INSTALLED" ]; then 49 #We have not found the name of the extension in the 50 #list. That is, it has not been installed (with unopkg) yet. 51 #Therefore we do it now. 52 echo installing $FILE 53 /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' 54 #Let us remember that this extensions has been installed 55 #by adding the path name of the extension to the file 56 #installed 57 echo $FILE >> $EXTENSIONDIR/installed 58 fi 59 fi 60 done 61 62 #Now check for extensions which need to be uninstalled 63 #(unopkg). This is the case if the list of extensions in the file 64 #installed contains the name of an extension which does not exist 65 #in the the folder <..>/share/extension/install. 66 # LINE="" 67 # NEWCONTENT="" 68 # REMOVED="" 69 # LIST=`cat $EXTENSIONDIR/installed` 70 # #remove blank lines 71 # LIST=`echo "$LIST" | sed '/^[:blank:]*$/d'` 72 73 # echo "$LIST" | while [ 1 ] 74 # do 75 # read LINE || break 76 # if [ ! -f "$LINE" ]; then 77 # #The extension file has been removed from 78 # #share/extension/install. Now we remove the installed 79 # #extension 80 # echo removing `basename $LINE` 81 # /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' 82 # REMOVED=1 83 # else 84 # NEWCONTENT+=$LINE 85 # NEWCONTENT+="\n" 86 # fi 87 # done 88 89 # #Write the new list to the file "installed". It now has all names 90 # #remove which refered to previously removed extensions (removed 91 # #from .../share/extension/install) 92 # if [ "$REMOVED" ]; then 93 # #remove the last empty line 94 # NEWCONTENT=`echo "$NEWCONTENT" | sed '/^[:space:]*$/d'` 95 # echo "$NEWCONTENT" > $EXTENSIONDIR/installed 96 # fi 97 98 ;; 99 'stop') 100 echo "#### stop ####" 101 ;; 102 *) 103 echo "Usage: $0 { start | stop }" 104 exit 1 105 ;; 106 esac 107 108 exit $SMF_EXIT_OK 109