[PATCH 2/2] scripts/make-erofs.sh: run mkdir less

Alyssa Ross
2025-09-30T09:24:27Z

[ is likely a shell builtin, so by checking for existence before
running mkdir, we avoid lots of mkdir spawns.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
---
scripts/make-erofs.sh | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/make-erofs.sh b/scripts/make-erofs.sh
index 551ae4a..ad04844 100755
--- a/scripts/make-erofs.sh
+++ b/scripts/make-erofs.sh
@@ -61,7 +61,9 @@ while read -r arg1; do
)

# shellcheck disable=SC2031 # shadowed in subshell on purpose
- mkdir -p -- "$root/$parent"
+ if ! [ -e "$root/$parent" ]; then
+ mkdir -p -- "$root/$parent"
+ fi

cp -RT -- "$arg1" "$root/$arg2"
done
--
2.51.0