]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
fix netstat script with separator
authorDaniel Baumann <daniel.baumann@progress-technologies.net>
Tue, 31 Jul 2012 14:01:24 +0000 (16:01 +0200)
committerDaniel Lezcano <daniel.lezcano@free.fr>
Tue, 31 Jul 2012 14:01:24 +0000 (16:01 +0200)
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 <serge.hallyn@ubuntu.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
src/lxc/lxc-netstat.in

index 113c0dac3062191f69f92d61507aacc6485c454d..367568c2e4ca67b1a5c4cb5208d79d8218ab9ba6 100644 (file)
@@ -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 <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)