#!/bin/ash -efu
#
# mki-command
#
# This file is part of mkimage
# Copyright (C) 2007-2009  Alexey Gladkov <gladkov.alexey@gmail.com>
#
# This file is covered by the GNU General Public License,
# which should be included with mkimage as the file COPYING.
#

. "${0%/*}"/mki-sh-functions

verbose "has started executing."

case "$PROG" in
	*-run)
		exec env -i PATH="$PATH" \
		hsh-run --rooter $verbose $quiet \
			${HSH_NUMBER:+--number="$HSH_NUMBER"} \
			${HSH_PROC:+--mountpoints=/proc} \
			"$dir" -- "$@"
		;;
	*-exec)
		exec env -i PATH="$PATH" \
		hsh-run --rooter $verbose $quiet \
			${HSH_NUMBER:+--number="$HSH_NUMBER"} \
			${HSH_PROC:+--mountpoints=/proc} \
			"$dir" --execute="$1"
		;;
esac
