Changeset View
Changeset View
Standalone View
Standalone View
head/usr.sbin/bsdinstall/scripts/auto
Show All 25 Lines | |||||
# SUCH DAMAGE. | # SUCH DAMAGE. | ||||
# | # | ||||
# $FreeBSD$ | # $FreeBSD$ | ||||
# | # | ||||
############################################################ INCLUDES | ############################################################ INCLUDES | ||||
BSDCFG_SHARE="/usr/share/bsdconfig" | BSDCFG_SHARE="/usr/share/bsdconfig" | ||||
. $BSDCFG_SHARE/common.subr || exit 1 | . $BSDCFG_SHARE/common.subr || exit 1 | ||||
f_include $BSDCFG_SHARE/dialog.subr | |||||
############################################################ FUNCTIONS | ############################################################ FUNCTIONS | ||||
error() { | error() { | ||||
local msg | local msg | ||||
if [ -n "$1" ]; then | if [ -n "$1" ]; then | ||||
msg="$1\n\n" | msg="$1\n\n" | ||||
fi | fi | ||||
test -n "$DISTDIR_IS_UNIONFS" && umount -f $BSDINSTALL_DISTDIR | test -n "$DISTDIR_IS_UNIONFS" && umount -f $BSDINSTALL_DISTDIR | ||||
test -f $PATH_FSTAB && bsdinstall umount | test -f $PATH_FSTAB && bsdinstall umount | ||||
dialog --backtitle "FreeBSD Installer" --title "Abort" \ | dialog --backtitle "FreeBSD Installer" --title "Abort" \ | ||||
--no-label "Exit" --yes-label "Restart" --yesno \ | --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 | "${msg}An installation step has been aborted. Would you like to restart the installation or exit the installer?" 0 0 | ||||
if [ $? -ne 0 ]; then | if [ $? -ne 0 ]; then | ||||
exit 1 | exit 1 | ||||
else | else | ||||
exec $0 | exec $0 | ||||
fi | 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 | ############################################################ MAIN | ||||
f_dprintf "Began Installation at %s" "$( date )" | f_dprintf "Began Installation at %s" "$( date )" | ||||
rm -rf $BSDINSTALL_TMPETC | rm -rf $BSDINSTALL_TMPETC | ||||
mkdir $BSDINSTALL_TMPETC | mkdir $BSDINSTALL_TMPETC | ||||
trap true SIGINT # This section is optional | trap true SIGINT # This section is optional | ||||
Show All 38 Lines | if [ -n "$FETCH_DISTRIBUTIONS" ]; then | ||||
MIRROR_BUTTON=$? | MIRROR_BUTTON=$? | ||||
exec 3>&- | exec 3>&- | ||||
test $MIRROR_BUTTON -eq 0 || error "No mirror selected" | test $MIRROR_BUTTON -eq 0 || error "No mirror selected" | ||||
export BSDINSTALL_DISTSITE | export BSDINSTALL_DISTSITE | ||||
fi | fi | ||||
rm -f $PATH_FSTAB | rm -f $PATH_FSTAB | ||||
touch $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="\ | PMODES="\ | ||||
\"Auto (UFS)\" \"Guided Disk Setup\" \ | \"Auto (UFS)\" \"Guided Disk Setup\" \ | ||||
Manual \"Manual Disk Setup (experts)\" \ | Manual \"Manual Disk Setup (experts)\" \ | ||||
Shell \"Open a shell and partition by hand\"" | Shell \"Open a shell and partition by hand\"" | ||||
CURARCH=$( uname -m ) | CURARCH=$( uname -m ) | ||||
case $CURARCH in | case $CURARCH in | ||||
▲ Show 20 Lines • Show All 157 Lines • Show Last 20 Lines |