From nobody Fri Oct 13 16:20:11 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4S6Wtz6qgsz4wRr5; Fri, 13 Oct 2023 16:20:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S6Wtz68X1z3fTm; Fri, 13 Oct 2023 16:20:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697214011; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UqloKdwC5qcOhjCxjcLcYXjaYQp2MfrdOT2iKaPfYd8=; b=ot1RQLSFPPw0nq6lUWdSoKLv757RzNK3qZ+F699Q/N2Hlv/WIpqR3wQ32e155HuSd2CcrZ tMj4qyTIxBnrn/uOG1RVDd9p4NogpTGxRs5VMTIUZ2skCNUmCiMz5Vg2J84DiME/SHbnY2 1eGWJWggHS0PJDANZTUC/3RTeI6tx+jtOLFkH3T+02+jXJea6rG8AOvz2Gj8BAWq06ofXU AfsHAnBoIoRX0c9LreRcx6Tal+7B2HMhi2lXeTPCy82wypwNn2gtWwMZz/Rg8Ew0kjylYz twyGCk+xMcQas5O+C+ZJyyqit14Q4iOYm9ZuhRsZ3dPxyOGmgXSGP7y/85QzhA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697214011; a=rsa-sha256; cv=none; b=ORtEvPKocqD4xJywglxYdpmrHg3dXATuHfW/ly3QkgZWqp5Xtia1a+NXwU5BJHMCvnSbdt QaaqfZo4T2elmkGn75ifgRoVYP1zkqhb7m7m5VFmNsOKMt2a5xlrXvuIEydZd9jRVdP/rM KmfKAh66JAAK1qgF83FlFqvxgpYTI95F+I/g3Fp0VAcPNWOHQF0DlJodnfa7J/X2S+ZId1 x8hVxRIhTSV1yCR2YUeYNZfW8aff1N0vFiGqPbNgu8HmelE0Peb5ylnid6spa0f2ylweoy EDKBXI0AZpuxVkh/uNGhjwsUFFC4Ji/IUjkCiSm7yzcDW3N+KZFtjtZpyEgf7A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697214011; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UqloKdwC5qcOhjCxjcLcYXjaYQp2MfrdOT2iKaPfYd8=; b=yKn3RqHrQM04Fyh+8EEsE5QQULsGUBFx/e1jc4oi+G1a/AHyEQMUslIWdPFQ2NqEtTunuY BASPT/T3gK56doBDNGtO28fIcnmX3Ndmu4EakiuvJp3/g4DESc5H7YX+Oo3ES1iAE0+pXQ MCO8I4dAPg9ky0wzYv2HT06GNtsgWrpqR8067lam5gx2XCXAej1qo9OjqbfrGUDOHSJVeF N/+4Wy8HT4tMmeh3UgrNJSd+KdkK1FVxtovtHpTE3UnRsvSMcoC1yObfhz9ZZ8zrEfilD9 ZS6yNoBn7y0YP4YI32yug49DBTNVsBzinbW7j/exmeTVQw8rUVHI3RrO56N5cQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4S6Wtz5C81zvR5; Fri, 13 Oct 2023 16:20:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 39DGKBGn071158; Fri, 13 Oct 2023 16:20:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39DGKBon071153; Fri, 13 Oct 2023 16:20:11 GMT (envelope-from git) Date: Fri, 13 Oct 2023 16:20:11 GMT Message-Id: <202310131620.39DGKBon071153@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: a6d202077dee - main - bsdinstall: revisit the finalconfig step List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a6d202077deedcdadc589e10399119d52f7cf71a Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=a6d202077deedcdadc589e10399119d52f7cf71a commit a6d202077deedcdadc589e10399119d52f7cf71a Author: Pierre Pronchery AuthorDate: 2023-10-02 18:28:07 +0000 Commit: Ed Maste CommitDate: 2023-10-13 16:19:39 +0000 bsdinstall: revisit the finalconfig step This moves the "finalconfig" step into a dedicated script, where it uses a loop instead of recursing into itself. Reviewed by: bapt Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D42046 --- usr.sbin/bsdinstall/scripts/Makefile | 1 + usr.sbin/bsdinstall/scripts/auto | 54 +--------------------- usr.sbin/bsdinstall/scripts/finalconfig | 81 +++++++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+), 53 deletions(-) diff --git a/usr.sbin/bsdinstall/scripts/Makefile b/usr.sbin/bsdinstall/scripts/Makefile index 2d226f418783..e4ef00ecba59 100644 --- a/usr.sbin/bsdinstall/scripts/Makefile +++ b/usr.sbin/bsdinstall/scripts/Makefile @@ -7,6 +7,7 @@ SCRIPTS=auto \ docsinstall \ entropy \ fetchmissingdists \ + finalconfig \ hardening \ hostname \ jail \ diff --git a/usr.sbin/bsdinstall/scripts/auto b/usr.sbin/bsdinstall/scripts/auto index 742f319e15ad..9f4b5b52fe5d 100755 --- a/usr.sbin/bsdinstall/scripts/auto +++ b/usr.sbin/bsdinstall/scripts/auto @@ -370,60 +370,8 @@ fi "Would you like to add users to the installed system now?" 0 0 && \ bsdinstall adduser -finalconfig() { - exec 5>&1 - REVISIT=$(bsddialog --backtitle "$OSNAME Installer" \ - --title "Final Configuration" --no-cancel --menu \ - "Setup of your $OSNAME system is nearly complete. You can now modify your configuration choices. After this screen, you will have an opportunity to make more complex changes using a shell." 0 0 0 \ - "Exit" "Apply configuration and exit installer" \ - "Add User" "Add a user to the system" \ - "Root Password" "Change root password" \ - "Hostname" "Set system hostname" \ - "Network" "Networking configuration" \ - "Services" "Set daemons to run on startup" \ - "System Hardening" "Set security options" \ - "Time Zone" "Set system timezone" \ - "Handbook" "Install $OSNAME Handbook (requires network)" 2>&1 1>&5) - exec 5>&- - - case "$REVISIT" in - "Add User") - bsdinstall adduser - finalconfig - ;; - "Root Password") - bsdinstall rootpass - finalconfig - ;; - "Hostname") - bsdinstall hostname - finalconfig - ;; - "Network") - bsdinstall netconfig - finalconfig - ;; - "Services") - bsdinstall services - finalconfig - ;; - "System Hardening") - bsdinstall hardening - finalconfig - ;; - "Time Zone") - bsdinstall time - finalconfig - ;; - "Handbook") - bsdinstall docsinstall - finalconfig - ;; - esac -} - # Allow user to change his mind -[ -z "$BSDINSTALL_SKIP_FINALCONFIG" ] && finalconfig +[ -z "$BSDINSTALL_SKIP_FINALCONFIG" ] && bsdinstall finalconfig trap error SIGINT # SIGINT is bad again bsdinstall config || error "Failed to save config" diff --git a/usr.sbin/bsdinstall/scripts/finalconfig b/usr.sbin/bsdinstall/scripts/finalconfig new file mode 100755 index 000000000000..a1c0d804754f --- /dev/null +++ b/usr.sbin/bsdinstall/scripts/finalconfig @@ -0,0 +1,81 @@ +#!/bin/sh +#- +# Copyright (c) 2011 Nathan Whitehorn +# Copyright (c) 2013-2018 Devin Teske +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ + +BSDCFG_SHARE="/usr/share/bsdconfig" +. $BSDCFG_SHARE/common.subr || exit 1 + +: ${BSDDIALOG_OK=0} + +while true; do + exec 5>&1 + REVISIT=$(bsddialog --backtitle "$OSNAME Installer" \ + --title "Final Configuration" --no-cancel --menu \ + "Setup of your $OSNAME system is nearly complete. You can now modify your configuration choices. After this screen, you will have an opportunity to make more complex changes using a shell." 0 0 0 \ + "Exit" "Apply configuration and exit installer" \ + "Add User" "Add a user to the system" \ + "Root Password" "Change root password" \ + "Hostname" "Set system hostname" \ + "Network" "Networking configuration" \ + "Services" "Set daemons to run on startup" \ + "System Hardening" "Set security options" \ + "Time Zone" "Set system timezone" \ + "Handbook" "Install $OSNAME Handbook (requires network)" 2>&1 1>&5) + retval=$? + exec 5>&- + + case "$REVISIT" in + "Add User") + bsdinstall adduser + ;; + "Root Password") + bsdinstall rootpass + ;; + "Hostname") + bsdinstall hostname + ;; + "Network") + bsdinstall netconfig + ;; + "Services") + bsdinstall services + ;; + "System Hardening") + bsdinstall hardening + ;; + "Time Zone") + bsdinstall time + ;; + "Handbook") + bsdinstall docsinstall + ;; + *) + break + ;; + esac +done