#!/bin/sh
# Copyright 2026 Jochen Sprickerhof <debvm@jochen.sprickerhof.de>
# SPDX-License-Identifier: MIT
#
# mmdebstrap essential hook to install dependencies for autopkgtest

set -eu

TARGET=$1

if test "${MMDEBSTRAP_VERBOSITY:-1}" -ge 3; then
	set -x
fi

if [ "${MMDEBSTRAP_MODE:-}" = "chrootless" ]; then
	APT_CONFIG=$MMDEBSTRAP_APT_CONFIG apt-get --yes install \
		-oDPkg::Chroot-Directory= \
		-oDPkg::Options::=--force-not-root \
		-oDPkg::Options::=--force-script-chrootless \
		-oDPkg::Options::=--root="$TARGET" \
		-oDPkg::Options::=--log="$TARGET/var/log/dpkg.log" \
		linux-image-generic libpam-systemd passwd python3 mount

else
	APT_CONFIG=$MMDEBSTRAP_APT_CONFIG apt-get --yes install linux-image-generic libpam-systemd passwd python3 mount
fi
