From 1687aeee73411391217c56ff7bb050e2619d11c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Tue, 7 Jan 2025 23:01:30 +0100 Subject: [PATCH] support run0 as a sudo alternative --- src/get-facts.sh | 1 + src/nixos-anywhere.sh | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/get-facts.sh b/src/get-facts.sh index 80434422..90b63701 100755 --- a/src/get-facts.sh +++ b/src/get-facts.sh @@ -16,6 +16,7 @@ hasTar=$(has tar) hasCpio=$(has cpio) hasSudo=$(has sudo) hasDoas=$(has doas) +hasRun0=$(has run0) hasWget=$(has wget) hasCurl=$(has curl) hasSetsid=$(has setsid) diff --git a/src/nixos-anywhere.sh b/src/nixos-anywhere.sh index fed359fa..c666b941 100755 --- a/src/nixos-anywhere.sh +++ b/src/nixos-anywhere.sh @@ -48,6 +48,7 @@ hasTar= hasCpio= hasSudo= hasDoas= +hasRun0= hasWget= hasCurl= hasSetsid= @@ -438,7 +439,7 @@ importFacts() { # shellcheck disable=SC2046 export $(echo "$filteredFacts" | xargs) - for var in isOs isArch isKexec isInstaller isContainer hasIpv6Only hasTar hasCpio hasSudo hasDoas hasWget hasCurl hasSetsid; do + for var in isOs isArch isKexec isInstaller isContainer hasIpv6Only hasTar hasCpio hasSudo hasDoas hasRun0 hasWget hasCurl hasSetsid; do if [[ -z ${!var} ]]; then abort "Failed to retrieve fact $var from host" fi @@ -689,6 +690,8 @@ main() { maybeSudo="sudo" elif [[ ${hasDoas-n} == "y" ]]; then maybeSudo="doas" + elif [[ ${hasRun0-n} == "y" ]]; then + maybeSudo="run0" fi if [[ ${isOs} != "Linux" ]]; then