🆕 Let REIMS_INSTALL_SKIP_HOST_CHECKS=1 skip the host checks
The owner asked for an environment variable that skips the installers' checks of the host, in install-ctl.sh and in its Windows equivalent alike. Set to 1, install-ctl.sh skips its checks of the host for the VMs it runs, with the changes they offer to make through sudo: on Linux KVM, /dev/udmabuf and its group, vm.max_map_count, MGLRU's min_ttl_ms, the USB udev rule and the kvm group; on Windows the Windows Hypervisor Platform. install.ps1 skips its step 2, the platform's check and its turning on as an administrator, and the variable reaches install-ctl.sh in CLANG64's shell. Each script says once what it skipped. Neither skips what the build needs or refuses: the host's OS and architecture, the CLANG64 shell, paths with a space, the dependencies, rustup, vendor/qemu and --skip-qemu's installed QEMU. Unset, or anything but 1, both scripts do what they did. On a Mac the variable changes nothing: the one check there for VMs, of the macOS release, decides whether mesa, a dependency, is installed. Both scripts' headers document it, and docs/qemu.md's Windows install section names it.
This commit is contained in:
1 parent
8cf98f5d65
commit
412dde9937
3 files changed
+47
-9
No files matched your search
@@ -1247,6 +1247,14 @@ usual default host, `x86_64-pc-windows-msvc`, xtask, the build scripts,
|
||||
reims-ctl and reims-util would build for MSVC, which links only with Visual
|
||||
Studio's `link.exe`.
|
||||
|
||||
With `REIMS_INSTALL_SKIP_HOST_CHECKS=1` in its environment, install.ps1
|
||||
skips the hypervisor platform's step, its check and its turning on, and
|
||||
install-ctl.sh, which gets the variable in CLANG64's login shell, skips its
|
||||
own check of the platform; every other step runs as without it. On Linux the
|
||||
same variable skips install-ctl.sh's checks of the host for VMs (KVM,
|
||||
`/dev/udmabuf`, `vm.max_map_count`, `min_ttl_ms`, the USB udev rule and the
|
||||
kvm group), and on a Mac it skips nothing (each script's header).
|
||||
|
||||
**Measured** on the mini (2026-11-16, `m3-max-36191`), in a scratch MSYS2
|
||||
extracted from MSYS2's base archive (its package list of 2026-09-27, so the
|
||||
update step had work to do) and a scratch user profile with rustup's
|
||||
|
||||
+28
-5
@@ -55,6 +55,17 @@
|
||||
# target/); XDG_DATA_HOME and XDG_CACHE_HOME move the install, with reims-ctl's
|
||||
# record of it, which reims-ctl update reads, and the build from ~/.local/share
|
||||
# and ~/.cache.
|
||||
#
|
||||
# REIMS_INSTALL_SKIP_HOST_CHECKS=1 skips the checks of this host for the VMs
|
||||
# it runs, with the changes they offer to make through sudo, and says once that
|
||||
# it skipped them: on Linux, KVM, /dev/udmabuf and its group, vm.max_map_count,
|
||||
# MGLRU's min_ttl_ms, the udev rule for USB passthrough and the kvm group; on
|
||||
# Windows, the Windows Hypervisor Platform. A Mac has none to skip: its one
|
||||
# check for VMs, of its macOS release, decides whether mesa, a dependency, is
|
||||
# installed. It never skips what the build needs or refuses: the host's OS and
|
||||
# architecture, the CLANG64 shell, a path with a space, the dependencies and
|
||||
# their installs, rustup, vendor/qemu, and --skip-qemu's need of an installed
|
||||
# QEMU. reims-ctl doctor checks the host whenever you run it.
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
@@ -76,6 +87,9 @@ for arg in "$@"; do
|
||||
;;
|
||||
esac
|
||||
done
|
||||
# Unset, or anything but 1, the host's checks run.
|
||||
SKIP_HOST_CHECKS=0
|
||||
[[ ${REIMS_INSTALL_SKIP_HOST_CHECKS:-} == 1 ]] && SKIP_HOST_CHECKS=1
|
||||
|
||||
bold=$'\033[1m' red=$'\033[31m' yellow=$'\033[33m' green=$'\033[32m' off=$'\033[0m'
|
||||
[[ -t 1 ]] || bold='' red='' yellow='' green='' off=''
|
||||
@@ -412,16 +426,25 @@ case "$OS $distro_id $distro_like " in
|
||||
warn "$distro_id is neither Debian/Ubuntu, Fedora nor Arch/CachyOS: install the equivalents of these Ubuntu packages yourself if the build stops: ${apt_pkgs[*]}"
|
||||
;;
|
||||
esac
|
||||
# The rest of the host's checks are for the VMs it runs, on Windows and Linux,
|
||||
# and REIMS_INSTALL_SKIP_HOST_CHECKS=1 skips them all (Environment, above).
|
||||
if [[ $SKIP_HOST_CHECKS == 1 ]]; then
|
||||
if [[ $WINDOWS == 1 ]]; then
|
||||
say "REIMS_INSTALL_SKIP_HOST_CHECKS=1: skipping this host's check for VMs, of the Windows Hypervisor Platform; reims-ctl doctor checks the host"
|
||||
elif [[ $OS == Linux ]]; then
|
||||
say "REIMS_INSTALL_SKIP_HOST_CHECKS=1: skipping this host's checks for VMs (KVM, /dev/udmabuf and its group, vm.max_map_count, MGLRU's min_ttl_ms, the USB udev rule and the kvm group); reims-ctl doctor checks the host"
|
||||
fi
|
||||
fi
|
||||
# On Windows, VMs run on the Windows Hypervisor Platform, an optional feature of
|
||||
# Windows: Win32_OptionalFeature's InstallState is 1 where it is on.
|
||||
if [[ $WINDOWS == 1 ]]; then
|
||||
if [[ $WINDOWS == 1 && $SKIP_HOST_CHECKS == 0 ]]; then
|
||||
whp="$(powershell -NoProfile -Command "(Get-CimInstance Win32_OptionalFeature -Filter \"Name='HypervisorPlatform'\").InstallState" 2>/dev/null | tr -d '\r')"
|
||||
[[ $whp == 1 ]] || warn "the Windows Hypervisor Platform is off, and VMs run on it: turn it on in Windows Features (run optionalfeatures, tick Windows Hypervisor Platform), then restart Windows"
|
||||
fi
|
||||
# The rest of the host's checks are for the VMs Linux runs: KVM, the library's
|
||||
# GPU access to the guest's memory, and USB passthrough. KVM runs x86-64 VMs on
|
||||
# x86-64 and arm64 VMs on arm64; arm64 VMs on x86-64 are emulated by TCG.
|
||||
if [[ $OS == Linux ]]; then
|
||||
# Linux's checks are for the VMs it runs: KVM, the library's GPU access to the
|
||||
# guest's memory, and USB passthrough. KVM runs x86-64 VMs on x86-64 and arm64
|
||||
# VMs on arm64; arm64 VMs on x86-64 are emulated by TCG.
|
||||
if [[ $OS == Linux && $SKIP_HOST_CHECKS == 0 ]]; then
|
||||
if [[ ! -r /dev/kvm || ! -w /dev/kvm ]]; then
|
||||
vms="VMs will not start"
|
||||
[[ $ARCH == x86_64 ]] && vms="x86-64 VMs will not start (arm64 VMs, which TCG emulates here, start without it)"
|
||||
|
||||
+11
-4
@@ -22,6 +22,10 @@
|
||||
#
|
||||
# REIMS_INSTALL_PRETEND_MISSING (msys2, git, whp, comma-separated) has the checks find those
|
||||
# missing, for a dry run of the steps that install them on a machine that has them.
|
||||
# REIMS_INSTALL_SKIP_HOST_CHECKS=1 skips step 2, the check of the Windows Hypervisor Platform
|
||||
# and its turning on as an administrator, saying once that it skipped it; install-ctl.sh, which
|
||||
# gets the variable too, then skips its own check of the platform. Steps 1, 3 and 4 run as they
|
||||
# do without it. VMs start only once the platform is on, which reims-ctl doctor checks.
|
||||
param(
|
||||
[switch]$Yes,
|
||||
[switch]$DryRun,
|
||||
@@ -76,12 +80,15 @@ if (-not $DryRun) {
|
||||
if (-not (Test-Path $bash)) { Die "MSYS2 is not in $Msys2 (no $bash): give its folder with -Msys2" }
|
||||
}
|
||||
|
||||
# 2. The Windows Hypervisor Platform. Win32_OptionalFeature answers without an administrator's
|
||||
# rights: InstallState 1 is on.
|
||||
$whp = (Get-CimInstance Win32_OptionalFeature -Filter "Name='HypervisorPlatform'").InstallState
|
||||
# 2. The Windows Hypervisor Platform, unless REIMS_INSTALL_SKIP_HOST_CHECKS=1 skips the step.
|
||||
# Win32_OptionalFeature answers without an administrator's rights: InstallState 1 is on.
|
||||
$skipHostChecks = $env:REIMS_INSTALL_SKIP_HOST_CHECKS -eq "1"
|
||||
$whp = if ($skipHostChecks) { $null } else { (Get-CimInstance Win32_OptionalFeature -Filter "Name='HypervisorPlatform'").InstallState }
|
||||
if ($pretend -contains "whp") { $whp = 2 }
|
||||
$restart = $false
|
||||
if ($whp -eq 1) {
|
||||
if ($skipHostChecks) {
|
||||
Say "REIMS_INSTALL_SKIP_HOST_CHECKS=1: skipping step 2, the check of the Windows Hypervisor Platform, which VMs run on; reims-ctl doctor checks it"
|
||||
} elseif ($whp -eq 1) {
|
||||
Say "The Windows Hypervisor Platform is on"
|
||||
} else {
|
||||
if (-not $DryRun -and -not (Ask "Turn on the Windows Hypervisor Platform, which VMs run on? Windows asks for an administrator, and needs a restart after")) {
|
||||
|
||||
Reference in new issue
Block a user