From 894cb29ca76b663082b070d349c903d0f92ceeaf Mon Sep 17 00:00:00 2001 From: lanefu Date: Tue, 27 Jul 2021 07:24:06 -0400 Subject: [PATCH] Feature/get_log_path/ (#3064) * custom log path of debug/ via LOG_SUBPATH= --- lib/chroot-buildpackages.sh | 12 +++++----- lib/compilation.sh | 48 ++++++++++++++++++------------------- lib/configuration.sh | 10 ++++---- lib/debootstrap.sh | 38 ++++++++++++++--------------- lib/desktop.sh | 14 +++++------ lib/distributions.sh | 32 ++++++++++++------------- lib/general.sh | 30 +++++++++++++---------- lib/image-helpers.sh | 4 ++-- lib/main.sh | 14 +++++++---- lib/makeboarddeb.sh | 2 +- 10 files changed, 106 insertions(+), 98 deletions(-) diff --git a/lib/chroot-buildpackages.sh b/lib/chroot-buildpackages.sh index c38c70a099..752648c76c 100644 --- a/lib/chroot-buildpackages.sh +++ b/lib/chroot-buildpackages.sh @@ -216,7 +216,7 @@ chroot_build_packages() --tmpfs=/tmp:mode=777 \ --bind-ro "${SRC}"/packages/extras-buildpkgs/:/root/overlay \ --bind-ro "${SRC}"/cache/sources/extra/:/root/sources /bin/bash -c "/root/build.sh" 2>&1 \ - ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/buildpkg.log'} + ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/${LOG_SUBPATH}/buildpkg.log'} if [[ ${PIPESTATUS[0]} -eq 2 ]]; then failed+=("$package_name:$release/$arch") @@ -336,13 +336,13 @@ chroot_installpackages_local() local conf="${SRC}"/config/aptly-temp.conf rm -rf /tmp/aptly-temp/ mkdir -p /tmp/aptly-temp/ - aptly -config="${conf}" repo create temp >> "${DEST}"/debug/install.log + aptly -config="${conf}" repo create temp >> "${DEST}"/${LOG_SUBPATH}/install.log # NOTE: this works recursively - aptly -config="${conf}" repo add temp "${DEB_STORAGE}/extra/${RELEASE}-desktop/" >> "${DEST}"/debug/install.log - aptly -config="${conf}" repo add temp "${DEB_STORAGE}/extra/${RELEASE}-utils/" >> "${DEST}"/debug/install.log + aptly -config="${conf}" repo add temp "${DEB_STORAGE}/extra/${RELEASE}-desktop/" >> "${DEST}"/${LOG_SUBPATH}/install.log + aptly -config="${conf}" repo add temp "${DEB_STORAGE}/extra/${RELEASE}-utils/" >> "${DEST}"/${LOG_SUBPATH}/install.log # -gpg-key="925644A6" aptly -keyring="${SRC}/packages/extras-buildpkgs/buildpkg-public.gpg" -secret-keyring="${SRC}/packages/extras-buildpkgs/buildpkg.gpg" -batch=true -config="${conf}" \ - -gpg-key="925644A6" -passphrase="testkey1234" -component=temp -distribution="${RELEASE}" publish repo temp >> "${DEST}"/debug/install.log + -gpg-key="925644A6" -passphrase="testkey1234" -component=temp -distribution="${RELEASE}" publish repo temp >> "${DEST}"/${LOG_SUBPATH}/install.log aptly -config="${conf}" -listen=":8189" serve & local aptly_pid=$! cp "${SRC}"/packages/extras-buildpkgs/buildpkg.key "${SDCARD}"/tmp/buildpkg.key @@ -399,5 +399,5 @@ chroot_installpackages() rm -- "\$0" EOF chmod +x "${SDCARD}"/tmp/install.sh - chroot "${SDCARD}" /bin/bash -c "/tmp/install.sh" >> "${DEST}"/debug/install.log 2>&1 + chroot "${SDCARD}" /bin/bash -c "/tmp/install.sh" >> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1 } ############################################################################# diff --git a/lib/compilation.sh b/lib/compilation.sh index c3c82c2d59..58a5b7dffb 100644 --- a/lib/compilation.sh +++ b/lib/compilation.sh @@ -76,13 +76,13 @@ compile_atf() # create patch for manual source changes [[ $CREATE_PATCHES == yes ]] && userpatch_create "atf" - echo -e "\n\t== atf ==\n" >> "${DEST}"/debug/compilation.log + echo -e "\n\t== atf ==\n" >> "${DEST}"/${LOG_SUBPATH}/compilation.log # ENABLE_BACKTRACE="0" has been added to workaround a regression in ATF. # Check: https://github.com/armbian/build/issues/1157 eval CCACHE_BASEDIR="$(pwd)" env PATH="${toolchain}:${toolchain2}:${PATH}" \ 'make ENABLE_BACKTRACE="0" $target_make $CTHREADS \ - CROSS_COMPILE="$CCACHE $ATF_COMPILER"' 2>> "${DEST}"/debug/compilation.log \ - ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/compilation.log'} \ + CROSS_COMPILE="$CCACHE $ATF_COMPILER"' 2>> "${DEST}"/${LOG_SUBPATH}/compilation.log \ + ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/${LOG_SUBPATH}/compilation.log'} \ ${OUTPUT_DIALOG:+' | dialog --backtitle "$backtitle" --progressbox "Compiling ATF..." $TTY_Y $TTY_X'} \ ${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'} @@ -194,11 +194,11 @@ compile_uboot() rm -rf "${atftempdir}" fi - echo -e "\n\t== u-boot make $BOOTCONFIG ==\n" >> "${DEST}"/debug/compilation.log + echo -e "\n\t== u-boot make $BOOTCONFIG ==\n" >> "${DEST}"/${LOG_SUBPATH}/compilation.log eval CCACHE_BASEDIR="$(pwd)" env PATH="${toolchain}:${toolchain2}:${PATH}" \ 'make $CTHREADS $BOOTCONFIG \ - CROSS_COMPILE="$CCACHE $UBOOT_COMPILER"' 2>> "${DEST}"/debug/compilation.log \ - ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/compilation.log'} \ + CROSS_COMPILE="$CCACHE $UBOOT_COMPILER"' 2>> "${DEST}"/${LOG_SUBPATH}/compilation.log \ + ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/${LOG_SUBPATH}/compilation.log'} \ ${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'} # armbian specifics u-boot settings @@ -230,11 +230,11 @@ compile_uboot() cross_compile="CROSS_COMPILE=$CCACHE $UBOOT_COMPILER"; [[ -n $UBOOT_TOOLCHAIN2 ]] && cross_compile="ARMBIAN=foe"; # empty parameter is not allowed - echo -e "\n\t== u-boot make $target_make ==\n" >> "${DEST}"/debug/compilation.log + echo -e "\n\t== u-boot make $target_make ==\n" >> "${DEST}"/${LOG_SUBPATH}/compilation.log eval CCACHE_BASEDIR="$(pwd)" env PATH="${toolchain}:${toolchain2}:${PATH}" \ 'make $target_make $CTHREADS \ - "${cross_compile}"' 2>>"${DEST}"/debug/compilation.log \ - ${PROGRESS_LOG_TO_FILE:+' | tee -a "${DEST}"/debug/compilation.log'} \ + "${cross_compile}"' 2>>"${DEST}"/${LOG_SUBPATH}/compilation.log \ + ${PROGRESS_LOG_TO_FILE:+' | tee -a "${DEST}"/${LOG_SUBPATH}/compilation.log'} \ ${OUTPUT_DIALOG:+' | dialog --backtitle "$backtitle" --progressbox "Compiling u-boot..." $TTY_Y $TTY_X'} \ ${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'} @@ -315,7 +315,7 @@ compile_uboot() [[ -n $atftempdir && -f $atftempdir/license.md ]] && cp "${atftempdir}/license.md" "$uboottempdir/${uboot_name}/usr/lib/u-boot/LICENSE.atf" display_alert "Building deb" "${uboot_name}.deb" "info" - fakeroot dpkg-deb -b "$uboottempdir/${uboot_name}" "$uboottempdir/${uboot_name}.deb" >> "${DEST}"/debug/output.log 2>&1 + fakeroot dpkg-deb -b "$uboottempdir/${uboot_name}" "$uboottempdir/${uboot_name}.deb" >> "${DEST}"/${LOG_SUBPATH}/output.log 2>&1 rm -rf "$uboottempdir/${uboot_name}" [[ -n $atftempdir ]] && rm -rf "${atftempdir}" @@ -473,14 +473,14 @@ compile_kernel() create_linux-source_package fi - echo -e "\n\t== kernel ==\n" >> "${DEST}"/debug/compilation.log + echo -e "\n\t== kernel ==\n" >> "${DEST}"/${LOG_SUBPATH}/compilation.log eval CCACHE_BASEDIR="$(pwd)" env PATH="${toolchain}:${PATH}" \ 'make $CTHREADS ARCH=$ARCHITECTURE \ CROSS_COMPILE="$CCACHE $KERNEL_COMPILER" \ $SRC_LOADADDR \ LOCALVERSION="-$LINUXFAMILY" \ - $KERNEL_IMAGE_TYPE modules dtbs 2>>$DEST/debug/compilation.log' \ - ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/compilation.log'} \ + $KERNEL_IMAGE_TYPE modules dtbs 2>>$DEST/${LOG_SUBPATH}/compilation.log' \ + ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/${LOG_SUBPATH}/compilation.log'} \ ${OUTPUT_DIALOG:+' | dialog --backtitle "$backtitle" \ --progressbox "Compiling kernel..." $TTY_Y $TTY_X'} \ ${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'} @@ -499,7 +499,7 @@ compile_kernel() display_alert "Creating packages" # produce deb packages: image, headers, firmware, dtb - echo -e "\n\t== deb packages: image, headers, firmware, dtb ==\n" >> "${DEST}"/debug/compilation.log + echo -e "\n\t== deb packages: image, headers, firmware, dtb ==\n" >> "${DEST}"/${LOG_SUBPATH}/compilation.log eval CCACHE_BASEDIR="$(pwd)" env PATH="${toolchain}:${PATH}" \ 'make $CTHREADS $kernel_packing \ KDEB_PKGVERSION=$REVISION \ @@ -509,8 +509,8 @@ compile_kernel() ARCH=$ARCHITECTURE \ DEBFULLNAME="$MAINTAINER" \ DEBEMAIL="$MAINTAINERMAIL" \ - CROSS_COMPILE="$CCACHE $KERNEL_COMPILER" 2>>$DEST/debug/compilation.log' \ - ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/compilation.log'} \ + CROSS_COMPILE="$CCACHE $KERNEL_COMPILER" 2>>$DEST/${LOG_SUBPATH}/compilation.log' \ + ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/${LOG_SUBPATH}/compilation.log'} \ ${OUTPUT_DIALOG:+' | dialog --backtitle "$backtitle" --progressbox "Creating kernel packages..." $TTY_Y $TTY_X'} \ ${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'} @@ -575,7 +575,7 @@ compile_firmware() cd "${firmwaretempdir}" || exit # pack mv "armbian-firmware${FULL}" "armbian-firmware${FULL}_${REVISION}_all" - fakeroot dpkg -b "armbian-firmware${FULL}_${REVISION}_all" >> "${DEST}"/debug/install.log 2>&1 + fakeroot dpkg -b "armbian-firmware${FULL}_${REVISION}_all" >> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1 mv "armbian-firmware${FULL}_${REVISION}_all" "armbian-firmware${FULL}" rsync -rq "armbian-firmware${FULL}_${REVISION}_all.deb" "${DEB_STORAGE}/" @@ -815,12 +815,12 @@ find_toolchain() done echo "$toolchain" # logging a stack of used compilers. - if [[ -f "${DEST}"/debug/compiler.log ]]; then - if ! grep -q "$toolchain" "${DEST}"/debug/compiler.log; then - echo "$toolchain" >> "${DEST}"/debug/compiler.log; + if [[ -f "${DEST}"/${LOG_SUBPATH}/compiler.log ]]; then + if ! grep -q "$toolchain" "${DEST}"/${LOG_SUBPATH}/compiler.log; then + echo "$toolchain" >> "${DEST}"/${LOG_SUBPATH}/compiler.log; fi else - echo "$toolchain" >> "${DEST}"/debug/compiler.log; + echo "$toolchain" >> "${DEST}"/${LOG_SUBPATH}/compiler.log; fi } @@ -915,8 +915,8 @@ process_patch_file() # detect and remove files which patch will create lsdiff -s --strip=1 "${patch}" | grep '^+' | awk '{print $2}' | xargs -I % sh -c 'rm -f %' - echo "Processing file $patch" >> "${DEST}"/debug/patching.log - patch --batch --silent -p1 -N < "${patch}" >> "${DEST}"/debug/patching.log 2>&1 + echo "Processing file $patch" >> "${DEST}"/${LOG_SUBPATH}/patching.log + patch --batch --silent -p1 -N < "${patch}" >> "${DEST}"/${LOG_SUBPATH}/patching.log 2>&1 if [[ $? -ne 0 ]]; then display_alert "* $status $(basename "${patch}")" "failed" "wrn" @@ -924,7 +924,7 @@ process_patch_file() else display_alert "* $status $(basename "${patch}")" "" "info" fi - echo >> "${DEST}"/debug/patching.log + echo >> "${DEST}"/${LOG_SUBPATH}/patching.log } userpatch_create() diff --git a/lib/configuration.sh b/lib/configuration.sh index 0f1001a930..6f62e8e4d9 100644 --- a/lib/configuration.sh +++ b/lib/configuration.sh @@ -168,7 +168,7 @@ desktop_element_available_for_arch() { local arch_limitation_file="${1}/only_for" - echo "Checking if ${desktop_element_path} is available for ${targeted_arch} in ${arch_limitation_file}" >> "${DEST}"/debug/output.log + echo "Checking if ${desktop_element_path} is available for ${targeted_arch} in ${arch_limitation_file}" >> "${DEST}"/${LOG_SUBPATH}/output.log if [[ -f "${arch_limitation_file}" ]]; then grep -- "${targeted_arch}" "${arch_limitation_file}" return $? @@ -321,7 +321,7 @@ fi # Write to variables : # - aggregated_content aggregate_content() { - LOG_OUTPUT_FILE="$SRC/output/debug/potential-paths.log" + LOG_OUTPUT_FILE="$SRC/output/${LOG_SUBPATH}/potential-paths.log" echo -e "Potential paths :" >> "${LOG_OUTPUT_FILE}" show_checklist_variables potential_paths for filepath in ${potential_paths}; do @@ -503,7 +503,7 @@ DEBOOTSTRAP_COMPONENTS="${DEBOOTSTRAP_COMPONENTS// /,}" PACKAGE_LIST="$(one_line aggregate_all_cli "packages" " ")" PACKAGE_LIST_ADDITIONAL="$(one_line aggregate_all_cli "packages.additional" " ")" -LOG_OUTPUT_FILE="$SRC/output/debug/debootstrap-list.log" +LOG_OUTPUT_FILE="$SRC/output/${LOG_SUBPATH}/debootstrap-list.log" show_checklist_variables "DEBOOTSTRAP_LIST DEBOOTSTRAP_COMPONENTS PACKAGE_LIST PACKAGE_LIST_ADDITIONAL PACKAGE_LIST_UNINSTALL" # Dependent desktop packages @@ -610,7 +610,7 @@ if [[ -n $PACKAGE_LIST_RM ]]; then fi -LOG_OUTPUT_FILE="$SRC/output/debug/debootstrap-list.log" +LOG_OUTPUT_FILE="$SRC/output/${LOG_SUBPATH}/debootstrap-list.log" echo -e "\nVariables after manual configuration" >>$LOG_OUTPUT_FILE show_checklist_variables "DEBOOTSTRAP_COMPONENTS DEBOOTSTRAP_LIST PACKAGE_LIST PACKAGE_MAIN_LIST" unset LOG_OUTPUT_FILE @@ -619,7 +619,7 @@ unset LOG_OUTPUT_FILE [[ -z $NAMESERVER ]] && NAMESERVER="1.0.0.1" # default is cloudflare alternate # debug -cat <<-EOF >> "${DEST}"/debug/output.log +cat <<-EOF >> "${DEST}"/${LOG_SUBPATH}/output.log ## BUILD SCRIPT ENVIRONMENT diff --git a/lib/debootstrap.sh b/lib/debootstrap.sh index 96fe1794dd..279943f137 100644 --- a/lib/debootstrap.sh +++ b/lib/debootstrap.sh @@ -73,7 +73,7 @@ debootstrap_ng() chroot $SDCARD /bin/bash -c "apt-get autoremove -y" >/dev/null 2>&1 # create list of installed packages for debug purposes - chroot $SDCARD /bin/bash -c "dpkg --get-selections" | grep -v deinstall | awk '{print $1}' | cut -f1 -d':' > $DEST/debug/installed-packages-${RELEASE}$([[ ${BUILD_MINIMAL} == yes ]] && echo "-minimal")$([[ ${BUILD_DESKTOP} == yes ]] && echo "-desktop").list 2>&1 + chroot $SDCARD /bin/bash -c "dpkg --get-selections" | grep -v deinstall | awk '{print $1}' | cut -f1 -d':' > $DEST/${LOG_SUBPATH}/installed-packages-${RELEASE}$([[ ${BUILD_MINIMAL} == yes ]] && echo "-minimal")$([[ ${BUILD_DESKTOP} == yes ]] && echo "-desktop").list 2>&1 # clean up / prepare for making the image umount_chroot "$SDCARD" @@ -193,7 +193,7 @@ create_rootfs_cache() cd $SDCARD # this will prevent error sh: 0: getcwd() failed eval 'debootstrap --variant=minbase --include=${DEBOOTSTRAP_LIST// /,} ${PACKAGE_LIST_EXCLUDE:+ --exclude=${PACKAGE_LIST_EXCLUDE// /,}} \ --arch=$ARCH --components=${DEBOOTSTRAP_COMPONENTS} $DEBOOTSTRAP_OPTION --foreign $RELEASE $SDCARD/ $apt_mirror' \ - ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/debootstrap.log'} \ + ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/${LOG_SUBPATH}/debootstrap.log'} \ ${OUTPUT_DIALOG:+' | dialog --backtitle "$backtitle" --progressbox "Debootstrap (stage 1/2)..." $TTY_Y $TTY_X'} \ ${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'} @@ -206,7 +206,7 @@ create_rootfs_cache() display_alert "Installing base system" "Stage 2/2" "info" eval 'chroot $SDCARD /bin/bash -c "/debootstrap/debootstrap --second-stage"' \ - ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/debootstrap.log'} \ + ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/${LOG_SUBPATH}/debootstrap.log'} \ ${OUTPUT_DIALOG:+' | dialog --backtitle "$backtitle" --progressbox "Debootstrap (stage 2/2)..." $TTY_Y $TTY_X'} \ ${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'} @@ -250,7 +250,7 @@ create_rootfs_cache() # stage: update packages list display_alert "Updating package list" "$RELEASE" "info" eval 'LC_ALL=C LANG=C chroot $SDCARD /bin/bash -c "apt-get -q -y $apt_extra update"' \ - ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/debootstrap.log'} \ + ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/${LOG_SUBPATH}/debootstrap.log'} \ ${OUTPUT_DIALOG:+' | dialog --backtitle "$backtitle" --progressbox "Updating package lists..." $TTY_Y $TTY_X'} \ ${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'} @@ -260,7 +260,7 @@ create_rootfs_cache() display_alert "Upgrading base packages" "Armbian" "info" eval 'LC_ALL=C LANG=C chroot $SDCARD /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -y -q \ $apt_extra $apt_extra_progress upgrade"' \ - ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/debootstrap.log'} \ + ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/${LOG_SUBPATH}/debootstrap.log'} \ ${OUTPUT_DIALOG:+' | dialog --backtitle "$backtitle" --progressbox "Upgrading base packages..." $TTY_Y $TTY_X'} \ ${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'} @@ -276,7 +276,7 @@ create_rootfs_cache() display_alert "Installing the main packages for" "Armbian" "info" eval 'LC_ALL=C LANG=C chroot $SDCARD /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -y -q \ $apt_extra $apt_extra_progress --no-install-recommends install $PACKAGE_MAIN_LIST"' \ - ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/debootstrap.log'} \ + ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/${LOG_SUBPATH}/debootstrap.log'} \ ${OUTPUT_DIALOG:+' | dialog --backtitle "$backtitle" --progressbox "Installing Armbian main packages..." $TTY_Y $TTY_X'} \ ${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'} @@ -304,7 +304,7 @@ create_rootfs_cache() display_alert "Installing the desktop packages for" "Armbian" "info" eval 'LC_ALL=C LANG=C chroot $SDCARD /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -y -q \ $apt_extra $apt_extra_progress install ${apt_desktop_install_flags} $PACKAGE_LIST_DESKTOP"' \ - ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/debootstrap.log'} \ + ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/${LOG_SUBPATH}/debootstrap.log'} \ ${OUTPUT_DIALOG:+' | dialog --backtitle "$backtitle" --progressbox "Installing Armbian desktop packages..." $TTY_Y $TTY_X'} \ ${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'} @@ -316,7 +316,7 @@ create_rootfs_cache() display_alert "Uninstall packages" "$PACKAGE_LIST_UNINSTALL" "info" eval 'LC_ALL=C LANG=C chroot $SDCARD /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -y -qq \ $apt_extra $apt_extra_progress purge $PACKAGE_LIST_UNINSTALL"' \ - ${PROGRESS_LOG_TO_FILE:+' >> $DEST/debug/debootstrap.log'} \ + ${PROGRESS_LOG_TO_FILE:+' >> $DEST/${LOG_SUBPATH}/debootstrap.log'} \ ${OUTPUT_DIALOG:+' | dialog --backtitle "$backtitle" --progressbox "Removing packages.uninstall packages..." $TTY_Y $TTY_X'} \ ${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'} @@ -327,7 +327,7 @@ create_rootfs_cache() PURGINGPACKAGES=$(chroot $SDCARD /bin/bash -c "dpkg -l | grep \"^rc\" | awk '{print \$2}' | tr \"\n\" \" \"") eval 'LC_ALL=C LANG=C chroot $SDCARD /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -y -q \ $apt_extra $apt_extra_progress remove --purge $PURGINGPACKAGES"' \ - ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/debootstrap.log'} \ + ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/${LOG_SUBPATH}/debootstrap.log'} \ ${OUTPUT_DIALOG:+' | dialog --backtitle "$backtitle" --progressbox "Purging residual Armbian packages..." $TTY_Y $TTY_X'} \ ${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'} @@ -338,7 +338,7 @@ create_rootfs_cache() # DEBUG: print free space local freespace=$(LC_ALL=C df -h) - echo $freespace >> $DEST/debug/debootstrap.log + echo $freespace >> $DEST/${LOG_SUBPATH}/debootstrap.log display_alert "Free SD cache" "$(echo -e "$freespace" | grep $SDCARD | awk '{print $5}')" "info" display_alert "Mount point" "$(echo -e "$freespace" | grep $MOUNT | head -1 | awk '{print $5}')" "info" @@ -578,7 +578,7 @@ prepare_partitions() check_loop_device "$rootdevice" display_alert "Creating rootfs" "$ROOTFS_TYPE on $rootdevice" - mkfs.${mkfs[$ROOTFS_TYPE]} ${mkopts[$ROOTFS_TYPE]} $rootdevice >> "${DEST}"/debug/install.log 2>&1 + mkfs.${mkfs[$ROOTFS_TYPE]} ${mkopts[$ROOTFS_TYPE]} $rootdevice >> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1 [[ $ROOTFS_TYPE == ext4 ]] && tune2fs -o journal_data_writeback $rootdevice > /dev/null if [[ $ROOTFS_TYPE == btrfs && $BTRFS_COMPRESSION != none ]]; then local fscreateopt="-o compress-force=${BTRFS_COMPRESSION}" @@ -597,7 +597,7 @@ prepare_partitions() if [[ -n $bootpart ]]; then display_alert "Creating /boot" "$bootfs on ${LOOP}p${bootpart}" check_loop_device "${LOOP}p${bootpart}" - mkfs.${mkfs[$bootfs]} ${mkopts[$bootfs]} ${LOOP}p${bootpart} >> "${DEST}"/debug/install.log 2>&1 + mkfs.${mkfs[$bootfs]} ${mkopts[$bootfs]} ${LOOP}p${bootpart} >> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1 mkdir -p $MOUNT/boot/ mount ${LOOP}p${bootpart} $MOUNT/boot/ echo "UUID=$(blkid -s UUID -o value ${LOOP}p${bootpart}) /boot ${mkfs[$bootfs]} defaults${mountopts[$bootfs]} 0 2" >> $SDCARD/etc/fstab @@ -684,11 +684,11 @@ update_initramfs() cp /usr/bin/$QEMU_BINARY $chroot_target/usr/bin/ mount_chroot "$chroot_target/" - chroot $chroot_target /bin/bash -c "$update_initramfs_cmd" >> $DEST/debug/install.log 2>&1 - display_alert "Updated initramfs." "for details see: $DEST/debug/install.log" "info" + chroot $chroot_target /bin/bash -c "$update_initramfs_cmd" >> $DEST/${LOG_SUBPATH}/install.log 2>&1 + display_alert "Updated initramfs." "for details see: $DEST/${LOG_SUBPATH}/install.log" "info" display_alert "Re-enabling" "initramfs-tools hook for kernel" - chroot $chroot_target /bin/bash -c "chmod -v +x /etc/kernel/postinst.d/initramfs-tools" >> "${DEST}"/debug/install.log 2>&1 + chroot $chroot_target /bin/bash -c "chmod -v +x /etc/kernel/postinst.d/initramfs-tools" >> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1 umount_chroot "$chroot_target/" rm $chroot_target/usr/bin/$QEMU_BINARY @@ -710,7 +710,7 @@ create_image() if [[ $ROOTFS_TYPE != nfs ]]; then display_alert "Copying files to" "/" rsync -aHWXh --exclude="/boot/*" --exclude="/dev/*" --exclude="/proc/*" --exclude="/run/*" --exclude="/tmp/*" \ - --exclude="/sys/*" --info=progress2,stats1 $SDCARD/ $MOUNT/ >> "${DEST}"/debug/install.log 2>&1 + --exclude="/sys/*" --info=progress2,stats1 $SDCARD/ $MOUNT/ >> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1 else display_alert "Creating rootfs archive" "rootfs.tgz" "info" tar cp --xattrs --directory=$SDCARD/ --exclude='./boot/*' --exclude='./dev/*' --exclude='./proc/*' --exclude='./run/*' --exclude='./tmp/*' \ @@ -721,10 +721,10 @@ create_image() display_alert "Copying files to" "/boot" if [[ $(findmnt --target $MOUNT/boot -o FSTYPE -n) == vfat ]]; then # fat32 - rsync -rLtWh --info=progress2,stats1 $SDCARD/boot $MOUNT >> "${DEST}"/debug/install.log 2>&1 + rsync -rLtWh --info=progress2,stats1 $SDCARD/boot $MOUNT >> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1 else # ext4 - rsync -aHWXh --info=progress2,stats1 $SDCARD/boot $MOUNT >> "${DEST}"/debug/install.log 2>&1 + rsync -aHWXh --info=progress2,stats1 $SDCARD/boot $MOUNT >> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1 fi # stage: create final initramfs @@ -732,7 +732,7 @@ create_image() # DEBUG: print free space local freespace=$(LC_ALL=C df -h) - echo $freespace >> $DEST/debug/debootstrap.log + echo $freespace >> $DEST/${LOG_SUBPATH}/debootstrap.log display_alert "Free SD cache" "$(echo -e "$freespace" | grep $SDCARD | awk '{print $5}')" "info" display_alert "Mount point" "$(echo -e "$freespace" | grep $MOUNT | head -1 | awk '{print $5}')" "info" diff --git a/lib/desktop.sh b/lib/desktop.sh index 0e328c19ad..9d93b14832 100644 --- a/lib/desktop.sh +++ b/lib/desktop.sh @@ -23,9 +23,9 @@ create_desktop_package () { - echo "Showing PACKAGE_LIST_DESKTOP before postprocessing" >> "${DEST}"/debug/output.log + echo "Showing PACKAGE_LIST_DESKTOP before postprocessing" >> "${DEST}"/${LOG_SUBPATH}/output.log # Use quotes to show leading and trailing spaces - echo "\"$PACKAGE_LIST_DESKTOP\"" >> "${DEST}"/debug/output.log + echo "\"$PACKAGE_LIST_DESKTOP\"" >> "${DEST}"/${LOG_SUBPATH}/output.log # Remove leading and trailing spaces with some bash monstruosity # https://stackoverflow.com/questions/369758/how-to-trim-whitespace-from-a-bash-variable#12973694 @@ -36,7 +36,7 @@ create_desktop_package () # Remove others 'spacing characters' (like tabs) DEBIAN_RECOMMENDS=${DEBIAN_RECOMMENDS//[[:space:]]/} - echo "DEBIAN_RECOMMENDS : ${DEBIAN_RECOMMENDS}" >> "${DEST}"/debug/output.log + echo "DEBIAN_RECOMMENDS : ${DEBIAN_RECOMMENDS}" >> "${DEST}"/${LOG_SUBPATH}/output.log # Replace whitespace characters by commas PACKAGE_LIST_PREDEPENDS=${PACKAGE_LIST_PREDEPENDS// /,}; @@ -49,7 +49,7 @@ create_desktop_package () rm -rf "${destination}" mkdir -p "${destination}"/DEBIAN - echo "${PACKAGE_LIST_PREDEPENDS}" >> "${DEST}"/debug/output.log + echo "${PACKAGE_LIST_PREDEPENDS}" >> "${DEST}"/${LOG_SUBPATH}/output.log # set up control file cat <<-EOF > "${destination}"/DEBIAN/control @@ -78,7 +78,7 @@ create_desktop_package () chmod 755 "${destination}"/DEBIAN/postinst #display_alert "Showing ${destination}/DEBIAN/postinst" - cat "${destination}/DEBIAN/postinst" >> "${DEST}"/debug/install.log + cat "${destination}/DEBIAN/postinst" >> "${DEST}"/${LOG_SUBPATH}/install.log # Armbian create_desktop_package scripts @@ -244,8 +244,8 @@ add_desktop_package_sources() { # so... let's prepare for that add_apt_sources run_on_sdcard "apt -y -q update" - ls -l "${SDCARD}/etc/apt/sources.list.d" >> "${DEST}"/debug/install.log - cat "${SDCARD}/etc/apt/sources.list" >> "${DEST}"/debug/install.log + ls -l "${SDCARD}/etc/apt/sources.list.d" >> "${DEST}"/${LOG_SUBPATH}/install.log + cat "${SDCARD}/etc/apt/sources.list" >> "${DEST}"/${LOG_SUBPATH}/install.log } diff --git a/lib/distributions.sh b/lib/distributions.sh index 03319b7677..371f146647 100644 --- a/lib/distributions.sh +++ b/lib/distributions.sh @@ -27,11 +27,11 @@ install_common() if [[ $CRYPTROOT_ENABLE == yes ]]; then display_alert "Installing rootfs encryption related packages" "cryptsetup" "info" chroot "${SDCARD}" /bin/bash -c "apt-get -y -qq --no-install-recommends install cryptsetup" \ - >> "${DEST}"/debug/install.log 2>&1 + >> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1 if [[ $CRYPTROOT_SSH_UNLOCK == yes ]]; then display_alert "Installing rootfs encryption related packages" "dropbear-initramfs" "info" chroot "${SDCARD}" /bin/bash -c "apt-get -y -qq --no-install-recommends install dropbear-initramfs cryptsetup-initramfs" \ - >> "${DEST}"/debug/install.log 2>&1 + >> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1 fi fi @@ -58,7 +58,7 @@ install_common() # this key should be changed by the user on first login display_alert "Generating a new SSH key pair for dropbear (initramfs)" "" "" ssh-keygen -t ecdsa -f "${SDCARD}"/etc/dropbear-initramfs/id_ecdsa \ - -N '' -O force-command=cryptroot-unlock -C 'AUTOGENERATED_BY_ARMBIAN_BUILD' >> "${DEST}"/debug/install.log 2>&1 + -N '' -O force-command=cryptroot-unlock -C 'AUTOGENERATED_BY_ARMBIAN_BUILD' >> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1 # /usr/share/initramfs-tools/hooks/dropbear will automatically add 'id_ecdsa.pub' to authorized_keys file # during mkinitramfs of update-initramfs @@ -241,29 +241,29 @@ install_common() cd $SRC display_alert "Updating" "package lists" - chroot "${SDCARD}" /bin/bash -c "apt-get update" >> "${DEST}"/debug/install.log 2>&1 + chroot "${SDCARD}" /bin/bash -c "apt-get update" >> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1 display_alert "Temporarily disabling" "initramfs-tools hook for kernel" - chroot "${SDCARD}" /bin/bash -c "chmod -v -x /etc/kernel/postinst.d/initramfs-tools" >> "${DEST}"/debug/install.log 2>&1 + chroot "${SDCARD}" /bin/bash -c "chmod -v -x /etc/kernel/postinst.d/initramfs-tools" >> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1 # install family packages if [[ -n ${PACKAGE_LIST_FAMILY} ]]; then - chroot "${SDCARD}" /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -yqq --no-install-recommends install $PACKAGE_LIST_FAMILY" >> "${DEST}"/debug/install.log + chroot "${SDCARD}" /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -yqq --no-install-recommends install $PACKAGE_LIST_FAMILY" >> "${DEST}"/${LOG_SUBPATH}/install.log fi # install board packages if [[ -n ${PACKAGE_LIST_BOARD} ]]; then - chroot "${SDCARD}" /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -yqq --no-install-recommends install $PACKAGE_LIST_BOARD" >> "${DEST}"/debug/install.log + chroot "${SDCARD}" /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -yqq --no-install-recommends install $PACKAGE_LIST_BOARD" >> "${DEST}"/${LOG_SUBPATH}/install.log fi # remove family packages if [[ -n ${PACKAGE_LIST_FAMILY_REMOVE} ]]; then - chroot "${SDCARD}" /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -yqq remove --auto-remove $PACKAGE_LIST_FAMILY_REMOVE" >> "${DEST}"/debug/install.log + chroot "${SDCARD}" /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -yqq remove --auto-remove $PACKAGE_LIST_FAMILY_REMOVE" >> "${DEST}"/${LOG_SUBPATH}/install.log fi # remove board packages if [[ -n ${PACKAGE_LIST_BOARD_REMOVE} ]]; then - chroot "${SDCARD}" /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -yqq remove --auto-remove $PACKAGE_LIST_BOARD_REMOVE" >> "${DEST}"/debug/install.log + chroot "${SDCARD}" /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -yqq remove --auto-remove $PACKAGE_LIST_BOARD_REMOVE" >> "${DEST}"/${LOG_SUBPATH}/install.log fi # install u-boot @@ -297,7 +297,7 @@ install_common() # install board support packages if [[ "${REPOSITORY_INSTALL}" != *bsp* ]]; then - install_deb_chroot "${DEB_STORAGE}/$RELEASE/${BSP_CLI_PACKAGE_FULLNAME}.deb" | tee "${DEST}"/debug/install.log 2>&1 + install_deb_chroot "${DEB_STORAGE}/$RELEASE/${BSP_CLI_PACKAGE_FULLNAME}.deb" | tee "${DEST}"/${LOG_SUBPATH}/install.log 2>&1 else install_deb_chroot "${CHOSEN_ROOTFS}" "remote" fi @@ -367,7 +367,7 @@ install_common() if [[ $BSPFREEZE == yes ]]; then display_alert "Freezing Armbian packages" "$BOARD" "info" chroot "${SDCARD}" /bin/bash -c "apt-mark hold ${CHOSEN_KERNEL} ${CHOSEN_KERNEL/image/headers} \ - linux-u-boot-${BOARD}-${BRANCH} ${CHOSEN_KERNEL/image/dtb}" >> "${DEST}"/debug/install.log 2>&1 + linux-u-boot-${BOARD}-${BRANCH} ${CHOSEN_KERNEL/image/dtb}" >> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1 fi # remove deb files @@ -440,9 +440,9 @@ install_common() "${SDCARD}/lib/systemd/system/serial-getty@${array[0]}.service" fi display_alert "Enabling serial console" "${array[0]}" "info" - chroot "${SDCARD}" /bin/bash -c "systemctl daemon-reload" >> "${DEST}"/debug/install.log 2>&1 + chroot "${SDCARD}" /bin/bash -c "systemctl daemon-reload" >> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1 chroot "${SDCARD}" /bin/bash -c "systemctl --no-reload enable serial-getty@${array[0]}.service" \ - >> "${DEST}"/debug/install.log 2>&1 + >> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1 if [[ "${array[0]}" == "ttyGS0" && $LINUXFAMILY == sun8i && $BRANCH == default ]]; then mkdir -p "${SDCARD}"/etc/systemd/system/serial-getty@ttyGS0.service.d cat <<-EOF > "${SDCARD}"/etc/systemd/system/serial-getty@ttyGS0.service.d/10-switch-role.conf @@ -485,7 +485,7 @@ install_common() rm -f "${SDCARD}"/usr/lib/NetworkManager/conf.d/10-globally-managed-devices.conf # most likely we don't need to wait for nm to get online - chroot "${SDCARD}" /bin/bash -c "systemctl disable NetworkManager-wait-online.service" >> "${DEST}"/debug/install.log 2>&1 + chroot "${SDCARD}" /bin/bash -c "systemctl disable NetworkManager-wait-online.service" >> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1 # Just regular DNS and maintain /etc/resolv.conf as a file sed "/dns/d" -i "${SDCARD}"/etc/NetworkManager/NetworkManager.conf @@ -504,10 +504,10 @@ install_common() ln -s /run/systemd/resolve/resolv.conf "${SDCARD}"/etc/resolv.conf # enable services - chroot "${SDCARD}" /bin/bash -c "systemctl enable systemd-networkd.service systemd-resolved.service" >> "${DEST}"/debug/install.log 2>&1 + chroot "${SDCARD}" /bin/bash -c "systemctl enable systemd-networkd.service systemd-resolved.service" >> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1 if [ -e /etc/systemd/timesyncd.conf ]; then - chroot "${SDCARD}" /bin/bash -c "systemctl enable systemd-timesyncd.service" >> "${DEST}"/debug/install.log 2>&1 + chroot "${SDCARD}" /bin/bash -c "systemctl enable systemd-timesyncd.service" >> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1 fi umask 022 cat > "${SDCARD}"/etc/systemd/network/eth0.network <<- __EOF__ diff --git a/lib/general.sh b/lib/general.sh index 08e25ecd53..076a6154c1 100644 --- a/lib/general.sh +++ b/lib/general.sh @@ -27,6 +27,7 @@ # webseed # download_and_verify + # cleaning # # target: what to clean @@ -39,6 +40,7 @@ # "images" - delete output/images # "sources" - delete output/sources # + cleaning() { case $1 in @@ -412,7 +414,7 @@ fetch_from_repo() display_alert() { # log function parameters to install.log - [[ -n "${DEST}" ]] && echo "Displaying message: $@" >> "${DEST}"/debug/output.log + [[ -n "${DEST}" ]] && echo "Displaying message: $@" >> "${DEST}"/${LOG_SUBPATH}/output.log local tmp="" [[ -n $2 ]] && tmp="[\e[0;33m $2 \x1B[0m]" @@ -1153,7 +1155,7 @@ prepare_host() display_alert "Installing build dependencies" apt-get -q update apt-get -y upgrade - apt-get -q -y --no-install-recommends install -o Dpkg::Options::='--force-confold' "${deps[@]}" | tee -a "${DEST}"/debug/hostdeps.log + apt-get -q -y --no-install-recommends install -o Dpkg::Options::='--force-confold' "${deps[@]}" | tee -a "${DEST}"/${LOG_SUBPATH}/hostdeps.log update-ccache-symlinks fi @@ -1360,7 +1362,7 @@ download_and_verify() aria2c ${ariatorrent} else # shellcheck disable=SC2035 - aria2c ${ariatorrent} &> "${DEST}"/debug/torrent.log + aria2c ${ariatorrent} &> "${DEST}"/${LOG_SUBPATH}/torrent.log fi # mark complete [[ $? -eq 0 ]] && touch "${localdir}/${filename}.complete" @@ -1394,29 +1396,29 @@ download_and_verify() # Verify archives with Linaro and Armbian GPG keys if [ x"" != x"${http_proxy}" ]; then - (gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning --list-keys 8F427EAF >> "${DEST}"/debug/output.log 2>&1\ + (gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning --list-keys 8F427EAF >> "${DEST}"/${LOG_SUBPATH}/output.log 2>&1\ || gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning \ --keyserver hkp://keyserver.ubuntu.com:80 --keyserver-options http-proxy="${http_proxy}" \ - --recv-keys 8F427EAF >> "${DEST}"/debug/output.log 2>&1) + --recv-keys 8F427EAF >> "${DEST}"/${LOG_SUBPATH}/output.log 2>&1) - (gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning --list-keys 9F0E78D5 >> "${DEST}"/debug/output.log 2>&1\ + (gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning --list-keys 9F0E78D5 >> "${DEST}"/${LOG_SUBPATH}/output.log 2>&1\ || gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning \ --keyserver hkp://keyserver.ubuntu.com:80 --keyserver-options http-proxy="${http_proxy}" \ - --recv-keys 9F0E78D5 >> "${DEST}"/debug/output.log 2>&1) + --recv-keys 9F0E78D5 >> "${DEST}"/${LOG_SUBPATH}/output.log 2>&1) else - (gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning --list-keys 8F427EAF >> "${DEST}"/debug/output.log 2>&1\ + (gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning --list-keys 8F427EAF >> "${DEST}"/${LOG_SUBPATH}/output.log 2>&1\ || gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning \ --keyserver hkp://keyserver.ubuntu.com:80 \ - --recv-keys 8F427EAF >> "${DEST}"/debug/output.log 2>&1) + --recv-keys 8F427EAF >> "${DEST}"/${LOG_SUBPATH}/output.log 2>&1) - (gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning --list-keys 9F0E78D5 >> "${DEST}"/debug/output.log 2>&1\ + (gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning --list-keys 9F0E78D5 >> "${DEST}"/${LOG_SUBPATH}/output.log 2>&1\ || gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning \ --keyserver hkp://keyserver.ubuntu.com:80 \ - --recv-keys 9F0E78D5 >> "${DEST}"/debug/output.log 2>&1) + --recv-keys 9F0E78D5 >> "${DEST}"/${LOG_SUBPATH}/output.log 2>&1) fi gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning --verify \ - --trust-model always -q "${localdir}/${filename}.asc" >> "${DEST}"/debug/output.log 2>&1 + --trust-model always -q "${localdir}/${filename}.asc" >> "${DEST}"/${LOG_SUBPATH}/output.log 2>&1 [[ ${PIPESTATUS[0]} -eq 0 ]] && verified=true && display_alert "Verified" "PGP" "info" else @@ -1477,7 +1479,7 @@ show_checklist_variables () { local checklist=$* local var pval - local log_file=${LOG_OUTPUT_FILE:-"${SRC}"/output/debug/trash.log} + local log_file=${LOG_OUTPUT_FILE:-"${SRC}"/output/${LOG_SUBPATH}/trash.log} local _line=${BASH_LINENO[0]} local _function=${FUNCNAME[1]} local _file=$(basename "${BASH_SOURCE[1]}") @@ -1494,3 +1496,5 @@ show_checklist_variables () fi done } + + diff --git a/lib/image-helpers.sh b/lib/image-helpers.sh index a596596abd..f722e8fdf1 100644 --- a/lib/image-helpers.sh +++ b/lib/image-helpers.sh @@ -198,7 +198,7 @@ install_deb_chroot() [[ $NO_APT_CACHER != yes ]] && local apt_extra="-o Acquire::http::Proxy=\"http://${APT_PROXY_ADDR:-localhost:3142}\" -o Acquire::http::Proxy::localhost=\"DIRECT\"" # when building in bulk from remote, lets make sure we have up2date index [[ $BUILD_ALL == yes && ${variant} == remote ]] && chroot "${SDCARD}" /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get $apt_extra -yqq update" - chroot "${SDCARD}" /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -yqq $apt_extra --no-install-recommends install $name" >> "${DEST}"/debug/install.log 2>&1 + chroot "${SDCARD}" /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -yqq $apt_extra --no-install-recommends install $name" >> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1 [[ $? -ne 0 ]] && exit_with_error "Installation of $name failed" "${BOARD} ${RELEASE} ${BUILD_DESKTOP} ${LINUXFAMILY}" [[ ${variant} == remote && ${transfer} == yes ]] && rsync -rq "${SDCARD}"/var/cache/apt/archives/*.deb ${DEB_STORAGE}/ @@ -209,6 +209,6 @@ run_on_sdcard() { # Lack of quotes allows for redirections and pipes easily. - chroot "${SDCARD}" /bin/bash -c "${@}" >> "${DEST}"/debug/install.log + chroot "${SDCARD}" /bin/bash -c "${@}" >> "${DEST}"/${LOG_SUBPATH}/install.log } diff --git a/lib/main.sh b/lib/main.sh index fa70926df7..e5752fbd4a 100644 --- a/lib/main.sh +++ b/lib/main.sh @@ -81,14 +81,18 @@ source "${SRC}"/lib/general.sh # general functions # shellcheck source=chroot-buildpackages.sh source "${SRC}"/lib/chroot-buildpackages.sh # chroot packages building + +# set log path +LOG_SUBPATH=${LOG_SUBPATH:=debug} + # compress and remove old logs -mkdir -p "${DEST}"/debug -(cd "${DEST}"/debug && tar -czf logs-"$( /dev/null 2>&1 -rm -f "${DEST}"/debug/*.log > /dev/null 2>&1 -date +"%d_%m_%Y-%H_%M_%S" > "${DEST}"/debug/timestamp +mkdir -p "${DEST}"/${LOG_SUBPATH} +(cd "${DEST}"/${LOG_SUBPATH} && tar -czf logs-"$( /dev/null 2>&1 +rm -f "${DEST}"/${LOG_SUBPATH}/*.log > /dev/null 2>&1 +date +"%d_%m_%Y-%H_%M_%S" > "${DEST}"/${LOG_SUBPATH}/timestamp # delete compressed logs older than 7 days -(cd "${DEST}"/debug && find . -name '*.tgz' -mtime +7 -delete) > /dev/null +(cd "${DEST}"/${LOG_SUBPATH} && find . -name '*.tgz' -mtime +7 -delete) > /dev/null if [[ $PROGRESS_DISPLAY == none ]]; then diff --git a/lib/makeboarddeb.sh b/lib/makeboarddeb.sh index 0d7841343b..c0ae9ee110 100644 --- a/lib/makeboarddeb.sh +++ b/lib/makeboarddeb.sh @@ -309,7 +309,7 @@ fi find "${destination}" ! -type l -print0 2>/dev/null | xargs -0r chmod 'go=rX,u+rw,a-s' # create board DEB file - fakeroot dpkg-deb -b "${destination}" "${destination}.deb" >> "${DEST}"/debug/install.log 2>&1 + fakeroot dpkg-deb -b "${destination}" "${destination}.deb" >> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1 mkdir -p "${DEB_STORAGE}/${RELEASE}/" rsync --remove-source-files -rq "${destination}.deb" "${DEB_STORAGE}/${RELEASE}/"