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

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

 



On Tue, 5 Dec 2006, Till Maas wrote:

(discussed here instead of bugzilla, since it seems a bit ackward for large lumps
of text in bugzilla. I will summarize this exchange in bugzilla when proceeding)

> 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.

Note that the rpmsave files i create here are the ones of the new package, not
the old package. I'm leaving the creation of rpmsaves of the old package up
to the old package. I am just putting the new package's default config files
as rpmsave, so that after the migration, the user can look at any potential
new options in xl2tpd versus l2tpd and add those in. In other words, the
migration that starts does not cause any files of the new package to be lost
without being seen. Instead, they are left as rpmsaves, as if you had upgraded
from the same package.

I am also not entirely sure what the $1 value would be. I assume rpm -i won't work
because of the conflict with l2tpd, so this would require rpm -U, so $1 would be
2 I believe? I could do more testing if we need to go down this road.


> %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.

http://fedoraproject.org/wiki/Packaging/ScriptletSnippets

It seems it would have to be %post, because at %pre we don't have the new
package's config files yet to rpmsave.

I guess technically, it is cleaner to use "cp" versus "mv", and let the old
package deal with its own files. I used mv to prevent running the upgrade
twice. For example, image someone has l2tpd installed. They upgrade to xltpd,
but then install l2tpd. I have not put any Obsoletes: in l2tpd, so it would
just install next to xl2tpd. Then when xl2tpd is upgraded to a newer version,
it would re-migrate the wrong configurations. I guess I could release a new
version of l2tpd that Obsoletes: xl2tpd (and not bother writing backporting
migration scripts)

Paul
-- 
Building and integrating Virtual Private Networks with Openswan:
http://www.amazon.com/gp/product/1904811256/104-3099591-2946327?n=283155

-- 
fedora-extras-list mailing list
fedora-extras-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-extras-list

[Index of Archives]     [Fedora General Discussion]     [Fedora Art]     [Fedora Docs]     [Fedora Package Review]     [Fedora Desktop]     [Big List of Linux Books]     [Yosemite Backpacking]     [KDE Users]

  Powered by Linux