Consider the blix
command (I made it up), which blixes things.
It requires configuration information.
The straightforward solution is to have a configuration file,
/etc/blix.conf
. It’s installed as part of the blix package,
and contains default values, such as:
Frequency: 30m # Every 30 minutes Priority: medium Level: 3 # 1 is lowest level, 5 is highest level Users: root # Only root is permitted to blix
To allow user sanchez
to blix, change the last line to:
Users: root,sanchez # Sanchez, too!
What happens when a new revision of the blix package comes out?
A new parameter has been added to /etc/blix.conf
. However,
you’ve edited /etc/blix.conf
:
Old | New |
---|---|
Frequency: 30m Priority: medium Level: 3 Users: root,sanchez |
Frequency: 30m Priority: medium Level: 3 Users: root Compression: xz |
Conflict! When you update, you’ll have to merge that file manually. Ack!
You could have separate system & user config files:
/etc/blix.system.conf
/etc/blix.user.conf
/etc/blix.system.conf
would be reserved for the system defaults,
and /etc/blix.user.conf
would be available for user editing.
That sounds great, but …
What if another package wants to add some blixing information?
Say that the vim
package wants to add a line to the blix
configuration file to specify how often ~/.vimrc
should be blixed?
Whichever file it modifies, we’ll have the same old problem at the next update.
Maybe we should have a whole bunch of configuration files!
That’s the best solution: instead of a single configuration
file /etc/blix.conf
, have a directory /etc/blix.d
.
The blix program will treat all files in /etc/blix.d
as
configration file. If the order matters, we can put prefixes
in the filenames to force processing order.
/etc/blix.d/40-vim
(part of the vim package)
/etc/blix.d/50-blix
(defaults provided as part of the blix package)
/etc/blix.d/90-user
(created by the user)
The filenames will be unique, as long as two packages don’t use the same name.
Modified: 2015-10-04T14:14 User: Guest Check: HTML CSSEdit History Source |
Apply to CSU |
Contact CSU |
Disclaimer |
Equal Opportunity Colorado State University, Fort Collins, CO 80523 USA © 2015 Colorado State University |