From c1d6cd22c2390c7317b8996f9b993697491c1eab Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 4 Oct 2025 22:36:11 +0100 Subject: xbmk: don't call mkdir. use xbmkdir (new function) xbmkdir checks if a directory exists, before running mkdir, and then still uses -p i was testing xbmk on arch linux today, and noticed that it errored out when a directory already exists. i'm mitigating against buggy or differently behaving mkdir implementations this way, by wrapping around it. Signed-off-by: Leah Rowe --- include/lib.sh | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'include/lib.sh') diff --git a/include/lib.sh b/include/lib.sh index 3d205fa9..feb411e0 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -8,12 +8,6 @@ cbfstool="elf/coreboot/default/cbfstool" rmodtool="elf/coreboot/default/rmodtool" -remkdir() -{ - x_ rm -Rf "$@" - x_ mkdir -p "$@" -} - mkrom_tarball() { update_xbmkver "$1" @@ -58,7 +52,7 @@ mktarball() printf "Creating tar archive '%s' from directory '%s'\n" "$2" "$1" if [ "${2%/*}" != "$2" ]; then - x_ mkdir -p "${2%/*}" + x_ xbmkdir "${2%/*}" fi x_ tar -c "$1" | xz -T$XBMK_THREADS -9e > "$2" || \ @@ -169,6 +163,24 @@ build_sbase() fi } +remkdir() +{ + x_ rm -Rf "$@" + x_ xbmkdir "$@" +} + +xbmkdir() +{ + while [ $# -gt 0 ] + do + if [ ! -d "$1" ]; then + x_ mkdir -p "$1" + fi + + shift 1 + done +} + fx_() { xchk fx_ "$@" -- cgit v1.2.1