# devices
#
# populates /dev with devices, does some housekeeping when using udev,
# does nothing at all when using static /dev and might do something in
# the future for other /dev systems ;)

description	"Populates /dev if needed"
author		"Arjan Bouter <abouter@sourcemage.org>"

# started by devices
manual

task

script
	echo "mounting pseudo filesystems and creating links in /dev"
	mount -t tmpfs dev /dev
	ln -s /proc/self/fd /dev/fd
	ln -s /dev/fd/0 /dev/stdin
	ln -s /dev/fd/1 /dev/stdout
	ln -s /dev/fd/2 /dev/stderr
	mkdir -p /dev/shm
	mount -t tmpfs shm /dev/shm
	mkdir -p /dev/pts
	mount -t devpts devpts /dev/pts
	echo "starting udevd"
	udevd --daemon
	echo "triggering udev events"
	udevadm trigger
	udevadm settle --quiet
	echo "creating device nodes"
	[[ -e /dev/mapper/control ]] && dmsetup mknodes
end script
