chiark / gitweb /
4451783f7ca246ef50654e27d507056833fe9da9
[termux-packages] / packages / debootstrap / debootstrap.patch
1 diff --git a/debootstrap b/debootstrap
2 index 4658e0f..1672990 100755
3 --- a/debootstrap
4 +++ b/debootstrap
5 @@ -14,7 +14,7 @@ if [ -z "$DEBOOTSTRAP_DIR" ]; then
6         if [ -x /debootstrap/debootstrap ]; then
7                 DEBOOTSTRAP_DIR=/debootstrap
8         else
9 -               DEBOOTSTRAP_DIR=/usr/share/debootstrap
10 +               DEBOOTSTRAP_DIR=$PREFIX/share/debootstrap
11         fi
12  fi
13
14 @@ -421,10 +421,10 @@ fi
15
16  if in_path dpkg && \
17       dpkg --print-architecture >/dev/null 2>&1; then
18 -       HOST_ARCH=`/usr/bin/dpkg --print-architecture`
19 +       HOST_ARCH=`$PREFIX/bin/dpkg --print-architecture`
20  elif in_path udpkg && \
21       udpkg --print-architecture >/dev/null 2>&1; then
22 -       HOST_ARCH=`/usr/bin/udpkg --print-architecture`
23 +       HOST_ARCH=`$PREFIX/bin/udpkg --print-architecture`
24  elif [ -e $DEBOOTSTRAP_DIR/arch ]; then
25         HOST_ARCH=`cat $DEBOOTSTRAP_DIR/arch`
26  fi
27 @@ -465,7 +465,8 @@ fi
28  if [ "$TARGET" = "/" ]; then
29         CHROOT_CMD=""
30  else
31 -       CHROOT_CMD="chroot $TARGET"
32 +       PATH=$PATH:/usr/bin:/bin:/usr/sbin:/sbin
33 +       CHROOT_CMD="proot -w /home -b /dev -b /proc --link2symlink -0 -r $TARGET"
34  fi
35
36  if [ -z "$SHA_SIZE" ]; then
37 @@ -478,16 +479,6 @@ DEBOOTSTRAP_CHECKSUM_FIELD="SHA$SHA_SIZE"
38
39  export ARCH SUITE TARGET CHROOT_CMD SHA_SIZE DEBOOTSTRAP_CHECKSUM_FIELD
40
41 -if am_doing_phase first_stage second_stage; then
42 -       if in_path id && [ `id -u` -ne 0 ]; then
43 -               error 1 NEEDROOT "debootstrap can only run as root"
44 -       fi
45 -       # Ensure that we can create working devices and executables on the target.
46 -       if ! check_sane_mount "$TARGET"; then
47 -               error 1 NOEXEC "Cannot install into target '$TARGET' mounted with noexec or nodev"
48 -       fi
49 -fi
50 -
51  if [ ! -e "$SCRIPT" ]; then
52         error 1 NOSCRIPT "No such script: %s" "$SCRIPT"
53  fi