]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxc-netstat: use posix shell instead of bash
authorNatanael Copa <ncopa@alpinelinux.org>
Tue, 25 Dec 2012 16:08:56 +0000 (17:08 +0100)
committerStéphane Graber <stgraber@ubuntu.com>
Tue, 25 Dec 2012 16:34:38 +0000 (17:34 +0100)
- use case .. in instead of comparison with globs
- avoid 'local'

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/lxc-netstat.in

index df18620a7e5b2003de488e30c73b325f9be125e3..87bd3ebb5460c88cd6b748525fa137cb64617cb9 100644 (file)
@@ -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
 }