Cleaner parent directory creation

My previous patch b0rked memtest and others because when making sure
their parent directory (the project root) exists, it would instead create
the project directory (memtest86lus). The later move would then put the
git repo inside that (memtest86plus/memtest86plus_123456).

We just need to make sure we don't create the target directory itself.
This way, there's no need to hardcode any project names.

Tested by ./updating rpi-pico-serprog, memtest86plus, grub and seabios.

Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
btrfsvols
Riku Viitanen 2023-09-08 00:25:52 +03:00
parent 7e8465bec8
commit 4d3b16da38
1 changed files with 2 additions and 2 deletions

View File

@ -85,8 +85,8 @@ clone_project()
[ ! -d "${location}" ] || \
rm -Rf "${location}" || \
fail "clone_project: Can't remove directory '${location}'"
[ "${name}" != "rpi-pico-serprog" ] || mkdir -p ${location%/*} || \
fail "clone_project: cannot make directory for rpi-pico-serprog"
[ "${location}" = "${location%/*}" ] || mkdir -p ${location%/*} || \
fail "clone_project: cannot make directory for ${name}"
mv "${tmp_dir}" "${location}" || \
fail "clone_project: could not copy temp file to destination"
}