[csw-maintainers] Migrating config files from /opt/csw/etc to /etc/opt/csw during package update

Maciej (Matchek) Blizinski maciej at opencsw.org
Mon Oct 19 01:39:45 CEST 2009


I've written the first version of cswmigrateconf, a class utility
script which migrates configuration files from /opt/csw/etc to
/etc/opt/csw. It works the way Sebastian has suggested, i.e.: It makes
an intermediate copy in /opt/csw/etc/migration-archive, and then uses
it as a source to populate /etc/opt/csw.

The change can be viewed here:
http://sourceforge.net/apps/trac/gar/changeset/6899
http://gar.svn.sourceforge.net/svnroot/gar/csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswmigrateconf

It also deals with a situation where there are symlinks from
/etc/opt/csw/foo.conf go /opt/csw/etc/foo.conf -- or any (soon to be)
dangling symlinks.

To use the class utility script, one needs to create a configuration
file for it and set the file class. Only one configuration file is
allowed per package. An example of a simple configuration file:

MIGRATE_FILES="odbc.ini odbcinst.ini"

That's it. The migration script will do the rest. If one wanted to
migrate odbc.ini to a different directory, here's how to do it:

MIGRATE_FILES="odbc.ini odbcinst.ini"
SOURCE_DIR_odbc_ini="opt/csw/etc/mysubdir"
DEST_DIR_odbc_ini="etc/opt/csw/anotherplace"

Leading slash won't hurt, but it's not necessary.

If all the files share the same subdirectory, default source directory
can be specified:
SOURCE_DIR___default__="etc/opt/csw/mysubdir"

It's been briefly tested on my workstation. I've built a package and
put it into testing:
http://mirror.opencsw.org/testing/cswclassutils-1.24,REV=2009.10.19-SunOS5.8-all-CSW.pkg.gz

The code is somewhat complex; I did my best to make it readable.
Comments and questions are appreciated.

Maciej


More information about the maintainers mailing list