# Template file for 'debootstrap'
pkgname=debootstrap
version=1.0.137
revision=1
depends="binutils gnupg gzip tar wget xz zstd"
short_desc="Bootstrap a basic Debian system"
maintainer="Leah Neukirchen <leah@vuxu.org>"
license="MIT"
homepage="http://packages.qa.debian.org/d/debootstrap.html"
distfiles="${DEBIAN_SITE}/main/d/debootstrap/debootstrap_${version}_all.deb
 ${DEBIAN_SITE}/main/d/debian-archive-keyring/debian-archive-keyring_2023.4_all.deb"
checksum="8effd68f105c08eb7bd70791ad517c95d9549a032b4f0b813d52d2a09cdcbad4
 6e93a87b9e50bd81518880ec07a62f95d7d8452f4aa703f5b0a3076439f1022c"

case "$XBPS_TARGET_MACHINE" in
	armv5*l*) _debarch=armel;;
	arm*l*) _debarch=armhf;;
	aarch64*) _debarch=arm64;;
	x86_64*) _debarch=amd64;;
	i686*) _debarch=i386;;
	ppc64le*) _debarch=ppc64el;;
	ppc64*) _debarch=ppc64;;
	ppc*) _debarch=powerpc;;
	riscv64*) _debarch=riscv64;;
	*) broken="please add your architecture";;
esac

post_extract() {
	rm -r usr/share/doc/debian-archive-keyring

	mv usr/sbin usr/bin
	echo ${_debarch} > usr/share/debootstrap/arch
}

do_install() {
	vcopy usr /
	sed -i 's|export PATH|export PATH="/usr/sbin:/sbin:/usr/bin:/bin"|' ${DESTDIR}/usr/bin/debootstrap
	vlicense ${DESTDIR}/usr/share/doc/debootstrap/copyright LICENSE
	rm ${DESTDIR}/usr/share/doc/debootstrap/copyright
}
