mirror of
https://github.com/nix-community/nixos-anywhere.git
synced 2024-10-26 08:18:11 +03:00
fix container detection
When systemd-detect-virt exists and we aren't in a container, is_container contains "y none none" instead of none. 1. has outputs y/n to stdout which we need to remove 2. has always returns truthy, we need to check it's string value not the exit value 3. systemd-detect-virt --container returns non-zero when we aren't in a container, use if then else instead of && ||
This commit is contained in:
parent
9e34fce5da
commit
b6abac7b0e
@ -314,7 +314,7 @@ is_arch=\$(uname -m)
|
|||||||
is_kexec=\$(if test -f /etc/is_kexec; then echo "y"; else echo "n"; fi)
|
is_kexec=\$(if test -f /etc/is_kexec; then echo "y"; else echo "n"; fi)
|
||||||
is_nixos=\$is_nixos
|
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_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")
|
is_container=\$(if [[ "\$(has systemd-detect-virt)" == "y" ]]; then systemd-detect-virt --container; else echo "none"; fi)
|
||||||
has_tar=\$(has tar)
|
has_tar=\$(has tar)
|
||||||
has_sudo=\$(has sudo)
|
has_sudo=\$(has sudo)
|
||||||
has_wget=\$(has wget)
|
has_wget=\$(has wget)
|
||||||
|
Loading…
Reference in New Issue
Block a user