diff -u -r ../debootstrap-1.0.108/debootstrap ./debootstrap --- ../debootstrap-1.0.108/debootstrap 2018-08-12 08:58:37.000000000 +0000 +++ ./debootstrap 2018-08-27 19:44:25.479843110 +0000 @@ -3,7 +3,7 @@ VERSION='@VERSION@' -unset TMP TEMP TMPDIR || true +unset LD_PRELOAD TMP TEMP TMPDIR || true # might not be exported if we're running from init=/bin/sh or similar export PATH @@ -14,7 +14,7 @@ if [ -x /debootstrap/debootstrap ]; then DEBOOTSTRAP_DIR=/debootstrap else - DEBOOTSTRAP_DIR=/usr/share/debootstrap + DEBOOTSTRAP_DIR=@TERMUX_PREFIX@/share/debootstrap fi fi @@ -500,14 +500,31 @@ if in_path dpkg && \ dpkg --print-architecture >/dev/null 2>&1; then - HOST_ARCH=$(/usr/bin/dpkg --print-architecture) + HOST_ARCH=$(@TERMUX_PREFIX@/bin/dpkg --print-architecture) elif in_path udpkg && \ udpkg --print-architecture >/dev/null 2>&1; then - HOST_ARCH=$(/usr/bin/udpkg --print-architecture) + HOST_ARCH=$(@TERMUX_PREFIX@/bin/udpkg --print-architecture) elif [ -e "$DEBOOTSTRAP_DIR/arch" ]; then HOST_ARCH=$(cat "$DEBOOTSTRAP_DIR/arch") fi HOST_OS="$HOST_ARCH" + +# Translate Termux arch names to those of Debian: +case $HOST_ARCH in + arm) + HOST_ARCH=armel + ;; + aarch64) + HOST_ARCH=arm64 + ;; + i686) + HOST_ARCH=i386 + ;; + x86_64) + HOST_ARCH=amd64 + ;; +esac + # basic host OS guessing for non-Debian systems if [ -z "$HOST_OS" ]; then case $(uname) in @@ -544,12 +561,8 @@ if [ "$TARGET" = "/" ]; then CHROOT_CMD="" else - CHROOT_CMD="chroot \"$TARGET\"" -fi - -# fakeroot cannot check /proc/1/environ -if [ "$HOST_OS" = Linux ] && ! doing_variant fakechroot && [ "$CONTAINER" = "lxc-libvirt" ]; then - CHROOT_CMD="unshare --net $CHROOT_CMD" + PATH=$PATH:/usr/bin:/bin:/usr/sbin:/sbin + CHROOT_CMD="proot -w /home -b /dev -b /proc --link2symlink -0 -r $TARGET" fi if [ -z "$SHA_SIZE" ]; then @@ -563,16 +576,6 @@ export ARCH SUITE TARGET CHROOT_CMD SHA_SIZE DEBOOTSTRAP_CHECKSUM_FIELD -if am_doing_phase first_stage second_stage; then - if in_path id && [ "$(id -u)" -ne 0 ]; then - error 1 NEEDROOT "debootstrap can only run as root" - fi - # Ensure that we can create working devices and executables on the target. - if ! check_sane_mount "$TARGET"; then - error 1 NOEXEC "Cannot install into target '$TARGET' mounted with noexec or nodev" - fi -fi - if [ ! -e "$SCRIPT" ]; then error 1 NOSCRIPT "No such script: %s" "$SCRIPT" fi