diff --git a/common.sh b/common.sh index 3299c9421d..8e20f8b54f 100644 --- a/common.sh +++ b/common.sh @@ -15,6 +15,7 @@ # compile_kernel # install_external_applications # write_uboot +# customize_image compile_uboot (){ #--------------------------------------------------------------------------------------------------------------------------------- @@ -418,3 +419,14 @@ write_uboot() rm -r /tmp/usr sync } + +customize_image() +{ + cp $SRC/userpatches/customize-image.sh $CACHEDIR/sdcard/tmp/customize-image.sh + chmod +x $CACHEDIR/sdcard/tmp/customize-image.sh + mkdir -p $CACHEDIR/sdcard/tmp/overlay + mount --bind $SRC/userpatches/overlay $CACHEDIR/sdcard/tmp/overlay + display_alert "Calling image customization script" "customize-image.sh" "info" + chroot $CACHEDIR/sdcard /bin/bash -c "/tmp/customize-image.sh $RELEASE $FAMILY $BOARD $BUILD_DESKTOP" + umount $CACHEDIR/sdcard/tmp/overlay +} diff --git a/debootstrap-ng.sh b/debootstrap-ng.sh index f2b57f9d73..7312b34e2c 100644 --- a/debootstrap-ng.sh +++ b/debootstrap-ng.sh @@ -86,10 +86,7 @@ debootstrap_ng() # stage: user customization script # NOTE: installing too many packages may fill tmpfs mount - cp $SRC/userpatches/customize-image.sh $CACHEDIR/sdcard/tmp/customize-image.sh - chmod +x $CACHEDIR/sdcard/tmp/customize-image.sh - display_alert "Calling image customization script" "customize-image.sh" "info" - chroot $CACHEDIR/sdcard /bin/bash -c "/tmp/customize-image.sh $RELEASE $FAMILY $BOARD $BUILD_DESKTOP" + customize_image # stage: cleanup rm -f $CACHEDIR/sdcard/usr/sbin/policy-rc.d @@ -106,6 +103,7 @@ debootstrap_ng() if [[ $ROOTFS_TYPE == fel || $ROOTFS_TYPE == nfs ]]; then # kill /etc/network/interfaces on target to prevent conflicts between kernel # and userspace network config (mainly on Xenial) + rm -f $CACHEDIR/sdcard/etc/network/interfaces printf "auto lo\niface lo inet loopback\n\niface eth0 inet manual" > $CACHEDIR/sdcard/etc/network/interfaces fi diff --git a/debootstrap.sh b/debootstrap.sh index 1890e2f130..4ab597ae4d 100644 --- a/debootstrap.sh +++ b/debootstrap.sh @@ -230,10 +230,7 @@ closing_image (){ #-------------------------------------------------------------------------------------------------------------------------------- # Closing image and clean-up #-------------------------------------------------------------------------------------------------------------------------------- -display_alert "Possible after install." "customize-image.sh" "info" -cp $SRC/userpatches/customize-image.sh $CACHEDIR/sdcard/tmp/customize-image.sh -chmod +x $CACHEDIR/sdcard/tmp/customize-image.sh -chroot $CACHEDIR/sdcard /bin/bash -c "/tmp/customize-image.sh $RELEASE $FAMILY $BOARD $BUILD_DESKTOP" +customize_image chroot $CACHEDIR/sdcard /bin/bash -c "sync" sync sleep 3 diff --git a/general.sh b/general.sh index f4401cb0bc..eb6a2b2717 100644 --- a/general.sh +++ b/general.sh @@ -362,7 +362,7 @@ prepare_host() { test -e /proc/sys/fs/binfmt_misc/qemu-arm || update-binfmts --enable qemu-arm # create directory structure - mkdir -p $SOURCES $DEST/debug $CACHEDIR $CACHEDIR/rootfs $SRC/userpatches/ + mkdir -p $SOURCES $DEST/debug $CACHEDIR/rootfs $SRC/userpatches/overlay find $SRC/lib/patch -type d ! -name . | sed "s%lib/patch%userpatches%" | xargs mkdir -p [[ ! -f $SRC/userpatches/customize-image.sh ]] && cp $SRC/lib/scripts/customize-image.sh.template $SRC/userpatches/customize-image.sh