Commit 2f0e6908 by Natanael Copa Committed by Stéphane Graber

legacy/lxc-ls: use posix shell instead of bash

- use case .. in instead of comparison with globs - avoid 'local' While here, also avoid 'find ... -printf' which is not supported on busybox Signed-off-by: 's avatarNatanael Copa <ncopa@alpinelinux.org> Acked-by: 's avatarStéphane Graber <stgraber@ubuntu.com>
parent 11bdaa74
#!/bin/bash #!/bin/sh
# #
# lxc: linux Container library # lxc: linux Container library
...@@ -35,8 +35,6 @@ help() { ...@@ -35,8 +35,6 @@ help() {
get_parent_cgroup() get_parent_cgroup()
{ {
local hierarchies hierarchy fields subsystems init_cgroup mountpoint
parent_cgroup="" parent_cgroup=""
# Obtain a list of hierarchies that contain one or more subsystems # Obtain a list of hierarchies that contain one or more subsystems
...@@ -61,11 +59,10 @@ get_parent_cgroup() ...@@ -61,11 +59,10 @@ get_parent_cgroup()
# Return the absolute path to the containers' parent cgroup # Return the absolute path to the containers' parent cgroup
# (do not append '/lxc' if the hierarchy contains the 'ns' subsystem) # (do not append '/lxc' if the hierarchy contains the 'ns' subsystem)
if [[ ",$subsystems," == *,ns,* ]]; then case ",$subsystems," in
parent_cgroup="${mountpoint}${init_cgroup%/}" *,ns,*) parent_cgroup="${mountpoint}${init_cgroup%/}";;
else *) parent_cgroup="${mountpoint}${init_cgroup%/}/lxc";;
parent_cgroup="${mountpoint}${init_cgroup%/}/lxc" esac
fi
break break
done done
} }
...@@ -82,12 +79,12 @@ for i in "$@"; do ...@@ -82,12 +79,12 @@ for i in "$@"; do
shift; break;; shift; break;;
*) *)
break;; break;;
esac esac
done done
containers="" containers=""
if [ ! -z "$directory" ]; then if [ ! -z "$directory" ]; then
containers=$(find $directory -mindepth 1 -maxdepth 1 -type d -printf "%f\n" 2>/dev/null) containers=$(find $directory -mindepth 1 -maxdepth 1 -type d 2>/dev/null | sed 's:.*/::')
fi fi
cd "$directory" cd "$directory"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment