Updating package config (was: Re: rpms/xl2tpd/devel xl2tpd.spec, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2)

Till Maas opensource at till.name
Tue Dec 5 14:16:18 UTC 2006


On Tuesday 05 December 2006 07:17, Paul Wouters wrote:

> if [ -f /etc/l2tpd/l2tpd.conf ]
> then
>         echo "Old /etc/l2tpd configuration found, migrating to /etc/xl2tpd"
>         mv /etc/xl2tpd/xl2tpd.conf /etc/xl2tpd/xl2tpd.conf.rpmsave
>         cat /etc/l2tpd/l2tpd.conf | sed "s/options.l2tpd/options.xl2tpd/" >
>             /etc/xl2tpd/xl2tpd.conf 
>         mv /etc/ppp/options.xl2tpd /etc/ppp/options.xl2tpd.rpmsave
>         mv /etc/ppp/options.l2tpd  /etc/ppp/options.xl2tpd 
>         mv /etc/xl2tpd/l2tp-secrets /etc/xl2tpd/l2tpd-secrets.rpmsave
>         cp -a /etc/l2tpd/l2tp-secrets /etc/xl2tpd/l2tp-secrets
>
> fi

I would do it this way, the "$1" = "1" ensures, that this is only performed 
once the package is installed for the first time and according to my 
understanding does this make rpm create if .rpmsave files if needed.

%pre
if [ "$1" == "1" -a -f /etc/l2tpd/l2tpd.conf ]
then
	cp -p /etc/l2tpd/l2tpd.conf /etc/xl2tpd/xl2tpd.conf
	cp -p /etc/ppp/options.l2tpd /etc/ppp/options.xl2tpd
	cp -p /etc/l2tpd/l2tp-secrets /etc/xl2tpd/l2tp-secrets
	sed -i "s/options.l2tpd/options.xl2tpd/" /etc/xl2tpd/xl2tpd.conf
fi

I did not find any hint on how to perform this task, so maybe someone can tell 
whether this is better handled in %pre or %post.

Regards,
Till
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-extras-list/attachments/20061205/bac3f261/attachment.sig>


More information about the fedora-extras-list mailing list