#!/bin/sh
_systemd_cgrp="/sys/fs/cgroup/systemd"
if [ ! -d ${_systemd_cgrp} ]; then
	mkdir ${_systemd_cgrp}
fi
if ! mountpoint -q "${_systemd_cgrp}"; then
	mount -t cgroup -o none,name=systemd cgroup ${_systemd_cgrp}
fi
# workaround lxc bug -- next release of lxc should obsolete this
if [ -e /sys/fs/cgroup/cpuset/cgroup.clone_children ]; then
	echo 1 > /sys/fs/cgroup/cpuset/cgroup.clone_children 2>/dev/null || :
fi

[ -r conf ] && . ./conf
exec lxd --group lxd ${OPTS:- --verbose}
