#!/bin/sh /etc/rc.common

START=01

boot() {
	# Procd mounts non-hierarchical cgroupfs so unmount first before cgroupfs-mount
	umount_cgroup() {
		for sys in $(awk '!/^#/ { if ($4 == 1) print $1 }' /proc/cgroups); do
			if mountpoint -q /sys/fs/cgroup/$sys; then
				umount /sys/fs/cgroup/$sys || true
			fi
		done
		if mountpoint -q /sys/fs/cgroup; then
			umount /sys/fs/cgroup || true
		fi
	}

	umount_cgroup
	cgroupfs-mount v2
}
