uname.sh: fix cross uname -m
when XBPS_ARCH is reseted
From commit cf6e6f14d3, (wrappers/uname: report correct machine type on ethereal, 2020-02-10). Some template use `env -i` to reset environment variable for building host's binary file, thus the wrapped `uname -m` reports empty strings. Fix it by falling back to the value reported by `/usr/bin/uname -m`. We don't expect people cross-compile from i686-ethereal-chroot on top of x86_64 machine, it was expected to use for travis to native compile i686 only.
This commit is contained in:
parent
75e4976dde
commit
447bae0d3e
@ -1,9 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
uname=$(/usr/bin/uname $@)
|
||||
uname_m=$(/usr/bin/uname -m)
|
||||
arch=${XBPS_ARCH%-musl}
|
||||
# if XBPS_ARCH was reseted by `env -i` use original `/usr/bin/uname -m`
|
||||
: ${arch:=$uname_m}
|
||||
rv=$?
|
||||
echo "$uname" |
|
||||
sed "s/\(^\| \)$(/usr/bin/uname -n)\($\| \)/\1void\2/" |
|
||||
sed "s/$(/usr/bin/uname -m)/${XBPS_ARCH%-musl}/"
|
||||
sed "s/$uname_m/$arch/"
|
||||
|
||||
exit $rv
|
||||
|
Loading…
x
Reference in New Issue
Block a user