How to avoid reinstalling deliberately deleted config files on upgrade

Valery Reznic valery_reznic at yahoo.com
Fri Jun 12 03:33:29 UTC 2009




--- On Fri, 6/12/09, Richard Siddall <richard.siddall at elirion.net> wrote:

> From: Richard Siddall <richard.siddall at elirion.net>
> Subject: How to avoid reinstalling deliberately deleted config files on upgrade
> To: "General discussion about the RPM package manager" <rpm-list at lists.rpm.org>
> Date: Friday, June 12, 2009, 5:10 AM
> I'm packaging a system that uses the
> presence of configuration files to set some options: the
> option is on if the file is present, and off if the file is
> missing.
> 
> The problem I've run into (obviously) is that when I
> upgrade the RPM to a newer version, rpm reinstalls all the
> deliberately deleted config files.
> 
> I can't think of a way to stop rpm from doing this. 
> Does anyone have any suggestions?
In the pre-install script:
rm -rf /tmp/configs
mkdir -p /tmp/configs

[ -e /path1/config_1 ] && touch /tmp/configs/config_1
[ -e /path2/config_2 ] && touch /tmp/configs/config_2
...
[ -e /pathN/config_N ] && touch /tmp/configs/config_N

in the post-install script
[ -e /tmp/configs/config_1 ] || rm -f /path1/config_1
[ -e /tmp/configs/config_2 ] || rm -f /path2/config_2
...
[ -e /tmp/configs/config_N ] || rm -f /pathN/config_N
rm -rf /tmp/configs


It's an idea. You have to think how you are going to handle config options that were added/removed in the new version of package

Valery

> 
> Regards,
> 
>     Richard Siddall
> _______________________________________________
> Rpm-list mailing list
> Rpm-list at lists.rpm.org
> http://lists.rpm.org/mailman/listinfo/rpm-list
> 


      


More information about the Rpm-list mailing list