-#!/bin/bash
+#!/bin/sh
#
# lxc: linux Container library
get_parent_cgroup()
{
- local hierarchies hierarchy fields subsystems init_cgroup mountpoint
-
parent_cgroup=""
# Obtain a list of hierarchies that contain one or more subsystems
# 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
}
shift; break;;
*)
break;;
- esac
+ esac
done
containers=""
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
cd "$directory"