From owner-svn-src-all@FreeBSD.ORG Tue May 5 03:08:50 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2E47E824; Tue, 5 May 2015 03:08:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0F6CC1D78; Tue, 5 May 2015 03:08:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4538nrH077733; Tue, 5 May 2015 03:08:49 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4538n3j077732; Tue, 5 May 2015 03:08:49 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201505050308.t4538n3j077732@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Tue, 5 May 2015 03:08:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r282443 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 May 2015 03:08:50 -0000 Author: allanjude (doc committer) Date: Tue May 5 03:08:49 2015 New Revision: 282443 URL: https://svnweb.freebsd.org/changeset/base/282443 Log: Add a sanity check to the swap size in zfsboot of bsdinstall Loop until the user enters a valid size (>100mb or 0) Differential Revision: https://reviews.freebsd.org/D2299 Reported By: Shawn Webb Reviewed by: roberto Approved by: brd MFC after: 2 weeks Sponsored by: ScaleEngine Inc. Modified: head/usr.sbin/bsdinstall/scripts/zfsboot Modified: head/usr.sbin/bsdinstall/scripts/zfsboot ============================================================================== --- head/usr.sbin/bsdinstall/scripts/zfsboot Tue May 5 01:45:38 2015 (r282442) +++ head/usr.sbin/bsdinstall/scripts/zfsboot Tue May 5 03:08:49 2015 (r282443) @@ -287,10 +287,12 @@ msg_stripe_desc="Stripe - No Redundancy" msg_stripe_help="[1+ Disks] Striping provides maximum storage but no redundancy" msg_swap_encrypt="Encrypt Swap?" msg_swap_encrypt_help="Encrypt swap partitions with temporary keys, discarded on reboot" +msg_swap_invalid="The selected swap size (%s) is invalid. Enter a number optionally followed by units. Example: 2G" msg_swap_mirror="Mirror Swap?" msg_swap_mirror_help="Mirror swap partitions for redundancy, breaks crash dumps" msg_swap_size="Swap Size" msg_swap_size_help="Customize how much swap space is allocated to each selected disk" +msg_swap_toosmall="The selected swap size (%s) is to small. Please enter a value greater than 100MB or enter 0 for no swap" msg_these_disks_are_too_small="These disks are too small given the amount of requested\nswap (%s) and/or geli(8) (%s) partitions, which would\ntake 50%% or more of each of the following selected disk\ndevices (not recommended):\n\n %s\n\nRecommend changing partition size(s) and/or selecting a\ndifferent set of devices." msg_uefi_not_supported="The FreeBSD UEFI loader does not currently support booting root-on-ZFS. Your system will need to boot in legacy (CSM) mode.\nDo you want to continue?" msg_unable_to_get_disk_capacity="Unable to get disk capacity of \`%s'" @@ -1557,10 +1559,26 @@ while :; do ;; ?" $msg_swap_size") # Prompt the user to input/change the swap size for each disk - f_dialog_input input \ - "$msg_please_enter_amount_of_swap_space" \ - "$ZFSBOOT_SWAP_SIZE" && - ZFSBOOT_SWAP_SIZE="${input:-0}" + while :; do + f_dialog_input input \ + "$msg_please_enter_amount_of_swap_space" \ + "$ZFSBOOT_SWAP_SIZE" && + ZFSBOOT_SWAP_SIZE="${input:-0}" + if f_expand_number "$ZFSBOOT_SWAP_SIZE" swapsize + then + if [ $swapsize -ne 0 -a $swapsize -lt 104857600 ]; then + f_show_err "$msg_swap_toosmall" \ + "$ZFSBOOT_SWAP_SIZE" + continue; + else + break; + fi + else + f_show_err "$msg_swap_invalid" \ + "$ZFSBOOT_SWAP_SIZE" + continue; + fi + done ;; ?" $msg_swap_mirror") # Toggle the variable referenced both by the menu and later