aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiam Hupfer <liam@hpfr.net>2025-02-05 22:25:05 -0600
committerLudovic Courtès <ludo@gnu.org>2025-02-21 15:27:11 +0100
commitbff76fe66abd83d4986a758731dad404c40e2ca3 (patch)
tree45d2709fb8368e486e3e004b65043f82fbc63e58
parent201db94628ea044b720ab4916d19eda022a4d6e7 (diff)
downloadguix-bff76fe66abd83d4986a758731dad404c40e2ca3.tar.gz
guix-bff76fe66abd83d4986a758731dad404c40e2ca3.zip
guix-install.sh: Check for existing installation before downloading.
Previously, the check came after guix_get_bin. There’s no need to fetch the rather large release archive if there’s an existing installation, so check first. Refactor the check into a function similar to other preflight checks. * etc/guix-install.sh: Check for existing installation before downloading. Change-Id: I5506fb1cacdc88bd6355e8dfa1f690acf7886c1f Signed-off-by: Ludovic Courtès <ludo@gnu.org>
-rwxr-xr-xetc/guix-install.sh24
1 files changed, 14 insertions, 10 deletions
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 7a731962b3..297a726ad6 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -315,6 +315,19 @@ chk_sys_nscd()
fi
}
+chk_existing()
+{ # Avoid clobbering existing installations.
+ _debug "--- [ ${FUNCNAME[0]} ] ---"
+
+ if [[ -e /var/guix && -e /gnu ]]; then
+ if [ -n "$GUIX_ALLOW_OVERWRITE" ]; then
+ _msg_warn "Overwriting existing installation!"
+ else
+ die "A previous Guix installation was found. Refusing to overwrite."
+ fi
+ fi
+}
+
# Configure substitute discovery according to user's preferences.
# $1 is the installed service file to edit.
configure_substitute_discovery() {
@@ -393,16 +406,6 @@ sys_create_store()
local pkg="$1"
local tmp_path="$2"
- _debug "--- [ ${FUNCNAME[0]} ] ---"
-
- if [[ -e /var/guix && -e /gnu ]]; then
- if [ -n "$GUIX_ALLOW_OVERWRITE" ]; then
- _msg_warn "Overwriting existing installation!"
- else
- die "A previous Guix installation was found. Refusing to overwrite."
- fi
- fi
-
cd "$tmp_path"
_msg_info "Installing /var/guix and /gnu..."
# Strip (skip) the leading ‘.’ component, which fails on read-only ‘/’.
@@ -875,6 +878,7 @@ main_install()
chk_gpg_keyring
chk_sys_arch
chk_sys_nscd
+ chk_existing
_msg_info "system is ${ARCH_OS}"