I think I mentioned a prototype for cfgtool here recently.
If you remember the /etc/default discussions, this is a
continuation of them. The idea is to have a program as the
interface to the configurable variables, instead of files in
/etc/default. A program is better, because then the location,
syntax, and other details can be more easily changed.
For newcomers, this is a proposal for centralizing configuration
of certain "system variables" into one place. For instance,
how long files in /tmp are kept. The current method is to have
the variables at the top of the script that uses them, and then
marking the script as a configuration file. This is bad, because
when the package maintainer fixes a problem in the code part of
the script, the system administrator needs to re-configure the
new script by editing it by hand. If the variables are moved
out of the script, the script can be updated automatically,
and the admin doesn't need to do anything special.
An earlier proposal was to have a directory /etc/default,
where all the variables were in files that could be `sourced'
by /bin/sh. This is slightly awkward, but it would work.
Some other systems (SGI?) have a program called chkconfig(sp?),
which supports only booleans. My cfgtool prototype supports
arbitrary values for variables. This version has special support
for booleans: it's easier to test them than with the old version.
Intended usage would be like this (using the /tmp-cleaning
example):
1. When the package is first installed, the package's postinst
script executes the following command:
cfgtool --create tmptime 0
This creates a new "system variable" tmptime, and sets its
value to 0.
2. /etc/init.d/boot, which is run automatically during boot
and removes files that are at least as old as tmptime days
from /tmp, executes the following:
TMPTIME=`cfgtool --get tmptime`
This sets the shell internal variable TMPTIME to the value
of the cfgtool variable tmptime. This replaces the following
line in the current /etc/init.d/boot:
TMPTIME=0
The code part of the script stays as it is; no change.
3. If a sysadmin wants to change the value of tmptime, he
gives the following command:
cfgtime --set tmptime 365
After this, only files at least one year old would be
deleted at boot time.
4. When the Harriet Hacker decides to make Debian really
easy to administrate, she writes a dialog interface
to cfgtool, which displays all the variables,
their current values, their help texts, and lets
the administrator easily look at and change them.
cfgtool already has almost everything that is needed
for this (listing the available variables is not yet
implemented). Once the dialog interface is done, she
goes on and writes a Tcl/Tk interface, so that things
can be done using a point, click, and drool interface.
5. Debian takes over the world, and everyone lives happy
forever after (even Bill Gates, since he now has time
to play with his $300M house ;-).
I append the manual page for cfgtool.
NAME
cfgtool - manipulate system configuration variables
SYNOPSIS
cfgtool [--create variable value] [--destroy variable]
[--get variable] [--set variable value] [--get-help vari
able] [--set-help variable helpfile language] [--is-true
variable] [--is-false variable] [--lock] [--unlock]
[--locked]
DESCRIPTION
cfgtool manages a database of system configuration vari
ables.
OPTIONS
--get variable
Print value of variable to stdout.
--set variable value
Set value of variable to value The variable must
exist.
--create variable value
Create a new variable and set its initial value.
--destroy variable
Destroy a variable.
--set-help variable helpfile language
Set description of variable in some given language.
English is "en". Note that LANG is not obeyed for
this option.
--get-help variable
Output description of variable to stdout. LANG is
obeyed.
--is-true variable
Check whether variable exists and contains the
value "yes". Don't output anything, just set the
exit code.
--is-false variable
Opposite of --is-false: condition is true, if vari
able exists and contains the value "no" (actually,
any value but "yes").
--lock Lock variable repository.
--unlock
Unlock variable repository.
--locked
The variable repository was locked by an earlier
process, but we own the lock. This is useful for
cases when you want to do many updates, and can't
do them with one invocation. This must be the
first option, if it used at all.
ENVIRONMENT
LANG Language for help files, when reading them.
Default is "en" for English.
--
Please read <http://www.iki.fi/liw/mail-to-lasu.html> before mailing me.
Please don't Cc: me when replying to my message on a mailing list.
Attachment:
pgpl6ptk86Kok.pgp
Description: PGP signature