When an error occurs don't hide the cursor

This commit is contained in:
natemaia 2020-05-14 21:40:59 -07:00
parent 3c13a7d676
commit 55db41cb73

View File

@ -249,7 +249,7 @@ declare -A EDIT_FILES=(
# mkfs command flags for filesystem formatting { # mkfs command flags for filesystem formatting {
declare -A FS_CMD_FLAGS=( declare -A FS_CMD_FLAGS=(
[btrfs]='-f' [btrfs]='-fq'
[ext2]='-q' [ext2]='-q'
[ext3]='-q' [ext3]='-q'
[ext4]='-q' [ext4]='-q'
@ -1106,7 +1106,9 @@ part_format()
shift 3 shift 3
msg "File System Format" "\nFormatting $part as $fs\n" 0 msg "File System Format" "\nFormatting $part as $fs\n" 0
mkfs.$fs ${FS_CMD_FLAGS[$fs]} "$part" > /dev/null 2> "$ERR" ||
mkfs.$fs ${FS_CMD_FLAGS[$fs]} "$part" > /dev/null 2> "$ERR" mkfs.$fs ${FS_CMD_FLAGS[$fs]} "$part" > /dev/null 2> "$ERR"
errshow 0 "mkfs.$fs ${FS_CMD_FLAGS[$fs]} '$part'" || return 1 errshow 0 "mkfs.$fs ${FS_CMD_FLAGS[$fs]} '$part'" || return 1
sleep "$delay" sleep "$delay"
} }
@ -1469,7 +1471,7 @@ select_filesystem()
local fs='' local fs=''
local cur txt pt local cur txt pt
cur="$(lsblk -lno FSTYPE "$part" 2> /dev/null)" cur="$(lsblk -lno FSTYPE "$part" 2> /dev/null)"
txt="\nSelect which file system to use for $part\n\ndefault: ext4" txt="\nSelect which file system to use for $(part_pretty "$part")\n\ndefault: ext4"
if [[ $cur ]]; then if [[ $cur ]]; then
txt+="\nexisting: $cur" txt+="\nexisting: $cur"
@ -2376,11 +2378,12 @@ prerun_systemd-boot()
btrfs_name() btrfs_name()
{ {
local txt="$1" local txt="$1"
local match="$2" local default="$2"
local match="$3"
SUBVOL='' SUBVOL=''
until [[ $SUBVOL ]]; do until [[ $SUBVOL ]]; do
dlg SUBVOL input "Btrfs Subvolume Name" "$txt" "" || return 1 dlg SUBVOL input "Btrfs Subvolume Name" "$txt" "$default" || return 1
if [[ -z $SUBVOL ]]; then if [[ -z $SUBVOL ]]; then
return 1 return 1
elif [[ $SUBVOL =~ \ |\' || $match == *"$SUBVOL"* || $SUBVOL == "$MVOL" ]]; then elif [[ $SUBVOL =~ \ |\' || $match == *"$SUBVOL"* || $SUBVOL == "$MVOL" ]]; then
@ -2401,7 +2404,7 @@ btrfs_subvols()
local txt="\nEnter a name for the initial subvolume.\n\nOnce mounted other subvolumes created for" local txt="\nEnter a name for the initial subvolume.\n\nOnce mounted other subvolumes created for"
MVOL="" MVOL=""
btrfs_name "$txt ${mntp:-/} will branch from it." "" || return 1 btrfs_name "$txt ${mntp:-/} will branch from it." "root" || return 1
MVOL="$SUBVOL" MVOL="$SUBVOL"
if [[ $mntp ]]; then if [[ $mntp ]]; then
@ -2447,7 +2450,7 @@ btrfs_subvols()
until [[ $SUBVOL == '*' ]]; do until [[ $SUBVOL == '*' ]]; do
local txt="\nEnter a name for subvolume $n within '$MVOL' subvolume." local txt="\nEnter a name for subvolume $n within '$MVOL' subvolume."
txt+="\n\nThis process will be repeated until an asterisk (*) is entered as the subvolume name." txt+="\n\nThis process will be repeated until an asterisk (*) is entered as the subvolume name."
btrfs_name "$txt\n\nCreated subvolumes: ${list:-none}\n" "$list" || return 1 btrfs_name "$txt\n\nCreated subvolumes: ${list:-none}\n" "subvol$n" "$list" || return 1
btrfs subvolume create $SUBVOL > /dev/null 2> "$ERR" btrfs subvolume create $SUBVOL > /dev/null 2> "$ERR"
errshow 0 "btrfs subvolume create $SUBVOL" || return 1 errshow 0 "btrfs subvolume create $SUBVOL" || return 1
(( n++ )) (( n++ ))
@ -3097,19 +3100,22 @@ errshow()
[ $? -eq 0 ] && return 0 [ $? -eq 0 ] && return 0
local fatal=$1 local fatal=$1
shift # always shift off the fatal level arg shift 1 # always shift off the fatal level arg
local txt local txt
txt="\nCommand: $1\n\n\n\nError:\n$(errmsg)\n\n" txt="\nCommand: $1\n\n\n\nError:\n$(errmsg)\n\n"
tput cnorm tput cnorm
if (( fatal )); then if (( fatal )); then
yesno "Install Error" "${txt}Errors at this stage must be fixed before the install can continue.\n$_errchoice" "Handle normally" "Continue, it's fixed" || dialog --backtitle "$DIST Installer - $SYS - v$VER" --title " Install Error " --yes-label "Abort" --no-label "Continue" \
return 0 --yesno "${txt}Errors at this stage must be fixed before the install can continue.\n$_errchoice\n" 0 0 || return 0
[[ -r $DBG && $TERM == 'linux' ]] && less "$DBG" [[ -r $DBG && $TERM == 'linux' ]] && less "$DBG"
die 1 die 1
fi fi
yesno "Install Error" "${txt}Errors at this stage may be fixed or ignored depending on the error.\n$_errchoice" "Handle normally" "Continue, it's fixed" && dialog --backtitle "$DIST Installer - $SYS - v$VER" --title " Install Error " \
--yesno "${txt}Errors at this stage may not be serious depending on the command and error type.\n$_errchoice\n" 0 0
tput civis
return 1 return 1
return 0
} }
prechecks() prechecks()