[Fix] nvm_get_arch: Rasbperry Pi: armv7l with arm64 kernel, get correct arch

Co-authored-by: Botspot <54716352+Botspot@users.noreply.github.com>
Co-authored-by: Jordan Harband <ljharb@gmail.com>
Co-authored-by: Sladyn Nunes <sladynnunes98@gmail.com>
This commit is contained in:
Botspot
2021-03-22 14:56:25 -05:00
committed by Jordan Harband
parent 2b5e53fcd5
commit 779a34e6a9
2 changed files with 10 additions and 0 deletions

8
nvm.sh
View File

@@ -1796,6 +1796,14 @@ nvm_get_arch() {
aarch64) NVM_ARCH="arm64" ;;
*) NVM_ARCH="${HOST_ARCH}" ;;
esac
# If running a 64bit ARM kernel but a 32bit ARM userland, change ARCH to 32bit ARM (armv7l)
L=$(ls -dl /sbin/init) # if /sbin/init is 32bit executable
if [ "$(uname)" = "Linux" ] && [ "${NVM_ARCH}" = arm64 ] && [ "$(od -An -t x1 -j 4 -N 1 "${L#*-> }")" = ' 01' ]; then
NVM_ARCH=armv7l
HOST_ARCH=armv7l
fi
nvm_echo "${NVM_ARCH}"
}