diff options
author | Leah Rowe <leah@libreboot.org> | 2025-10-04 22:36:11 +0100 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2025-10-04 22:42:42 +0100 |
commit | c1d6cd22c2390c7317b8996f9b993697491c1eab (patch) | |
tree | 120aebfa5328e7699759a087d15a2fd0aeafc3f7 /include/lib.sh | |
parent | f358cfaa55219c537de0eb534997be36cba93f14 (diff) |
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 <leah@libreboot.org>
Diffstat (limited to 'include/lib.sh')
-rw-r--r-- | include/lib.sh | 26 |
1 files changed, 19 insertions, 7 deletions
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_ "$@" |