Make legacy lxc-ls more robust

Behave well when /etc/lxc/${name} is a symlink to directory

Signed-off-by: Dark Templar <dark_templar@hotbox.ru>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
This commit is contained in:
Dark Templar 2014-10-27 08:33:04 -05:00 committed by Serge Hallyn
parent 145832ba8b
commit bf1e863682

View File

@ -86,7 +86,7 @@ done
containers="" containers=""
if [ ! -z "$directory" ]; then if [ ! -z "$directory" ]; then
if [ x"$parent_cgroup" = x ]; then if [ x"$parent_cgroup" = x ]; then
containers=$(find $directory -mindepth 2 -maxdepth 2 -name config -type f |awk -F "/" '{print $(NF-1)}') containers=$(find -L $directory -mindepth 2 -maxdepth 2 -name config -type f |awk -F "/" '{print $(NF-1)}')
else else
containers=$(find $directory -mindepth 1 -maxdepth 1 -type d 2>/dev/null | sed 's:.*/::') containers=$(find $directory -mindepth 1 -maxdepth 1 -type d 2>/dev/null | sed 's:.*/::')
fi fi