made scripts more robust

This commit is contained in:
2026-01-14 12:23:58 +01:00
parent 493096bc76
commit de418b3716
3 changed files with 23 additions and 7 deletions

View File

@@ -1,7 +1,16 @@
#!/bin/bash
if [ -n "$BASH_SOURCE" ]; then
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
elif [ -n "$ZSH_NAME" ]; then
SCRIPT_DIR="$(cd "$(dirname "${(%):-%N}")" && pwd)"
else
echo "This script must be run with bash or zsh!" >&2
exit 1
fi
# ---- Configuration -------------------------------------------------
YOCTO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
YOCTO_ROOT="$(cd $SCRIPT_DIR/.. && pwd)"
BUILD_DIR="${1:-build}"
CACHE_BASE="${YOCTO_ROOT}/.cache/yocto"