[issue801] grml-debootstrap parameter handling
Ulrich Dangel
bts at bts.grml.org
Fri Jan 15 22:07:47 CET 2010
Ulrich Dangel <mru at grml.org> added the comment:
On Friday 15 January 2010 17:47:36 Tong Sun wrote:
Hi,
> Referring to "Remove duplicate : in getopt definition."
> http://git.grml.org/?p=grml-debootstrap.git;a=commit;h=30d47e014a7ce7a0f48e
> 21a8d27420ba28fe8082
>
> When grml-debootstrap parameter handling was first fully implemented, the
> "duplicated" : in getopt definition worked follows.
>
> - they are switches with *optional* parameters
Hm? From grml-debootstrap usage():
--debopt <params> Extra parameters passed to the debootstrap command.
--packages <file> Install packages defined in specified list file.
For me, it seems that they must have a parameter.
And at least after a short look it seems that the $_opt_{debopt,packages}_set
variables are not really needed.
> - their corresponding configuration variable values are set to off in
> /etc/debootstrap/config
> - this means that the --packages, --debconf features are off by default
> unless turned on on the commandline, using --packages, or --debconf
> (without the optional parameters)
I honestly do not see the usecase for that feature. IMHO it is also a little
bit problematic, e.g. you set DEBOOTSTRAP_OPT in the config file, but it is
not used/executed. From my point of view a little bit problematic.
> - if optional parameters are giving on the commandline, eg
> --debconf=/some/file/else.conf, the given file is used (eg, as the pre-seed
> db file) instead of the default one.
>
> This gives the maximum flexibility. I hope you can agree with it as well.
The problem with your solution is that it does not work as expected if you use
extra parameters, e.g.:
$ grep :: cmdlineopts.clp
CMDLINE_OPTS=mirror:,iso:,release:,target:,mntpoint:,debopt:,interactive,nodebootstrap,config:,confdir:,packages::,chroot-
scripts:,scripts:,pre-
scripts:,debconf::,keep_src_list,hostname:,password:,bootappend:,grub:,arch:,insecure,verbose,help,version
$ . ./cmdlineopts.clp --package 445 --bootappend append
$ echo $_opt_packages
$ echo $_opt_bootappend
# now as one parameter
$ ./cmdlineopts.clp --package=445 --bootappend append
$ echo $_opt_packages
445
$ echo $_opt_bootappend
append
You can test it yourself, there is a unit test available in the tests
directory, just change into the tests directory and execute run_tests.sh
You must have installed the shunit2 debian package or modify the unit test to
use a local shunit2 package.
Ulrich
----------
files: unnamed
messages: 2835, 2837, 2838, 2848, 2849
nosy: suntong
priority: bug
status: chatting
title: grml-debootstrap parameter handling
_____________________________________
GRML issue tracker <bts at bts.grml.org>
<http://bts.grml.org/grml/issue801>
_____________________________________
More information about the Bugs-changes
mailing list