[lxc-devel] [PATCHES] improve lxc-download help and --list function

Stéphane Graber stgraber at ubuntu.com
Thu Jan 15 23:26:42 UTC 2015


On Fri, Jan 16, 2015 at 12:21:40AM +0100, Michael Adam wrote:
> Hi,
> 
> While working on the documentation improvements for the other
> templates in accordance to the download template, as discussed,
> I came across a few small improvements to lxc-download itself:
> 
> - typofix
> - make --list more useful
> - document --help and --list separately as special options.
> 
> Thanks for consideration!
> 
> Michael

The whole set looks good, thanks!

Acked-by: Stéphane Graber <stgraber at ubuntu.com>

> 
> 
> 
> From 8b90ae51e19c6963730a02ecc1a0911df09375d3 Mon Sep 17 00:00:00 2001
> From: Michael Adam <obnox at samba.org>
> Date: Fri, 16 Jan 2015 00:13:35 +0100
> Subject: [PATCH 1/3] lxc-download: fix typo in help text.
> 
> Signed-off-by: Michael Adam <obnox at samba.org>
> ---
>  templates/lxc-download.in | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/templates/lxc-download.in b/templates/lxc-download.in
> index 73704ba..6fc5d2e 100644
> --- a/templates/lxc-download.in
> +++ b/templates/lxc-download.in
> @@ -202,7 +202,7 @@ Optional arguments:
>  [ --keyserver <keyserver> ]: GPG keyserver to use
>  [ --no-validate ]: Disable GPG validation (not recommended)
>  [ --flush-cache ]: Flush the local copy (if present)
> -[ --force-cache ]; Force the use of the local copy even if expired
> +[ --force-cache ]: Force the use of the local copy even if expired
>  
>  LXC internal arguments (do not pass manually!):
>  [ --name <name> ]: The container name
> -- 
> 2.1.0
> 
> 
> From 4c6142080bc05b0d862e84962398ba8d304855b8 Mon Sep 17 00:00:00 2001
> From: Michael Adam <obnox at samba.org>
> Date: Fri, 16 Jan 2015 00:14:15 +0100
> Subject: [PATCH 2/3] lxc-download: make --list more useful.
> 
> Make it possible to use --list without having to specify
> --dist, --release, and --arch, which does not make a lot
> of sense.
> 
> Signed-off-by: Michael Adam <obnox at samba.org>
> ---
>  templates/lxc-download.in | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/templates/lxc-download.in b/templates/lxc-download.in
> index 6fc5d2e..2d6b1cb 100644
> --- a/templates/lxc-download.in
> +++ b/templates/lxc-download.in
> @@ -266,8 +266,10 @@ fi
>  
>  # Check that we have all variables we need
>  if [ -z "$LXC_NAME" ] || [ -z "$LXC_PATH" ] || [ -z "$LXC_ROOTFS" ]; then
> -    echo "ERROR: Not running through LXC." 1>&2
> -    exit 1
> +    if [ "$DOWNLOAD_LIST_IMAGES" != "true" ]; then
> +        echo "ERROR: Not running through LXC." 1>&2
> +        exit 1
> +    fi
>  fi
>  
>  USERNS=$(in_userns)
> -- 
> 2.1.0
> 
> 
> From 18acf0c5cbaf651869871e382e363902177787f6 Mon Sep 17 00:00:00 2001
> From: Michael Adam <obnox at samba.org>
> Date: Fri, 16 Jan 2015 00:15:50 +0100
> Subject: [PATCH 3/3] lxc-download: improve help text.
> 
> --help and --list are special in the sense that they
> are independent of the other options and exit early.
> Document them separately.
> 
> Signed-off-by: Michael Adam <obnox at samba.org>
> ---
>  templates/lxc-download.in | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/templates/lxc-download.in b/templates/lxc-download.in
> index 2d6b1cb..722f95f 100644
> --- a/templates/lxc-download.in
> +++ b/templates/lxc-download.in
> @@ -188,14 +188,16 @@ usage() {
>      cat <<EOF
>  LXC container image downloader
>  
> +Special arguments:
> +[ -h | --help ]: Print this help message and exit.
> +[ -l | --list ]: List all available images and exit.
> +
>  Required arguments:
>  [ -d | --dist <distribution> ]: The name of the distribution
>  [ -r | --release <release> ]: Release name/version
>  [ -a | --arch <architecture> ]: Architecture of the container
>  
>  Optional arguments:
> -[ -h | --help ]: This help message
> -[ -l | --list ]: List all available images
>  [ --variant <variant> ]: Variant of the image (default: "default")
>  [ --server <server> ]: Image server (default: "images.linuxcontainers.org")
>  [ --keyid <keyid> ]: GPG keyid (default: 0x...)
> -- 
> 2.1.0
> 



> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel


-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20150115/8b00378a/attachment.sig>


More information about the lxc-devel mailing list