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

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

Re: [Openoffice-extensions-discuss] Hack for openoffice.org modification


From: Jason Self
Subject: Re: [Openoffice-extensions-discuss] Hack for openoffice.org modification
Date: Fri, 28 May 2010 23:28:41 -0700 (PDT)

Rubén Rodríguez <address@hidden> wrote ..
>
> 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/Ext
ensionManager.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/Ext
ensionManager.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 -- this is good information. It should probably be added to the wiki
(perhaps in the instructions area?)

reply via email to

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