#!/bin/sh -efu
# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright (C) 2007-2023  Alexey Gladkov <gladkov.alexey@gmail.com>

# shellcheck source=tools/mki-sh-functions
. "${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
