No longer reboot or shutdown, just exit and let the user handle that step

This commit is contained in:
natemaia 2018-11-08 01:44:05 -08:00
parent 3d41c04f36
commit a37423ff21
4 changed files with 21 additions and 29 deletions

View File

@ -14,7 +14,7 @@
# globals { # globals {
# immutable values # immutable values
readonly VER="1.7.13" # Installer version readonly VER="1.7.14" # Installer version
readonly DIST="ArchLabs" # Linux distributor readonly DIST="ArchLabs" # Linux distributor
readonly LIVE="liveuser" # Live session user readonly LIVE="liveuser" # Live session user
readonly MNT="/mnt/install" # Install mountpoint readonly MNT="/mnt/install" # Install mountpoint
@ -76,7 +76,7 @@ select_language() {
8) src $srcdir/dutch.trans && LOC="nl_NL.UTF-8" ;; 8) src $srcdir/dutch.trans && LOC="nl_NL.UTF-8" ;;
9) src $srcdir/hungarian.trans && LOC="hu_HU.UTF-8" FONT="lat2-16" ;; 9) src $srcdir/hungarian.trans && LOC="hu_HU.UTF-8" FONT="lat2-16" ;;
10) src $srcdir/chinese.trans && LOC="zh_CN.UTF-8" ;; 10) src $srcdir/chinese.trans && LOC="zh_CN.UTF-8" ;;
*) die 0 *) die
esac esac
sed -i "s/#en_US.UTF-8/en_US.UTF-8/" /etc/locale.gen sed -i "s/#en_US.UTF-8/en_US.UTF-8/" /etc/locale.gen
@ -546,7 +546,7 @@ edit_system_configs() {
tput civis tput civis
local exitstr local exitstr
[[ $DEBUG == true ]] && exitstr="View Log & Shutdown" || exitstr="Exit & Reboot" [[ $DEBUG == true ]] && exitstr="View Log & Exit" || exitstr="Exit"
SELECTED=$(dialog --cr-wrap --stdout --backtitle "$BT" \ SELECTED=$(dialog --cr-wrap --stdout --backtitle "$BT" \
--title " $_EditTitle " --default-item $SELECTED --menu "$_EditBody" 0 0 0 \ --title " $_EditTitle " --default-item $SELECTED --menu "$_EditBody" 0 0 0 \
@ -555,8 +555,8 @@ edit_system_configs() {
"9" "${BOOTLDR^}" "10" "Pacman.conf" "11" "${LOGIN_TYPE^}") "9" "${BOOTLDR^}" "10" "Pacman.conf" "11" "${LOGIN_TYPE^}")
if [[ ! $SELECTED || $SELECTED -eq 1 ]]; then if [[ ! $SELECTED || $SELECTED -eq 1 ]]; then
[[ $DEBUG == true ]] && { more /tmp/debug-log; die 'shutdown -h now'; } [[ $DEBUG == true ]] && more /tmp/debug-log
die 'systemctl -i reboot' die
else else
local existing_files="" local existing_files=""
for f in $(printf "%s" "${EDIT_FILES[$SELECTED]}"); do for f in $(printf "%s" "${EDIT_FILES[$SELECTED]}"); do
@ -615,7 +615,7 @@ main() {
6) configure_system_settings || SELECTED=5 ;; 6) configure_system_settings || SELECTED=5 ;;
7) display_system_settings ;; 7) display_system_settings ;;
8) install ;; 8) install ;;
*) yesno "$_CloseInst" "$_CloseInstBody" "Exit" "Back" && die 0 *) yesno "$_CloseInst" "$_CloseInstBody" "Exit" "Back" && die
esac esac
} }

View File

@ -40,13 +40,6 @@ mount_install_partitions() {
return 0 return 0
} }
unmount_install_partitions() {
swapoff -a
if [[ -d $MNT ]]; then
umount -R $MNT # >/dev/null 2>&1
fi
}
select_swap() { select_swap() {
# Ask user to select partition or create swapfile # Ask user to select partition or create swapfile
tput civis tput civis

View File

@ -115,10 +115,8 @@ select_device() {
--menu "${msg}$_DevSelBody" 0 0 0 $SYS_DEVS)"; then --menu "${msg}$_DevSelBody" 0 0 0 $SYS_DEVS)"; then
return 1 return 1
fi fi
else elif [[ $DEV_COUNT -lt 1 && $1 != 'boot' ]]; then
msg="\nNo available devices to use$([[ $1 == 'boot' ]] && printf " for bootloader")." msgbox "$_ErrTitle" "\nNo available devices to use.\n$_Exit"; die 1
msgbox "$_ErrTitle" "$msg\n$_Exit"
die 1
fi fi
# if the device selected was for bootloader, set the BOOT_DEVICE # if the device selected was for bootloader, set the BOOT_DEVICE

View File

@ -29,16 +29,9 @@ ssd() {
} }
die() { die() {
tput cnorm local exitcode=0
if [[ -d $MNT ]] && cd; then (( $# == 0 )) || exitcode=$1
fuser -km $MNT tput cnorm; unmount_install_partitions; exit $exitcode
unmount_install_partitions
if ! [[ $1 =~ [0-9] ]]; then
fuser -km /run/archiso/bootmnt
umount -l /run/archiso/bootmnt
fi
fi
[[ $1 =~ [0-9] ]] && exit $1 || $1
} }
sigint() { sigint() {
@ -154,6 +147,8 @@ checks() {
infobox "$_ErrTitle" "$_NoNetwork" 3 infobox "$_ErrTitle" "$_NoNetwork" 3
fi fi
fi fi
else
export HAS_NETWORK=true
fi fi
return 0 return 0
} }
@ -173,9 +168,9 @@ echeck() {
msg="$([[ $err == "" ]] && printf "%s" "$msg")\n$_ErrChoice" msg="$([[ $err == "" ]] && printf "%s" "$msg")\n$_ErrChoice"
if [[ -e /tmp/debug-log && $TERM == 'linux' ]]; then if [[ -e /tmp/debug-log && $TERM == 'linux' ]]; then
msg="$([[ $err == "" ]] && printf "%s" "$msg")\n$_ErrChoiceConsole" msg="$([[ $err == "" ]] && printf "%s" "$msg")\n$_ErrChoiceConsole"
yesno "$_ErrTitle" "$msg" "Exit & Open Log" "Ignore & Continue" && { more /tmp/debug-log; die 0; } yesno "$_ErrTitle" "$msg" "Exit & Open Log" "Ignore & Continue" && { more /tmp/debug-log; die; }
else else
yesno "$_ErrTitle" "$msg" "Exit & Shutdown" "Ignore & Continue" && die 'shutdown -h now' yesno "$_ErrTitle" "$msg" "Exit" "Ignore & Continue" && die
fi fi
return 0 return 0
} }
@ -214,3 +209,9 @@ debug() {
fi fi
export DEBUG=true export DEBUG=true
} }
unmount_install_partitions() {
swapoff -a
[[ -d $MNT ]] && umount -R $MNT >/dev/null 2>&1
return 0
}