Skip to content

Commit

Permalink
detect containers
Browse files Browse the repository at this point in the history
In particular people might use openvz containers, which doesn't support kexec.
  • Loading branch information
Mic92 authored and mergify[bot] committed Jan 7, 2024
1 parent 6f7c428 commit 2facb63
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/nixos-anywhere.sh
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ is_arch=\$(uname -m)
is_kexec=\$(if test -f /etc/is_kexec; then echo "y"; else echo "n"; fi)
is_nixos=\$is_nixos
is_installer=\$(if [[ "\$is_nixos" == "y" ]] && grep -q VARIANT_ID=installer /etc/os-release; then echo "y"; else echo "n"; fi)
is_container=\$(has systemd-detect-virt && systemd-detect-virt --container || echo "none")
has_tar=\$(has tar)
has_sudo=\$(has sudo)
has_wget=\$(has wget)
Expand Down Expand Up @@ -353,6 +354,10 @@ if [[ ${is_os-n} != "Linux" ]]; then
fi

if [[ ${is_kexec-n} == "n" ]] && [[ ${is_installer-n} == "n" ]]; then
if [[ ${is_container-none} != "none" ]]; then
echo "WARNING: This script does not support running from a '${is_container}' container. kexec will likely not work" >&2
fi

if [[ $kexec_url == "" ]]; then
case "${is_arch-unknown}" in
x86_64 | aarch64)
Expand Down

0 comments on commit 2facb63

Please sign in to comment.