From d07647e5ce982ede6b3c3daa964dc6aa7f8fb21f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Sztoch?= Date: Mon, 20 Apr 2020 08:39:29 +0200 Subject: [PATCH] Better logging for external userpatches path and generate a lot of empty folders only once (#1897) * Better logging for external userpatches path. * Genrate a lot of empty folders only once * Better handling for COMPRESS_OUTPUTIMAGE --- lib/configuration.sh | 2 +- lib/debootstrap.sh | 15 ++++++++++----- lib/general.sh | 12 ++++++------ 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/lib/configuration.sh b/lib/configuration.sh index 114e10fd10..5915d8c091 100644 --- a/lib/configuration.sh +++ b/lib/configuration.sh @@ -269,7 +269,7 @@ fi # For user override if [[ -f $USERPATCHES_PATH/lib.config ]]; then - display_alert "Using user configuration override" "userpatches/lib.config" "info" + display_alert "Using user configuration override" "$USERPATCHES_PATH/lib.config" "info" source "$USERPATCHES_PATH"/lib.config fi diff --git a/lib/debootstrap.sh b/lib/debootstrap.sh index 8a73723dfb..82102ff68b 100644 --- a/lib/debootstrap.sh +++ b/lib/debootstrap.sh @@ -540,7 +540,7 @@ prepare_partitions() # for cryptroot-unlock to work: # https://serverfault.com/questions/907254/cryproot-unlock-with-dropbear-timeout-while-waiting-for-askpass # -# since Debian buster, it has to be called within create_image() on the $MOUNT +# since Debian buster, it has to be called within create_image() on the $MOUNT # path instead of $SDCARD (which can be a tmpfs and breaks cryptsetup-initramfs). # see: https://github.com/armbian/build/issues/1584 # @@ -626,7 +626,9 @@ create_image() mv ${SDCARD}.raw $DESTIMG/${version}.img if [[ $BUILD_ALL != yes ]]; then - if [[ $COMPRESS_OUTPUTIMAGE == yes ]]; then + if [[ $COMPRESS_OUTPUTIMAGE == "" || $COMPRESS_OUTPUTIMAGE == no ]]; then + COMPRESS_OUTPUTIMAGE="sha,gpg,img" + elif [[ $COMPRESS_OUTPUTIMAGE == yes ]]; then COMPRESS_OUTPUTIMAGE="sha,gpg,7z" fi @@ -663,13 +665,16 @@ create_image() f \( -name "${version}.img" -o -name "${version}.img.asc" -o -name "${version}.img.sha" \) -print0 \ | xargs -0 rm >/dev/null 2>&1 cd .. - elif [[ $COMPRESS_OUTPUTIMAGE == *gz* ]]; then + fi + if [[ $COMPRESS_OUTPUTIMAGE == *gz* ]]; then display_alert "Compressing" "$DEST/images/${version}.img.gz" "info" pigz -3 < $DESTIMG/${version}.img > $DEST/images/${version}.img.gz - elif [[ $COMPRESS_OUTPUTIMAGE == *xz* ]]; then + fi + if [[ $COMPRESS_OUTPUTIMAGE == *xz* ]]; then display_alert "Compressing" "$DEST/images/${version}.img.xz" "info" pixz -3 < $DESTIMG/${version}.img > $DEST/images/${version}.img.xz - else + fi + if [[ $COMPRESS_OUTPUTIMAGE == *img* ]]; then [[ -f $DESTIMG/${version}.img.txt ]] && mv $DESTIMG/${version}.img.txt $DEST/images/${version}.img.txt mv $DESTIMG/${version}.img $DEST/images/${version}.img || exit 1 fi diff --git a/lib/general.sh b/lib/general.sh index b1d6fa2f35..f44cb73889 100644 --- a/lib/general.sh +++ b/lib/general.sh @@ -413,10 +413,10 @@ fingerprint_image() -------------------------------------------------------------------------------- Verify GPG signature: gpg --verify $2.img.asc - + Verify image file integrity: sha256sum --check $2.img.sha - + Prepare SD card (four methodes): zcat $2.img.gz | pv | dd of=/dev/mmcblkX bs=1M dd if=$2.img of=/dev/mmcblkX bs=1M @@ -676,7 +676,7 @@ repo-manipulate() { ;; purgesource) for release in "${DISTROS[@]}"; do - aptly repo remove -config=${SCRIPTPATH}config/${REPO_CONFIG} ${release} 'Name (% *-source*)' + aptly repo remove -config=${SCRIPTPATH}config/${REPO_CONFIG} ${release} 'Name (% *-source*)' aptly -config="${SCRIPTPATH}"config/${REPO_CONFIG} -passphrase="${GPG_PASS}" publish update "${release}" > /dev/null 2>&1 done aptly db cleanup -config=${SCRIPTPATH}config/${REPO_CONFIG} > /dev/null 2>&1 @@ -922,9 +922,6 @@ prepare_host() fi mkdir -p $DEST/debs-beta/extra $DEST/debs/extra $DEST/{config,debug,patch} $USERPATCHES_PATH/overlay $SRC/cache/{sources,toolchains,utility,rootfs} $SRC/.tmp - # create patches directory structure under USERPATCHES_PATH - find $SRC/patch -maxdepth 2 -type d ! -name . | sed "s%/.*patch%/$USERPATCHES_PATH%" | xargs mkdir -p - display_alert "Checking for external GCC compilers" "" "info" # download external Linaro compiler and missing special dependencies since they are needed for certain sources @@ -973,6 +970,9 @@ prepare_host() rm -f $USERPATCHES_PATH/readme.txt echo 'Please read documentation about customizing build configuration' > $USERPATCHES_PATH/README echo 'http://www.armbian.com/using-armbian-tools/' >> $USERPATCHES_PATH/README + + # create patches directory structure under USERPATCHES_PATH + find $SRC/patch -maxdepth 2 -type d ! -name . | sed "s%/.*patch%/$USERPATCHES_PATH%" | xargs mkdir -p fi # check free space (basic)