diff --git a/lib/build-all.sh b/lib/build-all.sh index 8c38e9c089..c243c68280 100644 --- a/lib/build-all.sh +++ b/lib/build-all.sh @@ -42,10 +42,10 @@ pack_upload () local subdir="archive" [[ $BUILD_DESKTOP == yes ]] && version=${version}_desktop [[ $BETA == yes ]] && local subdir=nightly - local filename=$CACHEDIR/$DESTIMG/${version}.7z + local filename=$DESTIMG/${version}.7z # stage: generate sha256sum.sha - cd $CACHEDIR/$DESTIMG + cd $DESTIMG sha256sum -b ${version}.img > sha256sum.sha # stage: sign with PGP @@ -61,8 +61,8 @@ pack_upload () nice -n 19 bash -c "\ 7za a -t7z -bd -m0=lzma2 -mx=3 -mfb=64 -md=32m -ms=on $filename ${version}.img armbian.txt *.asc sha256sum.sha >/dev/null 2>&1 ; \ find . -type f -not -name '*.7z' -print0 | xargs -0 rm -- ; \ - while ! rsync -arP $CACHEDIR/$DESTIMG/. -e 'ssh -p 22' ${SEND_TO_SERVER}:/var/www/dl.armbian.com/${BOARD}/${subdir};do sleep 5;done; \ - rm -r $CACHEDIR/$DESTIMG" & + while ! rsync -arP $DESTIMG/. -e 'ssh -p 22' ${SEND_TO_SERVER}:/var/www/dl.armbian.com/${BOARD}/${subdir};do sleep 5;done; \ + rm -r $DESTIMG" & } build_main () diff --git a/lib/configuration.sh b/lib/configuration.sh index 00ebb394a3..9fd824c719 100644 --- a/lib/configuration.sh +++ b/lib/configuration.sh @@ -20,7 +20,6 @@ TZDATA=`cat /etc/timezone` # Timezone for target is taken from host or defined h USEALLCORES=yes # Use all CPU cores for compiling EXIT_PATCHING_ERROR="" # exit patching if failed HOST="$(echo "$BOARD" | cut -f1 -d-)" # set hostname to the board -CACHEDIR=$SRC/cache ROOTFSCACHE_VERSION=3 [[ -z $ROOTFS_TYPE ]] && ROOTFS_TYPE=ext4 # default rootfs type is ext4 @@ -64,7 +63,7 @@ SERIALCON=ttyS0 # set unique mounting directory SDCARD="$SRC/.tmp/rootfs-${BRANCH}-${BOARD}-${RELEASE}-${BUILD_DESKTOP}" MOUNT="$SRC/.tmp/mount-${BRANCH}-${BOARD}-${RELEASE}-${BUILD_DESKTOP}" -DESTIMG="image-${BRANCH}-${BOARD}-${RELEASE}-${BUILD_DESKTOP}" +DESTIMG="$SRC/.tmp/image-${BRANCH}-${BOARD}-${RELEASE}-${BUILD_DESKTOP}" [[ ! -f $SRC/config/sources/$LINUXFAMILY.conf ]] && \ exit_with_error "Sources configuration not found" "$LINUXFAMILY" diff --git a/lib/debootstrap-ng.sh b/lib/debootstrap-ng.sh index fb1727940d..160ba8c94c 100644 --- a/lib/debootstrap-ng.sh +++ b/lib/debootstrap-ng.sh @@ -31,7 +31,7 @@ debootstrap_ng() # stage: clean and create directories rm -rf $SDCARD $MOUNT - mkdir -p $SDCARD $MOUNT $DEST/images + mkdir -p $SDCARD $MOUNT $DEST/images $SRC/cache/rootfs # stage: verify tmpfs configuration and mount # default maximum size for tmpfs mount is 1/2 of available RAM @@ -106,7 +106,7 @@ debootstrap_ng() create_rootfs_cache() { local packages_hash=$(get_package_list_hash) - local cache_fname=$CACHEDIR/rootfs/${RELEASE}-ng-$ARCH.$packages_hash.tar.lz4 + local cache_fname=$SRC/cache/rootfs/${RELEASE}-ng-$ARCH.$packages_hash.tar.lz4 local display_name=${RELEASE}-ng-$ARCH.${packages_hash:0:3}...${packages_hash:29}.tar.lz4 if [[ -f $cache_fname ]]; then local date_diff=$(( ($(date +%s) - $(stat -c %Y $cache_fname)) / 86400 )) @@ -220,7 +220,7 @@ create_rootfs_cache() # DEBUG: print free space echo -e "\nFree space:" - eval 'df -h | grep "$CACHEDIR/"' ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/debootstrap.log'} + eval 'df -h' ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/debootstrap.log'} # stage: remove downloaded packages chroot $SDCARD /bin/bash -c "apt-get clean" @@ -335,7 +335,7 @@ prepare_partitions() # stage: create blank image display_alert "Creating blank image for rootfs" "$sdsize MiB" "info" - dd if=/dev/zero bs=1M status=none count=$sdsize | pv -p -b -r -s $(( $sdsize * 1024 * 1024 )) | dd status=none of=$CACHEDIR/${SDCARD}.raw + dd if=/dev/zero bs=1M status=none count=$sdsize | pv -p -b -r -s $(( $sdsize * 1024 * 1024 )) | dd status=none of=${SDCARD}.raw # stage: calculate boot partition size local bootstart=$(($OFFSET * 2048)) @@ -344,17 +344,17 @@ prepare_partitions() # stage: create partition table display_alert "Creating partitions" "${bootfs:+/boot: $bootfs }root: $ROOTFS_TYPE" "info" - parted -s $CACHEDIR/${SDCARD}.raw -- mklabel msdos + parted -s ${SDCARD}.raw -- mklabel msdos if [[ $ROOTFS_TYPE == nfs ]]; then # single /boot partition - parted -s $CACHEDIR/${SDCARD}.raw -- mkpart primary ${parttype[$bootfs]} ${bootstart}s -1s + parted -s ${SDCARD}.raw -- mkpart primary ${parttype[$bootfs]} ${bootstart}s -1s elif [[ $BOOTSIZE == 0 ]]; then # single root partition - parted -s $CACHEDIR/${SDCARD}.raw -- mkpart primary ${parttype[$ROOTFS_TYPE]} ${rootstart}s -1s + parted -s ${SDCARD}.raw -- mkpart primary ${parttype[$ROOTFS_TYPE]} ${rootstart}s -1s else # /boot partition + root partition - parted -s $CACHEDIR/${SDCARD}.raw -- mkpart primary ${parttype[$bootfs]} ${bootstart}s ${bootend}s - parted -s $CACHEDIR/${SDCARD}.raw -- mkpart primary ${parttype[$ROOTFS_TYPE]} ${rootstart}s -1s + parted -s ${SDCARD}.raw -- mkpart primary ${parttype[$bootfs]} ${bootstart}s ${bootend}s + parted -s ${SDCARD}.raw -- mkpart primary ${parttype[$ROOTFS_TYPE]} ${rootstart}s -1s fi # stage: mount image @@ -369,7 +369,7 @@ prepare_partitions() [[ $CONTAINER_COMPAT == yes && ! -e $LOOP ]] && mknod -m0660 $LOOP b 7 ${LOOP//\/dev\/loop} > /dev/null # TODO: Needs mknod here in Docker? - losetup $LOOP $CACHEDIR/${SDCARD}.raw + losetup $LOOP ${SDCARD}.raw # loop device was grabbed here, unlock flock -u $FD @@ -438,7 +438,7 @@ create_image() [[ $ROOTFS_TYPE == nfs ]] && version=${version}_nfsboot if [[ $ROOTFS_TYPE != nfs ]]; then - display_alert "Copying files to root directory" "${SDCARD}.raw" "info" + display_alert "Copying files to root directory" rsync -aHWXh --exclude="/boot/*" --exclude="/dev/*" --exclude="/proc/*" --exclude="/run/*" --exclude="/tmp/*" \ --exclude="/sys/*" --info=progress2,stats1 $SDCARD/ $MOUNT/ else @@ -448,7 +448,7 @@ create_image() fi # stage: rsync /boot - display_alert "Copying files to /boot directory" "${SDCARD}.raw" "info" + display_alert "Copying files to /boot directory" if [[ $(findmnt --target $MOUNT/boot -o FSTYPE -n) == vfat ]]; then # fat32 rsync -rLtWh --info=progress2,stats1 $SDCARD/boot $MOUNT @@ -459,7 +459,7 @@ create_image() # DEBUG: print free space display_alert "Free space:" "SD card" "info" - eval 'df -h | grep "$CACHEDIR/"' ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/debootstrap.log'} + eval 'df -h' ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/debootstrap.log'} # stage: write u-boot write_uboot $LOOP @@ -469,14 +469,14 @@ create_image() [[ $BOOTSIZE != 0 ]] && umount -l $MOUNT/boot [[ $ROOTFS_TYPE != nfs ]] && umount -l $MOUNT losetup -d $LOOP - rm -rf --one-file-system $CACHEDIR/$DESTIMG $MOUNT - mkdir -p $CACHEDIR/$DESTIMG - cp $SDCARD/etc/armbian.txt $CACHEDIR/$DESTIMG - mv $CACHEDIR/${SDCARD}.raw $CACHEDIR/$DESTIMG/${version}.img + rm -rf --one-file-system $DESTIMG $MOUNT + mkdir -p $DESTIMG + cp $SDCARD/etc/armbian.txt $DESTIMG + mv ${SDCARD}.raw $DESTIMG/${version}.img if [[ $COMPRESS_OUTPUTIMAGE == yes && $BUILD_ALL != yes ]]; then # compress image - cd $CACHEDIR/$DESTIMG + cd $DESTIMG sha256sum -b ${version}.img > sha256sum.sha if [[ -n $GPG_PASS ]]; then echo $GPG_PASS | gpg --passphrase-fd 0 --armor --detach-sign --batch --yes ${version}.img @@ -487,8 +487,8 @@ create_image() fi # if [[ $BUILD_ALL != yes ]]; then - mv $CACHEDIR/$DESTIMG/${version}.img $DEST/images/${version}.img - rm -rf $CACHEDIR/$DESTIMG + mv $DESTIMG/${version}.img $DEST/images/${version}.img + rm -rf $DESTIMG fi display_alert "Done building" "$DEST/images/${version}.img" "info" diff --git a/lib/general.sh b/lib/general.sh index 6a6a07b0bb..e2af421535 100644 --- a/lib/general.sh +++ b/lib/general.sh @@ -59,7 +59,7 @@ cleaning() ;; cache) # delete output/cache - [[ -d $CACHEDIR ]] && display_alert "Cleaning" "output/cache/rootfs (all)" "info" && find $CACHEDIR/rootfs/ -type f -delete + [[ -d $SRC/cache/rootfs ]] && display_alert "Cleaning" "rootfs cache (all)" "info" && find $SRC/cache/rootfs -type f -delete ;; images) # delete output/images @@ -71,9 +71,9 @@ cleaning() ;; oldcache) - if [[ -d $CACHEDIR/rootfs/ && $(ls -1 $CACHEDIR/rootfs/ | wc -l) -gt 6 ]]; then - display_alert "Cleaning" "output/cache/rootfs (old)" "info" - (cd $CACHEDIR/rootfs/; ls -t | sed -e "1,6d" | xargs -d '\n' rm -f) + if [[ -d $SRC/cache/rootfs && $(ls -1 $SRC/cache/rootfs | wc -l) -gt 6 ]]; then + display_alert "Cleaning" "rootfs cache (old)" "info" + (cd $SRC/cache/rootfs; ls -t | sed -e "1,6d" | xargs -d '\n' rm -f) fi ;; esac diff --git a/packages/extras/tools.sh b/packages/extras/tools.sh index 50b14e90e3..0ce81f4bf5 100644 --- a/packages/extras/tools.sh +++ b/packages/extras/tools.sh @@ -59,7 +59,7 @@ compile_tools() cd $tmpdir dpkg -b armbian-tools-${RELEASE}_${REVISION}_${ARCH} >/dev/null mv $tmpdir/armbian-tools-${RELEASE}_${REVISION}_${ARCH}.deb $DEST/debs - cd $CACHEDIR + cd $SRC/cache rm -rf $tmpdir } @@ -69,7 +69,7 @@ compile_tools() chroot $SDCARD /bin/bash -c "cd /root/tools/temper/src; make clean" >> $DEST/debug/tools-build.log 2>&1 chroot $SDCARD /bin/bash -c "cd /root/tools/temper/src; make $CTHREADS" >> $DEST/debug/tools-build.log 2>&1 if [[ $? -ne 0 || ! -f $tmpdir/temper/src/pcsensor ]]; then - cd $CACHEDIR + cd $SRC/cache rm -rf $tmpdir display_alert "Error building" "temper" "wrn" return @@ -77,7 +77,7 @@ compile_tools() display_alert "... compiling" "bluetooth utils" "info" chroot $SDCARD /bin/bash -c "cd /root/tools/brcm; make $CTHREADS" >> $DEST/debug/tools-build.log 2>&1 if [[ $? -ne 0 || ! -f $tmpdir/brcm/brcm_bt_reset ]]; then - cd $CACHEDIR + cd $SRC/cache rm -rf $tmpdir display_alert "Error building" "BT utils" "wrn" return