# Template file for 'debootstrap'
pkgname=debootstrap
version=1.0.124
revision=1
build_style=fetch
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/${pkgname}/${pkgname}_${version}_all.deb
 ${DEBIAN_SITE}/main/d/debian-archive-keyring/debian-archive-keyring_2019.1_all.deb"
checksum="df202f7e485be563270e803d25072d0c027d9ba3f624d1dd370dcaeaaa493210
 9cefd8917f3d97a999c136aa87f04a3024408b5bc1de470de7d6dfa5e4bd4361"

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;;
	*) broken="please add your architecture";;
esac

do_install() {
	bsdtar xOf ${pkgname}_${version}_all.deb data.tar.gz | bsdtar xvzf - -C ${DESTDIR}
	bsdtar xOf debian-archive-keyring_2019.1_all.deb data.tar.xz | bsdtar xvJf - -C ${DESTDIR} ./usr/share/keyrings/debian-archive-keyring.gpg
	mv ${DESTDIR}/usr/sbin ${DESTDIR}/usr/bin
	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
	echo ${_debarch} >${DESTDIR}/usr/share/debootstrap/arch
}
