#!/bin/ash -efu
#
# mki-clean
#
# 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."

hasher_args="--clean $verbose $quiet ${HSH_NUMBER:+--number="$HSH_NUMBER"}"

if [ -d "$subchroot" ]; then
	env -i PATH="$PATH" hsh $hasher_args "$subdir" ||
		fatal "$subdir: unable to clean workdir: rc=$?"
fi

if [ -d "$chroot" ]; then
	env -i PATH="$PATH" hsh $hasher_args "$dir" ||
		fatal "$dir: unable to clean workdir: rc=$?"
fi
