@@ -132,7 +132,7 @@ do_unmount()
132132 shout " unmounting: $chroot_dir /sys"
133133 $SUDO umount " $chroot_dir " /sys
134134 fi
135- fi
135+ fi
136136}
137137
138138is_mounted () {
@@ -280,7 +280,7 @@ do_build() {
280280 lshout " Building on Termux"
281281 fi
282282 fi
283-
283+
284284 includes_packages
285285 no_to_directory " $target_dir "
286286
@@ -363,10 +363,10 @@ do_build() {
363363 if [ " $( type -t additional_setup) " == " function" ]; then
364364 additional_setup
365365 fi
366-
366+
367367 shout " patching '/etc/os-release'"
368368 sed -i ' s/Ubuntu/Ubuntu On Android (Udroid)/g' $target_dir /etc/os-release
369-
369+
370370 if ! $NO_COMPRESSION ; then
371371 do_compress " $chroot_dir "
372372 fi
@@ -404,6 +404,10 @@ do_second_stage() {
404404
405405 do_qemu_user_emulation
406406 $SUDO service binfmt-support start
407+
408+ # unset DEBOOTSTRAP_DIR before second stage
409+ # this makes debootstrap to look for scripts inside its build filesystem
410+ unset DEBOOTSTRAP_DIR
407411 do_chroot_ae " $chroot_dir " /bin/bash /debootstrap/debootstrap --second-stage
408412}
409413
@@ -431,7 +435,7 @@ do_chroot_proot_ae() {
431435 shift
432436 local cmd_string=$*
433437 local root_fs_path=${chroot_dir}
434-
438+
435439 unset LD_PRELOAD
436440 proot \
437441 --link2symlink \
@@ -491,12 +495,12 @@ do_compress() {
491495 export TARGET_FILE
492496 export chroot_dir=$1
493497 TARGET_FILE=" $( basename ${chroot_dir} ) "
494-
498+
495499 if [ " $BUILD_PLATFORM " == " termux" ]; then
496500 if [ ! -d " $chroot_dir " ]; then
497501 lshout " Skip compressing $chroot_dir "
498502 return 0
499- fi
503+ fi
500504 fi
501505
502506 if [ -n " $OVERRIDER_COMPRESSION_TYPE " ]; then
0 commit comments