From 1cce358c40d4cc5b3d6128256cf281bdc7853367 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Thu, 7 Aug 2025 22:41:26 +0200 Subject: [PATCH] single-user-install: just call uname once --- scripts/install-nix-from-tarball.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/install-nix-from-tarball.sh b/scripts/install-nix-from-tarball.sh index 38fe3af74..87cdde622 100644 --- a/scripts/install-nix-from-tarball.sh +++ b/scripts/install-nix-from-tarball.sh @@ -26,8 +26,10 @@ if [ -z "$HOME" ]; then exit 1 fi +OS="$(uname -s)" + # macOS support for 10.12.6 or higher -if [ "$(uname -s)" = "Darwin" ]; then +if [ "$OS" = "Darwin" ]; then IFS='.' read -r macos_major macos_minor macos_patch << EOF $(sw_vers -productVersion) EOF @@ -39,11 +41,11 @@ EOF fi # Determine if we could use the multi-user installer or not -if [ "$(uname -s)" = "Linux" ]; then +if [ "$OS" = "Linux" ]; then echo "Note: a multi-user installation is possible. See https://nix.dev/manual/nix/stable/installation/installing-binary.html#multi-user-installation" >&2 fi -case "$(uname -s)" in +case "$OS" in "Darwin") INSTALL_MODE=daemon;; *) @@ -60,7 +62,7 @@ while [ $# -gt 0 ]; do ACTION=install ;; --no-daemon) - if [ "$(uname -s)" = "Darwin" ]; then + if [ "$OS" = "Darwin" ]; then printf '\e[1;31mError: --no-daemon installs are no-longer supported on Darwin/macOS!\e[0m\n' >&2 exit 1 fi @@ -167,7 +169,7 @@ for i in $(cd "$self/store" >/dev/null && echo ./*); do rm -rf "$i_tmp" fi if ! [ -e "$dest/store/$i" ]; then - if [ "$(uname -s)" = "Darwin" ]; then + if [ "$OS" = "Darwin" ]; then cp -RPp "$self/store/$i" "$i_tmp" else cp -RP --preserve=ownership,timestamps "$self/store/$i" "$i_tmp"