From 3ebcf62efb49473ef0d8de56b5f393dcaad480ce Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Sat, 10 Feb 2024 14:29:03 +0100 Subject: [PATCH] archive-builds.sh: Ignore non-directories in /package/pkg Some .have_archived_on_tape plain files have appeared in /package/pkg so this script fails when it tries to change the current working directory into a path which is not a directory. Check that the path is a directory before changing into it. This can be done with the existing check, because a check for a subdirectory implies that the parent is a directory, too. However, we need to use absolute pathnames, so modify the wildcard to produce absolute pathnames. --- tools/archive-build.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/archive-build.sh b/tools/archive-build.sh index 96d4dfe..ce3d2ad 100755 --- a/tools/archive-build.sh +++ b/tools/archive-build.sh @@ -7,12 +7,11 @@ if [ "$(hostname -s)" != "ellie" ]; then exit 1 fi -cd /package/pkg umask 022 -for d in *; do - cd /package/pkg/$d - if [[ -d build && $(stat --format=%U .) == "bin" ]]; then +for d in /package/pkg/*; do + if [[ -d $d/build && $(stat --format=%U $d) == "bin" ]]; then + cd $d echo "archive $d/build" tar --create --zstd --file build.tar.zstd build/ && rm -rf build fi