diff --git a/warden/root/linux/setup.sh b/warden/root/linux/setup.sh index 4db71798..4c24856f 100755 --- a/warden/root/linux/setup.sh +++ b/warden/root/linux/setup.sh @@ -18,29 +18,25 @@ then rmdir /dev/cgroup fi -cgroup_path=/tmp/warden/cgroup +cgroup_path="/tmp/warden/cgroup" +mkdir -p "${cgroup_path}" -if [ ! -d $cgroup_path ] +# Mount tmpfs +if ! grep "${cgroup_path} " /proc/mounts | cut -d' ' -f3 | grep -q tmpfs then - mkdir -p $cgroup_path + mount -t tmpfs none "${cgroup_path}" +fi + +# Mount cgroup subsystems individually +for subsystem in cpu cpuacct devices memory +do + mkdir -p "${cgroup_path}/${subsystem}" - # Mount tmpfs - if ! grep "${cgroup_path} " /proc/mounts | cut -d' ' -f3 | grep -q tmpfs + if ! grep -q "${cgroup_path}/${subsystem} " /proc/mounts then - mount -t tmpfs none $cgroup_path + mount -t cgroup -o "${subsystem}" none "${cgroup_path}/${subsystem}" fi - - # Mount cgroup subsystems individually - for subsystem in cpu cpuacct devices memory - do - mkdir -p $cgroup_path/$subsystem - - if ! grep -q "${cgroup_path}/$subsystem " /proc/mounts - then - mount -t cgroup -o $subsystem none $cgroup_path/$subsystem - fi - done -fi +done ./net.sh setup