#!/usr/bin/env bash
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit

if [[ $# -lt 1 ]] ; then
	__helpers_die "${0##*/}: at least one argument needed"
	exit 1
fi

export __E_INSDESTTREE='/etc/env.d/'
if ___eapi_has_DESTTREE_INSDESTTREE; then
	export INSDESTTREE=${__E_INSDESTTREE}
fi

if ! ___eapi_doenvd_respects_insopts; then
	export INSOPTIONS=-m0644
	export DIROPTIONS=""
fi

exec doins "$@"
