made scripts more robust

This commit is contained in:
2026-01-14 12:23:42 +01:00
parent a263b8acab
commit d305fa282e
3 changed files with 23 additions and 7 deletions

View File

@@ -1,15 +1,22 @@
#!/usr/bin/env bash
set -e
#!/usr/bin/env zsh
# -------------------------------------------------------------------
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
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
source "${SCRIPT_DIR}/setup-paths.sh"
# -------------------------------------------------------------------
# Sanity checks
if [ ! -d "${POKY_DIR}" ]; then
echo "ERROR: poky not found at ${POKY_DIR}"
echo "ERROR: poky not found at ${POKY_DIR}" >&2
return 1 2>/dev/null || exit 1
fi