1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-09 03:56:01 +01:00

single-user-install: just call uname once

This commit is contained in:
Jörg Thalheim 2025-08-07 22:41:26 +02:00
parent 49b385af00
commit 1cce358c40

View file

@ -26,8 +26,10 @@ if [ -z "$HOME" ]; then
exit 1 exit 1
fi fi
OS="$(uname -s)"
# macOS support for 10.12.6 or higher # 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 IFS='.' read -r macos_major macos_minor macos_patch << EOF
$(sw_vers -productVersion) $(sw_vers -productVersion)
EOF EOF
@ -39,11 +41,11 @@ EOF
fi fi
# Determine if we could use the multi-user installer or not # 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 echo "Note: a multi-user installation is possible. See https://nix.dev/manual/nix/stable/installation/installing-binary.html#multi-user-installation" >&2
fi fi
case "$(uname -s)" in case "$OS" in
"Darwin") "Darwin")
INSTALL_MODE=daemon;; INSTALL_MODE=daemon;;
*) *)
@ -60,7 +62,7 @@ while [ $# -gt 0 ]; do
ACTION=install ACTION=install
;; ;;
--no-daemon) --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 printf '\e[1;31mError: --no-daemon installs are no-longer supported on Darwin/macOS!\e[0m\n' >&2
exit 1 exit 1
fi fi
@ -167,7 +169,7 @@ for i in $(cd "$self/store" >/dev/null && echo ./*); do
rm -rf "$i_tmp" rm -rf "$i_tmp"
fi fi
if ! [ -e "$dest/store/$i" ]; then if ! [ -e "$dest/store/$i" ]; then
if [ "$(uname -s)" = "Darwin" ]; then if [ "$OS" = "Darwin" ]; then
cp -RPp "$self/store/$i" "$i_tmp" cp -RPp "$self/store/$i" "$i_tmp"
else else
cp -RP --preserve=ownership,timestamps "$self/store/$i" "$i_tmp" cp -RP --preserve=ownership,timestamps "$self/store/$i" "$i_tmp"