xbps-src: print_cross_targets properly without `XBPS_DISTDIR` set

because it is called in `usage()`, before `XBPS_DISTDIR` is set by `xbps-src`,
it would only work if `XBPS_DISTDIR` is set by the user.
This commit is contained in:
classabbyamp 2024-02-24 12:59:53 -05:00
parent 79cf2d3cab
commit 73c84ad4b5
No known key found for this signature in database
GPG Key ID: 6BE0755918A4C7F5
1 changed files with 7 additions and 0 deletions

View File

@ -9,6 +9,13 @@ print_cross_targets() {
} }
usage() { usage() {
# copied from main logic because this is run before XBPS_DISTDIR is set normally
local _distdir="$(readlink -f "${0%/*}")"
if [ "${_distdir}" = "." ]; then
readonly XBPS_DISTDIR="$(pwd -P)"
else
readonly XBPS_DISTDIR="${_distdir}"
fi
cat << _EOF cat << _EOF
$PROGNAME: [options] <target> [arguments] $PROGNAME: [options] <target> [arguments]