[Bese-devel] Re: Load a custom ucwctl.conf

Luca Capello luca at pca.it
Sun Apr 16 23:16:45 UTC 2006


Hello!

On Sat, 15 Apr 2006 00:29:22 +0200, Luca Capello wrote:
> Actually, it's quite complex to have a custom ucwctl.conf.
[...]
> 3) allow -u and all the other command line options.  This will be
>    really a pain to be coded: you must set the command line options
>    as temp (something like CONFIGFILE_TMP), at the end of the parse
>    run you read the ucwctl.conf (if present, fallback is solution 1)
>    and finally "fix" the temp variables.  Feasible, but not my
>    preferred...

I implemented this solution and at the end it's not so complex (but I
hope I considered all the possible scenarios).  I made some tests
(just echoing the variables) and it seems OK.  What happens, in order:

  1. /etc/ucw/ucwctl.conf is included (if present)
  2. $HOME/.ucw/ucwctl.conf is included (if present)
  3. if the option -u is used, the file specified is included if
     readable, otherwise exit with an error (you specify a file that
     doesn't exist or you cannot read?)
  4. all the variables specified via command line options overwrite the
     values in one of the three ucwctl config files

Nathan, I think this was what you asked for, right?  Do you (or other)
want to test the patch before inclusion?

Now, there're still some problems about the default values of 4
variables: $CONFIGFILE, $STARTFILE, $STOPFILE and $VARROOT.  These
should have a default value, because you should be able to call ucwctl
without any argument.  The possible options are:

  a) always default to the more general situation, i.e. /etc/ucw/files
     for the first three and /var for the last one.  If you want
     different locations, just customize $HOME/.ucw/ucwctl.conf.

  b) default to $HOME/.ucw/files and $HOME/var when $USER != root.  I
     don't understand why a root user wouldn't use the general
     /etc/ucw/files and /var.  If you develop your applications as
     root, you should seriously think to change ;-)

  c) a better solution than b) is to default to $HOME/.ucw/files only
     if these files exist, otherwise default to /etc/ucw/files.  For
     $VARROOT, the situation is the same as b), so default to
     $HOME/var if $USER != root (mostly because a normal user usually
     cannot create folder on /var).

I prefer solution a), but I'd like some comments before.

Thx, bye,
Gismo / Luca
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/bese-devel/attachments/20060417/c0d767d4/attachment.sig>


More information about the bese-devel mailing list