openoffice-extensions-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Openoffice-extensions-discuss] Re: [Gnewsense-dev] Hack for openoff


From: Sam Geeraerts
Subject: Re: [Openoffice-extensions-discuss] Re: [Gnewsense-dev] Hack for openoffice.org modification
Date: Tue, 08 Jun 2010 12:43:34 +0200
User-agent: Thunderbird 2.0.0.24 (X11/20100402)

Sam Geeraerts schreef:
Rubén Rodríguez schreef:
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

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"
----------------------------------------------------------------------

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.

Thanks for the tip. I've implemented this for gNS deltah and it works great.

Correction: needs a mkdir/rmdir because Hardy's dpkg-divert doesn't handle non-existent directories. Seems to be solved in future versions.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]