From 60d88c7c28998ce88fe1f71d73dde228cf94912b Mon Sep 17 00:00:00 2001 From: Dave Woodfall Date: Mon, 5 Apr 2021 04:27:18 +0000 Subject: Optimisations with loops when running update. Use printf's formatting instead of for loops, and tee instead of cp. Use --fast with gzip. The biggest slowdowns are the bunzip2s on MANIFEST files, but not much can be done about those. The changes together shave roughly 3 seconds off here, but it's all going to be relative to the local system. --- files/core-functions.sh | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/files/core-functions.sh b/files/core-functions.sh index 1f4faf3..0eedef9 100644 --- a/files/core-functions.sh +++ b/files/core-functions.sh @@ -1180,17 +1180,13 @@ Please check your mirror and try again." # echo -e "\tFormatting lists to slackpkg style..." echo -e "\t\tPackage List: using $( basename $FILELIST ) as source" - grep "\.t[blxg]z$" $FILELIST| \ - awk -f /usr/libexec/slackpkg/pkglist.awk |\ - sed -e 's/^M//g' > ${TMPDIR}/pkglist - cp ${TMPDIR}/pkglist ${WORKDIR}/pkglist + grep "\.t[blxg]z$" $FILELIST | + awk -f /usr/libexec/slackpkg/pkglist.awk | + sed -e 's/^M//g' | tee ${WORKDIR}/pkglist > ${TMPDIR}/pkglist # Create the slackware tree under TEMP directory - for i in $( cut -f7 -d\ ${WORKDIR}/pkglist | sort -u ) ; do - if ! [ -d ${ROOT}/${TEMP}/${i} ]; then - mkdir -p ${ROOT}/${TEMP}/${i} - fi - done + mkdir -p $( printf "${ROOT}/${TEMP}/%s " $( + cut -f7 -d\ ${WORKDIR}/pkglist | sort -u ) ) # Format MANIFEST # @@ -1199,8 +1195,9 @@ Please check your mirror and try again." # MANFILES="" for i in $DIRS; do - bunzip2 -c $TMPDIR/${i}-MANIFEST.bz2 | awk -f /usr/libexec/slackpkg/filelist.awk | \ - gzip > ${TMPDIR}/${i}-filelist.gz + bunzip2 -c $TMPDIR/${i}-MANIFEST.bz2 | + awk -f /usr/libexec/slackpkg/filelist.awk | + gzip --fast > ${TMPDIR}/${i}-filelist.gz done cp ${TMPDIR}/*-filelist.gz ${WORKDIR}/ -- cgit v1.2.3