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

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



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

Attachment: pgp1sRtfLt6yj.pgp
Description: PGP signature


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