Mailinglist Archive: opensuse-packaging (171 mails)

< Previous Next >
Re: [opensuse-packaging] changed config location
Am 06.03.2012 15:25, schrieb Michael Schroeder:
On Tue, Mar 06, 2012 at 11:56:11AM +0100, Lutz Thuns wrote:
I'm currently packaging wbar in my home-project.

Recently upstream has changed the default config directory from
/etc/default/wbar to /etc/wbar.d/
Now I want to make sure that any existing (changed) configuration in
/etc/default/wbar will be kept in /etc/wbar.d
Otherwise there would be both an old config dir (with possibly changed
.conf files) and a new config dir (with "stock" configuration).

I think I have to do this via a script in %pre.
Any ideas how to exactly do this?

rpm calculates the fate of the files before running the transactions,
so it's not really possible to change the fate in the transaction
(even a %pretrans script won't help).
It should be possible to emulate rpm's behaviour in a posttrans
scriptlet, though. (I.e. *cp* the old config from /etc/default/wbar
to /etc/wbar.d/ while adding a .rpmsave suffix or the like.)

Also, note that you currently can't replace directories with
symlinks to directories and vice versa. So please do not add
a "compatibility symlink", it'll just break updates.

I'm thinking of following %post section:

# backup old configuration files to new location
if [ -d /etc/default/wbar ]; then
for i in /etc/default/wbar/*; do
cp $i /etc/wbar.d/$i.rpmsave
rm -r /etc/default/wbar

Or is this a rather dirty solution?


To unsubscribe, e-mail: opensuse-packaging+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse-packaging+owner@xxxxxxxxxxxx

< Previous Next >
Follow Ups