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.
Thanks. I'm thinking of following %post section: %post # 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 done rm -r /etc/default/wbar fi Or is this a rather dirty solution? Cheers, Lutz -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org