BTS

Issue546

Title Refactor out the command line parameter-processing
Priority feature Status resolved
Superseder Nosy List suntong
Assigned To suntong Topics grml-debootstrap

Created on 2008-10-07.14:44:57 by suntong, last changed 2009-02-16.21:12:24 by suntong.

Messages
msg1604 (view) Author: suntong Date: 2008-10-17.02:33:51
patches committed.
msg1591 (view) Author: suntong Date: 2008-10-11.16:05:14
On Sat, Oct 11, 2008 at 3:55 AM, Michael Prokop <bts@bts.grml.org> wrote:

> ACK, looks fine!

Greate! I've make minor change to it, as follows:

-----------------------------------------------
Bootstrap options:

  -m, --mirror=URL       Mirror which should be used for apt-get/aptitude.
  -i, --iso=mnt          Mountpoint where a Debian ISO is mounted to, for use
                           instead of fetching packages from a mirror.
  -r, --release=name     Release of new Debian system (default: stable).
  -t, --target=target    Target partition (/dev/...) or directory.
  -p, --mntpoint=mnt     Mountpoint used for mounting the target system.
      --debopt=params    Extra parameters passed to the debootstrap.
      --interactive      Use interactive mode (frontend).

Configuration options:


  -c, --config=file      Use specified configuration file, defaults to
                           /etc/debootstrap/config
      --packages         Install packages defined in /etc/debootstrap/packages.
      --debconf          Pre-seed packages using
                           /etc/debootstrap/debconf-selections
      --keep_src_list    Do not overwrite user provided apt sources.list.
      --hostname=name    Hostname of Debian system.
      --password=pwd     Use specified password as password for user root.

      --bootappend=line  Add specified appendline to kernel whilst booting.
      --groot=device     Root device for usage in grub, corresponds with
                           $TARGET in grub syntax, like hd0,0 for /dev/sda1.
      --grub=device      Target for grub installation. Use grub syntax for
                           specifying, like hd0 for /dev/sda.

Other options:

  -h, --help             Print this usage information and exit.
  -v, --version          Show summary of options and exit.
-----------------------------------------------

I.e., added a "Configuration options" section and group
"--interactive" into the "Bootstrap options" section. Is that OK?

About the --packages & --debconf, shall we add an optional parameter
to them, so that, whey used alone turn the feature on; whereas if
followed by the optional parameters, use it as the parameter as the
file name for packages list / pre-seed db?

cheers
msg1588 (view) Author: mika Date: 2008-10-11.07:55:01
* Tong Sun <bts@bts.grml.org> [20081011 04:57]:

> For consistancy with future parameters handling maintaince, I need to
> alter the help text format like the following, which does not vary too
> much from the original:

> -------------------------------------------------
> grml-debootstrap - wrapper around debootstrap for installing Debian

> Usage: grml-debootstrap [options]

> Bootstrap options:

>   -m, --mirror=URL       Mirror which should be used for apt-get/aptitude.
>   -i, --iso=mnt          Mountpoint where a Debian ISO is mounted to, for use
>                            instead of fetching packages from a mirror.
>   -r, --release=name     Release of new Debian system (default: stable).
>   -t, --target=target    Target partition (/dev/...) or directory.
>   -p, --mntpoint=mnt     Mountpoint used for mounting the target system.
>       --debopt=params    Extra parameters passed to the debootstrap.

>   -c, --config=file      Use specified configuration file, defaults to
>                            /etc/debootstrap/config
>       --packages         Install packages defined in /etc/debootstrap/packages.
>       --debconf          Pre-seed packages using
>                            /etc/debootstrap/debconf-selections
>       --keep_src_list    Do not overwrite user provided apt sources.list.
>       --hostname=name    Hostname of Debian system.
>       --password=pwd     Use specified password as password for user root.

>       --bootappend=line  Add specified appendline to kernel whilst booting.
>       --groot=device     Root device for usage in grub, corresponds with
>                            $TARGET in grub syntax, like hd0,0 for /dev/sda1.
>       --grub=device      Target for grub installation. Use grub syntax for
>                            specifying, like hd0 for /dev/sda.

>       --interactive      Use interactive mode (frontend).

> Other options:

>   -h, --help             Print this usage information and exit.
>   -v, --version          Show summary of options and exit.

> Send bugreports to the grml-team: bugs@grml.org || http://grml.org/bugs/
> -------------------------------------------------

> This is the format that complies with most GNU C/C++ program helps.
> What do you think, mika? I altered the order of the parameters as
> well. Please comment.

ACK, looks fine!

regards,
-mika-
msg1586 (view) Author: suntong Date: 2008-10-11.02:57:01
Hi,

For consistancy with future parameters handling maintaince, I need to
alter the help text format like the following, which does not vary too
much from the original:

-------------------------------------------------
grml-debootstrap - wrapper around debootstrap for installing Debian

Usage: grml-debootstrap [options]

Bootstrap options:

  -m, --mirror=URL       Mirror which should be used for apt-get/aptitude.
  -i, --iso=mnt          Mountpoint where a Debian ISO is mounted to, for use
                           instead of fetching packages from a mirror.
  -r, --release=name     Release of new Debian system (default: stable).
  -t, --target=target    Target partition (/dev/...) or directory.
  -p, --mntpoint=mnt     Mountpoint used for mounting the target system.
      --debopt=params    Extra parameters passed to the debootstrap.

  -c, --config=file      Use specified configuration file, defaults to
                           /etc/debootstrap/config
      --packages         Install packages defined in /etc/debootstrap/packages.
      --debconf          Pre-seed packages using
                           /etc/debootstrap/debconf-selections
      --keep_src_list    Do not overwrite user provided apt sources.list.
      --hostname=name    Hostname of Debian system.
      --password=pwd     Use specified password as password for user root.

      --bootappend=line  Add specified appendline to kernel whilst booting.
      --groot=device     Root device for usage in grub, corresponds with
                           $TARGET in grub syntax, like hd0,0 for /dev/sda1.
      --grub=device      Target for grub installation. Use grub syntax for
                           specifying, like hd0 for /dev/sda.

      --interactive      Use interactive mode (frontend).

Other options:

  -h, --help             Print this usage information and exit.
  -v, --version          Show summary of options and exit.

Send bugreports to the grml-team: bugs@grml.org || http://grml.org/bugs/
-------------------------------------------------

This is the format that complies with most GNU C/C++ program helps.
What do you think, mika? I altered the order of the parameters as
well. Please comment.

If we can agree upon the content (including the sections, order...
everything but format) of the help text, I can move forward and code
the .clp script.

thanks
msg1576 (view) Author: mika Date: 2008-10-07.15:07:12
* Tong Sun <bts@bts.grml.org> [20081007 17:05]:

> If we need the command line parameter --keep_src_list (or something
> else), what would the short description be?

> would "do not overwrite user provided apt sources.list" do?

Definitely a good start, yes. :)

regards,
-mika-
msg1575 (view) Author: suntong Date: 2008-10-07.15:05:31
bts title get changed after my 2nd post. changing it back.

Also,

If we need the command line parameter --keep_src_list (or something
else), what would the short description be?

would "do not overwrite user provided apt sources.list" do?
msg1574 (view) Author: mika Date: 2008-10-07.15:02:03
* Tong Sun <bts@bts.grml.org> [20081007 16:54]:

> > > What do you think the option that let users to provide their own apt sources.list?

> > > # do not build /etc/apt/sources.list on the fly. This allow user to
> > > # provide their own apt sources.list from /etc/debootstrap/etc/apt/sources.list
> > > #KEEP_SRC_LIST='yes'

> > ACK

> Do we need a command line parameter for it?

Would be fine, yes.

> If yes, will --keep_src_list do, or something else?

Sounds reasonable, ACK from my side.

regards,
-mika-
msg1573 (view) Author: suntong Date: 2008-10-07.15:00:39
bts title get changed after my 2nd post. changing it back.

Also,

If we need the command line parameter --keep_src_list (or something
else), what would the short description be?

would "do not overwrite user provided apt sources.list" do?
msg1572 (view) Author: suntong Date: 2008-10-07.14:54:27
from mika:

> > What do you think the option that let users to provide their own apt sources.list?
>
> > # do not build /etc/apt/sources.list on the fly. This allow user to
> > # provide their own apt sources.list from /etc/debootstrap/etc/apt/sources.list
> > #KEEP_SRC_LIST='yes'
>
> ACK

Do we need a command line parameter for it?

If yes, will --keep_src_list do, or something else?
msg1571 (view) Author: suntong Date: 2008-10-07.14:44:54
Hi,

to log into bts what I intent to do...

[Comments from mika]:

> What would you think if we refactor out the command line
> parameter-processing into a separated file, say $PN.clp?

> If you are ok with it, I will take the response of building and
> maintaining the .clp/.hlp file. The only thing I need is the switch
> name (e.g, --boot=ldr) and  switch description ("boot loader that
> ..."), and I'll take care of the rest. In fact, if you plan to build
> further scripts, I'll willing to take the response of building the
> .clp/.hlp files for them as well. . .

> With so many cmdline switches adding to grml-debootstrap,  I think it
> is a good time to settle with it now than later. . .

> I know there are lots of technical details and concerns we need to
> settle first. Let's discuss them now. for example the .hlp file, we
> can make it a plain text file, so instead of sourcing it, why don't we
> change from

> usage() {
>   echo "$PN - ...

> to
> usage() {
>   cat "$PN".hlp
>   more scripts if needed for providing any further help information
> }

> This shouldn't vary too much from the original design. If you still
> don't feel comfortable with it, we can do away with the .hlp file and
> maintain the help text just as before -- I'm open to any discussions.

I'm not comfortable with it because I don't see the big benefit from
it right now.

> >  Putting
> > cmdline stuff into an extra file is a good idea but when doing so
> > I'd like to put some other stuff to separate files as well. :)

> let's take the command line parameter-processing as the first step,
> shall we? tackle one beast at a time, :-)

NACK for the usage stuff, but if *you* think that moving the cmdline
stuff into an external file is worth the effort: go for it and I'll
accept tested patches.

[Current status]

work started

[Concerns & issues]

- shall we settle the extension of the command line
parameter-processing separated file to .clp? that'll make my life a
bit easier since it will be consistent with my other scripts.
- on factoring out the command line parameter-processing, two more
dependents are required for grml-debootstrap: coreutils for readlink
and util-linux for getopt, thought it won't be a big deal since both
are essential packages available from debootstrap.
History
Date User Action Args
2009-02-16 21:12:24suntongsetstatus: chatting -> resolved
2008-10-17 03:07:51suntongsettopic: + grml-debootstrap
2008-10-17 02:33:51suntongsetassignedto: suntong
messages: + msg1604
2008-10-11 16:05:15suntongsetmessages: + msg1591
2008-10-11 07:55:03mikasetmessages: + msg1588
2008-10-11 02:57:02suntongsetmessages: + msg1586
2008-10-10 22:16:03suntongsetpriority: feature
2008-10-07 15:07:12mikasetmessages: + msg1576
2008-10-07 15:05:31suntongsetmessages: + msg1575
title: RE: allow user to provide their own apt sources.list -> Refactor out the command line parameter-processing
2008-10-07 15:02:03mikasetmessages: + msg1574
title: Refactor out the command line parameter-processing -> RE: allow user to provide their own apt sources.list
2008-10-07 15:00:39suntongsetmessages: + msg1573
title: RE: allow user to provide their own apt sources.list -> Refactor out the command line parameter-processing
2008-10-07 14:54:29suntongsetstatus: unread -> chatting
messages: + msg1572
title: Refactor out the command line parameter-processing -> RE: allow user to provide their own apt sources.list
2008-10-07 14:44:57suntongcreate