Configuration directory migration

Configuration files have been historically kept in /opt/csw/etc. There is consensus to migrate to a new location, /etc/opt/csw, for most configuration files, particularly ones that need to be machine local.

Incentives to move to /etc/opt/csw

  • Have one single place for configuration files. Currently most packages use /opt/csw/etc, while some use /etc/opt/csw. This is confusing to people as they don't know where to look for configuration files (depends on the package).
  • Support for shared, read-only /opt/csw directory. Two main cases are /opt/csw shared over NFS and sparse non-global zones, where /opt/csw is inherited from the global zone. System daemons such as CUPS or syslog-ng need writable directories (hence /var/opt/csw). Other pieces of software need different configurations for different zones (hence writable /etc/opt/csw).

The single file case

We're considering the case of a single configuration file foo.conf, which used to live in /opt/csw/etc and is about to be moved to /etc/opt/csw. The hypothetical sysadmin wants, if possible, to just upgrade the package and might not know about the configuration directory migration.

CSWbar before CSWbar after
/opt/csw/etc/foo.conf /etc/opt/csw/foo.conf
# Strategy Example implementation(s) Install passes CSWbar works in the global zone CSWbar works in sparse non-global zones Edits to /opt/csw/etc/foo.conf work as previously Gives an impression of supporting /opt/csw/etc Guarantee that sysadmin knows
0. No action Yes No No No Yes No
1. Fail if /opt/csw/etc/foo.conf is present preinstall No No No No No Yes
2. mv /opt/csw/etc/foo.conf /etc/opt/csw/foo.conf Yes Yes No No No No
3. cp /opt/csw/etc/foo.conf /etc/opt/csw/foo.conf Yes Yes Yes No Yes* No
4. ln -s ../../../opt/csw/etc/foo.conf /etc/opt/csw/foo.conf ** postinstall Yes Yes Yes Yes Yes* No
5. mv /opt/csw/etc/foo.conf /opt/csw/etc/migration-archive && cp /opt/csw/etc/migration-archive/foo.conf /etc/opt/csw postinstall cswmigrateconf Yes Yes Yes No No No

* — Can be amended by placing signposts.

** — The option of linking the other way has also been considered, but it requires actions from point 5 and doesn't add anything.


To make the sysadmin aware of the change, signposts in /opt/csw/etc could be placed. For instance:

# ls -l /opt/csw/etc/foo*
-rw-r--r--   1 root     root           4 Sep  1 15:36 /opt/csw/etc/foo.conf
-rw-r--r--   1 root     root         236 Sep  1 15:38 /opt/csw/etc/foo.conf.THIS_LOCATION_IS_DEPRECATED
This location (/opt/csw/etc) is deprecated.

Configuration files are currently being placed in /etc/opt/csw.  Please make
sure your new configuration is in /etc/opt/csw and remove the old one from

The complex case

There might be a complex case which cannot be reduced to a set of known configuration files. In such case, an attempt to migrate the configuration automatically is not a good idea. What should the package pre/postinstall scripts do? For instance:

  1. In the preinstall script, display information about the need to migrate the configuration
  2. pause for 10 seconds, allowing the user to abort the installation
  3. One of the two:
    • proceed with the installation, using the new configuration files
    • return non-zero exit code, therefore aborting the installation

There's an example implementation.

The topic is open for discussion on the mailing list.

See also

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License