From 5e020ab77bf87ef3b145b3ae23885fe7d0f2bee0 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Tue, 27 Feb 2024 17:08:52 -0500 Subject: [PATCH] Allow using doas in place of sudo. doas is much smaller and is used by some distributions, such as Alpine, instead of sudo. --- src/nixos-anywhere.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/nixos-anywhere.sh b/src/nixos-anywhere.sh index fe3158b4..d5adca2f 100755 --- a/src/nixos-anywhere.sh +++ b/src/nixos-anywhere.sh @@ -317,6 +317,7 @@ is_installer=\$(if [[ "\$is_nixos" == "y" ]] && grep -q VARIANT_ID=installer /et is_container=\$(if [[ "\$(has systemd-detect-virt)" == "y" ]]; then systemd-detect-virt --container; else echo "none"; fi) has_tar=\$(has tar) has_sudo=\$(has sudo) +has_doas=\$(has doas) has_wget=\$(has wget) has_curl=\$(has curl) has_setsid=\$(has setsid) @@ -348,6 +349,8 @@ fi maybe_sudo="" if [[ ${has_sudo-n} == "y" ]]; then maybe_sudo="sudo" +elif [[ ${has_doas-n} == "y" ]]; then + maybe_sudo="doas" fi if [[ ${is_os-n} != "Linux" ]]; then