Refactor init_deps.sh to simplify post-install script execution logic

This commit is contained in:
Théophile Diot 2025-01-16 09:50:59 +01:00
parent 2146e20608
commit 8d27236b1a
No known key found for this signature in database
GPG key ID: FA995104A0BA376A

View file

@ -43,13 +43,11 @@ do
url="$(echo "$repo" | jq -r .url)"
commit="$(echo "$repo" | jq -r .commit)"
post_install="$(echo "$repo" | jq -r .post_install)"
post="no"
echo " Clone ${name} from $url at commit/version $commit"
if [ ! -d "src/deps/src/$id" ] ; then
do_and_check_cmd git subtree add --prefix "src/deps/src/$id" "$url" "$commit" --squash
post="yes"
else
echo "⚠️ Skipping clone of $url because target directory is already present"
echo " Updating ${name} from $url at commit/version $commit"
@ -60,7 +58,7 @@ do
do_and_check_cmd rm -rf "src/deps/src/$id/.git"
fi
if [ "$post_install" != "null" ] && [ "$post" != "no" ]; then
if [ "$post_install" != "null" ]; then
echo " Running post install script for ${name}"
bash -c "$post_install"
fi