[New] Add support for OpenHarmony platform

also: `nvm_get_os`: set `NVM_DIR` in the OpenHarmony chroots, and skip them without a glibc x86-64 layout

`sudo` resets the environment, and `nvm.sh` returns early when it cannot detect `NVM_DIR`,
so in the chroots `nvm_get_os` was undefined and every check got an empty result.
The chroot setup needs `ldd` and `/lib64/ld-linux-x86-64.so.2`, which macOS does not have.

Co-authored-by: hqzing <hqzing@outlook.com>
Co-authored-by: Jordan Harband <ljharb@gmail.com>
This commit is contained in:
hqzingandJordan Harband authored and Jordan Harband committed 2026-08-18 17:23:11 +08:00
1 parent 0054ed6022
commit e8144d4194
5 files changed
+125

No files matched your search

+11
View File
@@ -3656,6 +3656,17 @@ nvm_get_os() {
esac
fi
# OpenHarmony can't be identified from `uname` alone: a device may run either
# a Linux kernel or a HarmonyOS kernel. Ask the userland, but only when neither
# `/etc/os-release` nor `uname` has identified some other OS.
case "${NVM_OS-}" in
'' | linux)
if [ -x /system/bin/param ] && /system/bin/param get const.ohos.fullname </dev/null 2>/dev/null | nvm_grep -q '^OpenHarmony'; then
NVM_OS=openharmony
fi
;;
esac
nvm_echo "${NVM_OS-}"
}