[lxc-devel] [PATCH 4/4] lxc-netstat: use posix shell instead of bash

Stéphane Graber stgraber at ubuntu.com
Tue Dec 25 16:36:38 UTC 2012


On 12/25/2012 05:08 PM, Natanael Copa wrote:
> - use case .. in instead of comparison with globs
> - avoid 'local'
> 
> Signed-off-by: Natanael Copa <ncopa at alpinelinux.org>

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

Pushed to staging. Thanks.

> ---
>  src/lxc/lxc-netstat.in | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/src/lxc/lxc-netstat.in b/src/lxc/lxc-netstat.in
> index df18620..87bd3eb 100644
> --- a/src/lxc/lxc-netstat.in
> +++ b/src/lxc/lxc-netstat.in
> @@ -1,4 +1,4 @@
> -#!/bin/bash
> +#!/bin/sh
>  
>  #
>  # lxc: linux Container library
> @@ -32,8 +32,6 @@ help() {
>  
>  get_parent_cgroup()
>  {
> -    local hierarchies hierarchy fields subsystems init_cgroup mountpoint
> -
>      parent_cgroup=""
>  
>      # Obtain a list of hierarchies that contain one or more subsystems
> @@ -58,11 +56,10 @@ get_parent_cgroup()
>  
>          # Return the absolute path to the containers' parent cgroup
>          # (do not append '/lxc' if the hierarchy contains the 'ns' subsystem)
> -        if [[ ",$subsystems," == *,ns,* ]]; then
> -            parent_cgroup="${mountpoint}${init_cgroup%/}"
> -        else
> -            parent_cgroup="${mountpoint}${init_cgroup%/}/lxc"
> -        fi
> +        case ",$subsystems," in
> +            *,ns,*) parent_cgroup="${mountpoint}${init_cgroup%/}";;
> +            *) parent_cgroup="${mountpoint}${init_cgroup%/}/lxc";;
> +        esac
>          break
>      done
>  }
> 


-- 
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: 899 bytes
Desc: OpenPGP digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20121225/c696ec73/attachment.pgp>


More information about the lxc-devel mailing list