@@ -112,7 +112,7 @@ do_mount() {
112112do_unmount ()
113113{
114114 if [ " $FS_COOK_PLATFORM " == " termux" ]; then
115- lshout " Skipping unmount for termux"
115+ lshout " Skip unmount for termux"
116116 else
117117 local chroot_dir=$1
118118 points=" $chroot_dir /dev $chroot_dir /sys $chroot_dir /proc"
@@ -221,7 +221,9 @@ see_for_directory() {
221221no_to_directory () {
222222 dir=" $1 "
223223 if [ -d " $dir " ]; then
224- if ! $NO_DIR_CHECK_OVERRIDE ; then
224+ if [ " $NO_DIR_CHECK_OVERRIDE " == " true" ]; then
225+ return 0
226+ else
225227 die " directory exits: $dir "
226228 fi
227229 fi
@@ -261,10 +263,26 @@ do_build() {
261263 export DISABLE_USER_SETUP=false
262264 fi
263265
264- includes_packages
265266 foreign_arch " $arch "
266- no_to_directory " $target_dir "
267267
268+ # Disable cross architecture building in Termux
269+ if [ " $FS_COOK_PLATFORM " == " termux" ]; then
270+ case $worker_arch in
271+ aarch64) termux_arch=" arm64" ;;
272+ arm* ) termux_arch=" armhf" ;;
273+ amd64|x86_64) termux_arch=" amd64" ;;
274+ * ) die " Unknown architecture" ;;
275+ esac
276+ if [ " $termux_arch " != " $arch " ]; then
277+ lshout " Skip building $target_dir for termux"
278+ return 0
279+ else
280+ lshout " Building on Termux"
281+ fi
282+ fi
283+
284+ includes_packages
285+ no_to_directory " $target_dir "
268286
269287 export chroot_dir
270288 chroot_dir=$target_dir
@@ -287,24 +305,6 @@ do_build() {
287305 suite=" jammy"
288306 fi
289307
290- # Disable cross architecture building in Termux
291- if [ " $FS_COOK_PLATFORM " == " termux" ]; then
292- case $worker_arch in
293- aarch64) termux_arch=" arm64" ;;
294- arm* ) termux_arch=" armhf" ;;
295- amd64|x86_64) termux_arch=" amd64" ;;
296- * ) die " Unknown architecture" ;;
297- esac
298- if [ " $termux_arch " != " $arch " ]; then
299- lshout " Skipping cross architecture building for termux"
300- termux_build=false
301- return 0
302- else
303- lshout " Building on Termux"
304- termux_build=true
305- fi
306- fi
307-
308308 shout " debootstraping $suite to $target_dir "
309309
310310 if [[ -n $OVERRIDER_MIRROR ]]; then
@@ -323,6 +323,7 @@ do_build() {
323323 fi
324324
325325 if [ " $FS_COOK_PLATFORM " == " termux" ]; then
326+ dpkg_depends_on debootstrap
326327 _debootstrap=" $( which debootstrap) "
327328 FOREIGN=" "
328329 ENABLE_USER_SETUP=false
@@ -346,7 +347,7 @@ do_build() {
346347 do_second_stage " $target_dir " " $arch "
347348 fi
348349
349- if $ENABLE_USER_SETUP ; then
350+ if [ " $ENABLE_USER_SETUP " == " true " ] ; then
350351 setup_user
351352 fi
352353
@@ -405,6 +406,17 @@ do_qemu_user_emulation() {
405406 fi
406407}
407408
409+ setup_user () {
410+ shout " Setting up user"
411+ cp plugins/setup-user.sh $chroot_dir
412+ sed -i " s/FS_USER/$FS_USER /g" $chroot_dir /setup-user.sh
413+ sed -i " s/FS_PASS/$FS_PASS /g" $chroot_dir /setup-user.sh
414+ install_pkg " openssl"
415+ run_cmd " chmod +x /setup-user.sh"
416+ run_cmd " /bin/bash /setup-user.sh"
417+ run_cmd " rm -rf /setup-user.sh"
418+ }
419+
408420do_chroot_proot_ae () {
409421 local chroot_dir=$1
410422 shift
@@ -434,7 +446,6 @@ do_chroot_proot_ae() {
434446 --cwd=/root -L \
435447 --kernel-release=5.4.0-faked \
436448 --rootfs=" ${root_fs_path} " \
437- -w /root \
438449 /usr/bin/env -i \
439450 HOME=/root \
440451 PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin \
@@ -472,9 +483,11 @@ do_compress() {
472483 export chroot_dir=$1
473484 TARGET_FILE=" $( basename ${chroot_dir} ) "
474485
475- if [ " $termux_build " == " false" ]; then
476- lshout " skip compressing $chroot_dir "
477- return 0
486+ if [ " $FS_COOK_PLATFORM " == " termux" ]; then
487+ if [ ! -d " $chroot_dir " ]; then
488+ lshout " Skip compressing $chroot_dir "
489+ return 0
490+ fi
478491 fi
479492
480493 if [ -n " $OVERRIDER_COMPRESSION_TYPE " ]; then
0 commit comments