Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

detect containers #272

Merged
merged 1 commit into from
Jan 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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