diff --git a/usr.sbin/bsdinstall/scripts/Makefile b/usr.sbin/bsdinstall/scripts/Makefile --- a/usr.sbin/bsdinstall/scripts/Makefile +++ b/usr.sbin/bsdinstall/scripts/Makefile @@ -8,6 +8,7 @@ docsinstall \ entropy \ fetchmissingdists \ + finalconfig \ hardening \ hostname \ jail \ diff --git a/usr.sbin/bsdinstall/scripts/auto b/usr.sbin/bsdinstall/scripts/auto --- a/usr.sbin/bsdinstall/scripts/auto +++ b/usr.sbin/bsdinstall/scripts/auto @@ -371,60 +371,8 @@ "Would you like to add users to the installed system now?" 0 0 && \ bsdinstall adduser -finalconfig() { - exec 3>&1 - REVISIT=$(dialog --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>&3) - exec 3>&- - - 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 --- /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 3>&1 + REVISIT=$(bsddialog --backtitle "$OSNAME Installer" \ + --title "Final Configuration" --cancel-label "Finish" --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 \ + "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>&3) + retval=$? + exec 3>&- + + if [ $retval -ne $BSDDIALOG_OK ]; then + exit 0 + fi + + 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 + ;; + esac +done