From bc142296398cc6686b68c4aef652046a8eb62aaf Mon Sep 17 00:00:00 2001 From: cloudhead Date: Mon, 2 Sep 2024 16:20:17 +0200 Subject: [PATCH] scripts: Small improvement to `cache-cobs` --- scripts/cache-cobs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/scripts/cache-cobs b/scripts/cache-cobs index 7cbd0942..b29013ac 100755 --- a/scripts/cache-cobs +++ b/scripts/cache-cobs @@ -1,11 +1,19 @@ #!/bin/sh +set -e DIRECTORY="$(rad path)/storage" +if [ ! -d "$DIRECTORY" ]; then + echo "Error: Directory $DIRECTORY does not exist or is not accessible." + exit 1 +fi + for repo in "$DIRECTORY"/*; do - repo="rad:$(basename $repo)" - echo "Processing $repo.." - rad issue cache --repo "$repo" - rad patch cache --repo "$repo" - echo + if [ -d "$repo" ]; then + rid=$(basename "$repo") + echo "Processing rad:$rid.." + rad issue cache --repo "rad:$rid" + rad patch cache --repo "rad:$rid" + echo + fi done