From owner-svn-src-head@freebsd.org Fri Oct 26 02:08:45 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5A63210D2094; Fri, 26 Oct 2018 02:08:45 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 08C047D893; Fri, 26 Oct 2018 02:08:45 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DBA3D1A714; Fri, 26 Oct 2018 02:08:44 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9Q28iNb004379; Fri, 26 Oct 2018 02:08:44 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9Q28iNh004378; Fri, 26 Oct 2018 02:08:44 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201810260208.w9Q28iNh004378@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Fri, 26 Oct 2018 02:08:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r339760 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head X-SVN-Commit-Author: dteske X-SVN-Commit-Paths: head/usr.sbin/bsdinstall/scripts X-SVN-Commit-Revision: 339760 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Oct 2018 02:08:45 -0000 Author: dteske Date: Fri Oct 26 02:08:44 2018 New Revision: 339760 URL: https://svnweb.freebsd.org/changeset/base/339760 Log: Fix dialog autosizing in bsdinstall auto error messages Sponsored by: Smule, Inc. Modified: head/usr.sbin/bsdinstall/scripts/auto Modified: head/usr.sbin/bsdinstall/scripts/auto ============================================================================== --- head/usr.sbin/bsdinstall/scripts/auto Fri Oct 26 01:57:32 2018 (r339759) +++ head/usr.sbin/bsdinstall/scripts/auto Fri Oct 26 02:08:44 2018 (r339760) @@ -1,7 +1,7 @@ #!/bin/sh #- # Copyright (c) 2011 Nathan Whitehorn -# Copyright (c) 2013 Devin Teske +# Copyright (c) 2013-2018 Devin Teske # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -33,30 +33,58 @@ BSDCFG_SHARE="/usr/share/bsdconfig" . $BSDCFG_SHARE/common.subr || exit 1 f_include $BSDCFG_SHARE/dialog.subr -############################################################ FUNCTIONS +############################################################ GLOBALS -error() { - local msg - if [ -n "$1" ]; then - msg="$1\n\n" - fi - test -n "$DISTDIR_IS_UNIONFS" && umount -f $BSDINSTALL_DISTDIR - test -f $PATH_FSTAB && bsdinstall umount - dialog --backtitle "FreeBSD Installer" --title "Abort" \ - --no-label "Exit" --yes-label "Restart" --yesno \ - "${msg}An installation step has been aborted. Would you like to restart the installation or exit the installer?" 0 0 - if [ $? -ne 0 ]; then - exit 1 - else - exec $0 - fi -} - +# +# Strings that should be moved to an i18n file and loaded with f_include_lang() +# hline_arrows_tab_enter="Press arrows, TAB or ENTER" +hline_arrows_tab_space_enter="Press arrows, TAB, SPACE or ENTER" +msg_abort="Abort" +msg_exit="Exit" +msg_freebsd_installer="FreeBSD Installer" msg_gpt_active_fix="Your hardware is known to have issues booting in CSM/Legacy/BIOS mode from GPT partitions that are not set active. Would you like the installer to apply this workaround for you?" msg_lenovo_fix="Your model of Lenovo is known to have a BIOS bug that prevents it booting from GPT partitions without UEFI. Would you like the installer to apply a workaround for you?" +msg_an_installation_step_has_been_aborted="An installation step has been aborted. Would you like\nto restart the installation or exit the installer?" msg_no="NO" +msg_restart="Restart" msg_yes="YES" + +############################################################ FUNCTIONS + +# error [$msg] +# +# Display generic error message when a script fails. An optional message +# argument can preceed the generic message. User is given the choice of +# restarting the installer or exiting. +# +error() +{ + local title="$msg_abort" + local btitle="$msg_freebsd_installer" + local prompt="${1:+$1\n\n}$msg_an_installation_step_has_been_aborted" + local hline="$hline_arrows_tab_space_enter" + + [ "$DISTDIR_IS_UNIONFS" ] && umount -f "$BSDINSTALL_DISTDIR" + [ -f "$PATH_FSTAB" ] && bsdinstall umount + + local height width + f_dialog_buttonbox_size height width \ + "$title" "$btitle" "$prompt" "$hline" + + if $DIALOG \ + --title "$title" \ + --backtitle "$btitle" \ + --hline "$hline" \ + --no-label "$msg_exit" \ + --yes-label "$msg_restart" \ + --yesno "$prompt" $height $width + then + exec $0 + # NOTREACHED + fi + exit 1 +} # dialog_workaround #