mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
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>
This commit is contained in:
parent
201db94628
commit
bff76fe66a
1 changed files with 14 additions and 10 deletions
|
@ -315,6 +315,19 @@ chk_sys_nscd()
|
||||||
fi
|
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.
|
# Configure substitute discovery according to user's preferences.
|
||||||
# $1 is the installed service file to edit.
|
# $1 is the installed service file to edit.
|
||||||
configure_substitute_discovery() {
|
configure_substitute_discovery() {
|
||||||
|
@ -393,16 +406,6 @@ sys_create_store()
|
||||||
local pkg="$1"
|
local pkg="$1"
|
||||||
local tmp_path="$2"
|
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"
|
cd "$tmp_path"
|
||||||
_msg_info "Installing /var/guix and /gnu..."
|
_msg_info "Installing /var/guix and /gnu..."
|
||||||
# Strip (skip) the leading ‘.’ component, which fails on read-only ‘/’.
|
# Strip (skip) the leading ‘.’ component, which fails on read-only ‘/’.
|
||||||
|
@ -875,6 +878,7 @@ main_install()
|
||||||
chk_gpg_keyring
|
chk_gpg_keyring
|
||||||
chk_sys_arch
|
chk_sys_arch
|
||||||
chk_sys_nscd
|
chk_sys_nscd
|
||||||
|
chk_existing
|
||||||
|
|
||||||
_msg_info "system is ${ARCH_OS}"
|
_msg_info "system is ${ARCH_OS}"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue