Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Sep 2003 02:02:17 +0100
From:      David Taylor <davidt@yadt.co.uk>
To:        freebsd-arch@FreeBSD.ORG
Subject:    Re: config files in packages (Re: (proposal) new flag forpkg_delete)
Message-ID:  <20030909010217.GA82266@gattaca.yadt.co.uk>
In-Reply-To: <57827.204.254.155.35.1063045587.squirrel@mail.migus.org>
References:  <49222.192.168.4.2.1062744486.squirrel@mail.migus.org> <20030908073749.A71336@FreeBSD.org> <57827.204.254.155.35.1063045587.squirrel@mail.migus.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 08 Sep 2003, Adam C. Migus wrote:
[snip]
> 
> I have been playing with your package for a little while now.  I
> like it so far and was waiting to see if you had anything else in
> the way of enhancements for it prior to commenting (as you've only
> released 0.2 thus far).  You're point about the base install didn't
> bother me as I was using it for diskless installations.
> 
> I like both of your ideas, adapting it for ports and for sysinstall.
>  Have you received any feedback?  Are there any known bugs or
> limitations in the current revision that might preclude
> experimentation with doing this now?

I'm currently (very slowly) working on an idea (as I posted somewhat
hastily earlier this thread).  The basic idea for merging is the same as
Eivind's, but I took a different approach to getting the 'reference'
config files.

Basically, port Makefiles would list config files in a format something
like:

CONFIG_FILES= foo.cfg:etc/foo/foo.cfg \
              bar_foo.cfg:etc/foo/bar/foo.cfg

(It's too late to be inventive with filenames, sorry :)

I need to work out exactly how the ports/package system can find the file,
but my current idea is to have the ports/package system install
etc/foo/foo.cfg.dist and etc/foo/bar/foo.cfg.dist (with a CONFIG_SUFFIX
defaulting to .dist), then have the ports .mk files and a plist @config
command handle the rest.

That is, the ports/package system would install the default config file if
no other config file existed, or the last user-created config file if one
existed.  It would also store the installed version in an RCS file
(e.g. /var/db/pkg/<package>/cfg/bar_foo.cfg,v).  The installed/merged
versions would then be stored on a branch off of the 'reference' file it
was last merged up to.

On uninstallation, pkg_delete would, as currently, delete the .dist file,
store the latest user file in the RCS file, and remove the config file.
I've just realised that storing the RCS files in /var/pkg/db/<package>
would result in them being deleted after an upgrade, so perhaps they need
to be stored elsewhere.  They'd also need to use /usr/ports/MOVED or
similar to handle changing package names.

However, I have (I think) worked out a way of doing this that would be
backwards compatible.  The pkgcfg_merge script could be set to use
simple mergemaster style merging (ignore the 'reference' file and merge
the new vs installed files), or a smarter diff3 style merging.

The only change required to ports would be:
	Config files should be listed in CONFIG_FILES= (or whatever it
          gets called)
	Distributed config files _must_ be installed with CONFIG_SUFFIX
          (or whatever) as a suffix, to avoid overwriting stuff.

The base system could either be handled as a special case (with a seperate
db dir), or as a 'fake' package of some form.

Hopefully, this makes more sense than my last mail about this.

(I am still planning on creating/submitting a pkg_delete patch, but
 this was more interesting, so bumped it down my todo list a bit)

-- 
David Taylor
davidt@yadt.co.uk
"The future just ain't what it used to be"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030909010217.GA82266>