diff options
author | allanjude <allanjude@FreeBSD.org> | 2015-07-21 21:12:28 +0000 |
---|---|---|
committer | allanjude <allanjude@FreeBSD.org> | 2015-07-21 21:12:28 +0000 |
commit | c704c25de7018b5f7a16bfc4d7fd7092ed45bd57 (patch) | |
tree | 989b009e971d4f998232ea8ddc3e49363143336a /usr.sbin/bsdinstall/scripts/auto | |
parent | e21e1ce19873fa20e6000ebf8aae28a23060982a (diff) | |
download | FreeBSD-src-c704c25de7018b5f7a16bfc4d7fd7092ed45bd57.zip FreeBSD-src-c704c25de7018b5f7a16bfc4d7fd7092ed45bd57.tar.gz |
MFC: r285679
Add auto-detecting workaround for Lenovo GPT boot issue
Add auto-detecting workaround for "GPT Active" boot issue
Allow user to select partitioning scheme in the ufs wizard
PR: 184910
PR: 194359
Approved by: re (gjb), marcel
Relnotes: yes
Sponsored by: ScaleEngine Inc.
Differential Revision: https://reviews.freebsd.org/D3144
Diffstat (limited to 'usr.sbin/bsdinstall/scripts/auto')
-rwxr-xr-x | usr.sbin/bsdinstall/scripts/auto | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/usr.sbin/bsdinstall/scripts/auto b/usr.sbin/bsdinstall/scripts/auto index 433744e..62b9bd0 100755 --- a/usr.sbin/bsdinstall/scripts/auto +++ b/usr.sbin/bsdinstall/scripts/auto @@ -31,6 +31,7 @@ BSDCFG_SHARE="/usr/share/bsdconfig" . $BSDCFG_SHARE/common.subr || exit 1 +f_include $BSDCFG_SHARE/dialog.subr ############################################################ FUNCTIONS @@ -51,6 +52,54 @@ error() { fi } +hline_arrows_tab_enter="Press arrows, TAB or ENTER" +msg_gpt_active_fix="Your hardware is known to have issues booting in 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_no="NO" +msg_yes="YES" + +# dialog_workaround +# +# Ask the user if they wish to apply a workaround +# +dialog_workaround() +{ + local passed_msg="$1" + local title="$DIALOG_TITLE" + local btitle="$DIALOG_BACKTITLE" + local prompt # Calculated below + local hline="$hline_arrows_tab_enter" + + local height=8 width=50 prefix=" " + local plen=${#prefix} list= line= + local max_width=$(( $width - 3 - $plen )) + + local yes no defaultno extra_args format + if [ "$USE_XDIALOG" ]; then + yes=ok no=cancel defaultno=default-no + extra_args="--wrap --left" + format="$passed_msg" + else + yes=yes no=no defaultno=defaultno + extra_args="--cr-wrap" + format="$passed_msg" + fi + + # Add height for Xdialog(1) + [ "$USE_XDIALOG" ] && height=$(( $height + $height / 5 + 3 )) + + prompt=$( printf "$format" ) + f_dprintf "%s: Workaround prompt" "$0" + $DIALOG \ + --title "$title" \ + --backtitle "$btitle" \ + --hline "$hline" \ + --$yes-label "$msg_yes" \ + --$no-label "$msg_no" \ + $extra_args \ + --yesno "$prompt" $height $width +} + ############################################################ MAIN f_dprintf "Began Installation at %s" "$( date )" @@ -106,6 +155,47 @@ fi rm -f $PATH_FSTAB touch $PATH_FSTAB +# +# Try to detect known broken platforms and apply their workarounds +# + +if f_interactive; then + sys_maker=$( kenv -q smbios.system.maker ) + f_dprintf "smbios.system.maker=[%s]" "$sys_maker" + sys_model=$( kenv -q smbios.system.product ) + f_dprintf "smbios.system.product=[%s]" "$sys_model" + sys_version=$( kenv -q smbios.system.version ) + f_dprintf "smbios.system.version=[%s]" "$sys_version" + case "$sys_maker" in + "LENOVO") + case "$sys_version" in + "ThinkPad X220"|"ThinkPad T420"|"ThinkPad T520") + dialog_workaround "$msg_lenovo_fix" + retval=$? + f_dprintf "lenovofix_prompt=[%s]" "$retval" + if [ $retval -eq $DIALOG_OK ]; then + export ZFSBOOT_PARTITION_SCHEME="GPT + Lenovo Fix" + export WORKAROUND_LENOVO=1 + fi + ;; + esac + ;; + "Dell Inc.") + case "$sys_model" in + "Latitude E7440") + dialog_workaround "$msg_gpt_active_fix" + retval=$? + f_dprintf "gpt_active_fix_prompt=[%s]" "$retval" + if [ $retval -eq $DIALOG_OK ]; then + export ZFSBOOT_PARTITION_SCHEME="GPT + Active" + export WORKAROUND_GPTACTIVE=1 + fi + ;; + esac + ;; + esac +fi + PMODES="\ \"Auto (UFS)\" \"Guided Disk Setup\" \ Manual \"Manual Disk Setup (experts)\" \ |