-
-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[[ ]] is not available in POSIX sh, and test -o is not well defined either. Move the facts-gathering script out so it can be tested with shellcheck.
- Loading branch information
1 parent
88a60aa
commit 3170c45
Showing
3 changed files
with
26 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/sh | ||
set -efu "${enable_debug:-}" | ||
has() { | ||
command -v "$1" >/dev/null && echo "y" || echo "n" | ||
} | ||
is_nixos=$(if test -f /etc/os-release && grep -q ID=nixos /etc/os-release; then echo "y"; else echo "n"; fi) | ||
cat <<FACTS | ||
is_os=$(uname) | ||
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=$(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) | ||
FACTS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters