build: exit if not running from cbmk directory

there's no portable(posix) way to check when running
from a symlink to cbmk in the current work directory

for example:

ln -s cbmk/build cbmktest
./cbmktest roms list

this would pass the new test, and first try to
include option.sh. in practise, the user probably  doesn't
happen to have include/option.sh in their current path

i can use readlink here, but again not portable

the current check will suffice. it also works when
the symlink is called from $PATH

e.g. /usr/bin/cbmktest exists and you do:
cbmktest roms list

Signed-off-by: Leah Rowe <leah@libreboot.org>
Signed-off-by: Leah Rowe <info@minifree.org>
audit2-merge1
Leah Rowe 2024-05-09 14:31:43 +01:00 committed by Leah Rowe
parent eb8a02e808
commit e761a494c8
1 changed files with 5 additions and 0 deletions

5
build
View File

@ -7,6 +7,11 @@
set -u -e
if [ "./${0##*/}" != "${0}" ]; then
printf "You must run this in the cbmk work directory.\n" 1>&2
exit 1
fi
. "include/option.sh"
eval "$(setvars "" option aur_notice)"