From: Daniel Baumann Date: Tue, 31 Jul 2012 14:01:24 +0000 (+0200) Subject: fix netstat script with separator X-Git-Tag: lxc-0.8.0~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=21e487f256705638cbfbd584e33021b9b2db504a;p=thirdparty%2Flxc.git fix netstat script with separator Allow to use -- as seperator in lxc-netstat, otherwise -n from lxc-netstat collides with netstats -n option (Closes: #641251). [Serge Hallyn] update patch to (1) not demand argument for exec (breaks) and (2) set $name not $lxc_name. Signed-off-by: Serge Hallyn Signed-off-by: Daniel Lezcano --- diff --git a/src/lxc/lxc-netstat.in b/src/lxc/lxc-netstat.in index 113c0dac3..367568c2e 100644 --- a/src/lxc/lxc-netstat.in +++ b/src/lxc/lxc-netstat.in @@ -18,7 +18,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA usage() { - echo "usage: $(basename $0) --name NAME [--] [NETSTAT_OPTIONS...]" >&2 + echo "usage: $(basename $0) -n|--name -- [netstat_options]" >&2 } help() { @@ -67,13 +67,19 @@ get_parent_cgroup() done } -exec="" +shortoptions='hn:' +longoptions='help,name:,exec' -if [ $# -eq 0 ]; then - usage - exit 1 +getopt=$(getopt -o $shortoptions --longoptions $longoptions -- "$@") +if [ $? != 0 ]; then + usage + exit 1; fi +exec="" + +eval set -- "$getopt" + while true; do case $1 in -h|--help)