#!/bin/sh -

# lxc.devsetup - Setup host /dev for container /dev subdirectories.

if [ ! -d /dev/.lxc ]
then
    echo "Creating /dev/.lxc"
    mkdir /dev/.lxc
    chmod 755 /dev/.lxc
fi

if grep -q "/dev devtmpfs " /proc/self/mounts
then
    echo "/dev is devtmpfs"
else
    echo "/dev is not devtmpfs - mounting tmpfs on .lxc"
    mount -t tmpfs tmpfs /dev/.lxc
fi

if [ ! -d /dev/.lxc/user ]
then
    echo "Creating /dev/.lxc/user"
    mkdir /dev/.lxc/user
    chmod 1777 /dev/.lxc/user
fi
