Fix prebuild scripts one more time (#55059)

* Better

* Update build.sh

I made it a little bit shorter. 
The main value here that you changed negative condition with positive one. That excludes the cases when some error occur in condition. Since some error during calculation a predicate does not mean that predicate is false logically. It means predicate is just failed. Bash is hard in distinguishing such cases.

* Update build.sh

---------

Co-authored-by: Sema Checherinda <104093494+CheSema@users.noreply.github.com>
This commit is contained in:
Nikita Mikhaylov 2023-09-27 17:10:02 +02:00 committed by GitHub
parent e9c3032f83
commit 02ac8d56ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,15 +55,21 @@ ccache_status
# clear cache stats
ccache --zero-stats ||:
function check_prebuild_exists() {
local path="$1"
[ -d "$path" ] && [ "$(ls -A "$path")" ]
}
# Check whether the directory with pre-build scripts exists and not empty.
if [ ! -d "/build/packages/pre-build" ] || [ -n "$(ls -A /build/packages/pre-build)" ]; then
echo "There are no subcommands to execute :)"
else
if check_prebuild_exists /build/packages/pre-build
then
# Execute all commands
for file in /build/packages/pre-build/*.sh ;
do
bash "$file"
done
else
echo "There are no subcommands to execute :)"
fi
if [ "$BUILD_MUSL_KEEPER" == "1" ]