git: 01ab86f7e6a6 - main - bsdinstall: reset the mirror when restarting

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Fri, 13 Oct 2023 16:33:20 UTC
The branch main has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=01ab86f7e6a6bf540e7c302a7f7b385f20fa4a3f

commit 01ab86f7e6a6bf540e7c302a7f7b385f20fa4a3f
Author:     Pierre Pronchery <pierre@freebsdfoundation.org>
AuthorDate: 2023-10-12 20:34:06 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2023-10-13 16:32:38 +0000

    bsdinstall: reset the mirror when restarting
    
    It is possible to restart the installation process upon errors, when
    installing normally through the `auto` script, or when setting up a jail
    with the `jail` script. However, some values obtained interactively from
    the user or guessed by some scripts are kept in the environment when
    restarting the process; this makes it impossible to run some steps as
    expected after the restart.
    
    For instance, if a bad choice of mirror was made in the `mirrorselect`
    phase, restarting the installer remembers the choice made, and will
    never prompt for a different one. Rebooting is then the only easy way
    out of this situation.
    
    This change only affects the `jail` script for now, as otherwise there
    is no way to tell if the value had been specifically set by the user
    before starting bsdinstall.
    
    Reviewed by:    bapt
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D42183
---
 usr.sbin/bsdinstall/scripts/jail | 1 +
 1 file changed, 1 insertion(+)

diff --git a/usr.sbin/bsdinstall/scripts/jail b/usr.sbin/bsdinstall/scripts/jail
index ab095f44ba39..feb9d8b1c097 100755
--- a/usr.sbin/bsdinstall/scripts/jail
+++ b/usr.sbin/bsdinstall/scripts/jail
@@ -49,6 +49,7 @@ error() {
 	if [ $? -ne $BSDDIALOG_OK ]; then
 		exit
 	else
+		[ -z "$MIRROR_BUTTON" ] || unset BSDINSTALL_DISTSITE
 		exec $0 $BSDINSTALL_CHROOT
 	fi
 }