Group: OpenOfficeExtensions/Instructions

From LibrePlanet
Jump to: navigation, search

Beta instructions for using the free repository

NOTE: These are draft instructions -- bug reports and suggestions for better ways to make the switch are welcome.

The setting for the extension repository URL is in the OpenOffice.org registry. To use our replacement, open a file in your favorite text editor (like emacs, vim, or gedit) called:

   $HOME/.openoffice.org/3/user/registry/data/org/openoffice/Office/ExtensionManager.xcu

and paste these lines:

   <?xml version="1.0" encoding="UTF-8"?>
   <oor:component-data xmlns:oor="http://openoffice.org/2001/registry"
   xmlns:install="http://openoffice.org/2004/installation" xmlns:xs="http://www.w3.org/2001/XMLSchema"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" oor:name="ExtensionManager" oor:package="org.openoffice.Office">
     <node oor:name="ExtensionRepositories">
       <prop oor:name="WebsiteLink">
         <value>http://www.fsf.org/openoffice</value>
       </prop>
     </node>
   </oor:component-data>

If you have OpenOffice.org running, you'll need to restart it before the change will take effect.

Now when you go to Tools => Extension Manager => Get more extensions online, you should be taken to the FSF listing.

On Microsoft Windows, the file should be:

   ...\OpenOffice.org 3\user\registry\data\org\openoffice\Office\ExtensionManager.xcu

To access the file on Mac OS X, right-click (or control-click) on the OpenOffice.org application, select "Show Package Contents", and navigate to:

   /Contents/basis-link/share/registry/data/org/openoffice/Office/ExtensionManager.xcu

Information on dpkg-divert

This is an easy way to replace a file in any package without making it fail on the next update. Dpkg-divert allows several packages to provide the same file -and the original provider package doesn't need to know-.

You can use dpkg-divert standalone, simply running it to rename any file in the system will create an entry in a list that will be checked every time a package wants to unpack that file. dpkg-divert will force the file to be unpacked on the renamed path instead. It doesn't matter if the file exists when you run dpkg-divert, you can create the diversion just in case a package wants to write your file in the future.

You can check the list of current diversions in the system at /var/lib/dpkg/diversions.

dpkg-divert is most often run from deb scripts to automate the process. To do so, you create a deb package including a file already provided by some other, and a preinst and postrm scripts to manage dpkg-divert.

Here goes an example, to replace the ExtensionManager.xcu file using a package named ooo-hacks:

In debian/preinst:

   #!/bin/sh
   file =
     "/usr/lib/openoffice/basis3.2/share/registry/data/org/openoffice/Office/ExtensionManager.xcu"
     [-f "$file" ".ubuntu"]
     || dpkg - divert-- package ooo -
     hacks-- add-- rename-- divert "$file" ".ubuntu" "$file"

In debian/postrm:

   #!/bin/sh
   file =
     "/usr/lib/openoffice/basis3.2/share/registry/data/org/openoffice/Office/ExtensionManager.xcu"
     if[remove = "$1" - o abort - install = "$1" - o disappear =
        "$1" - o abort - upgrade = "$1"]
     then[-f "$file" ".ubuntu"]
       && dpkg - divert-- package ooo -
       hacks-- remove-- rename-- divert "$file" ".ubuntu" "$file"
     fi

This method can be used to customize a package without compiling it, which in some cases can provide better freedom. For that to work the priority of the package needs to be "required", so it cannot be uninstalled without manually forcing it, and it can't be used to replace non-free binaries, because it will not stop the offending file from being distributed.

And be aware that this method can only replace files that are put in place by unpacking. If they are created by a script or during runtime (like most of /var and a lot in /etc) it will fail.