# vim: ft=zsh noet
if [[ $1 == info ]]; then
	FSB_INFO_BASE=%s
	FSB_INFO_DIR=%s
	FSB_INFO_DEPEND=gentoo_python
	: ${STAGE_GENTOO_DEV:=udev}
	case $STAGE_GENTOO_DEV in
		(static-dev) FSB_INFO_BASE=%s-static-dev;;
		(minimal-dev) FSB_INFO_BASE=%s-minimal-dev;;
		(mdev) FSB_INFO_BASE=%s-mdev;;
		(udev) FSB_INFO_SKIP=1;;
		(*) die "/dev manager '$STAGE_GENTOO_DEV' is not supported at the moment"
	esac
	return
elif [[ $1 != build ]]; then
	die "unimplemented action: $*"
fi

case $STAGE_GENTOO_DEV in
	(static-dev)
		fsb_gentoo_profile_add -o ccx-bootstrap packages/static-dev
		fsb_emerge static-dev
		fsb_gentoo_unmerge_udev
		;;
	(minimal-dev)
		fsb_gentoo_profile_add -o ccx-bootstrap packages/minimal-dev
		fsb_emerge minimal-dev
		fsb_gentoo_unmerge_udev
		;;
	(mdev)
		fsb_gentoo_profile_add -o ccx-bootstrap packages/mdev
		fsb_emerge -N busybox
		fsb_gentoo_unmerge_udev
		ln -s /etc/init.d/mdev $build_dir/etc/runlevels/sysinit/mdev
		;;
esac