OSDN Git Service

No longer reboot or shutdown, just exit and let the user handle that step
authornatemaia <natemaia10@gmail.com>
Thu, 8 Nov 2018 09:44:05 +0000 (01:44 -0800)
committernatemaia <natemaia10@gmail.com>
Sun, 17 Mar 2019 04:21:47 +0000 (21:21 -0700)
src/archlabs-installer
src/lib/mount.sh
src/lib/part.sh
src/lib/utils.sh

index 21b4f2f..ca00a19 100755 (executable)
@@ -14,7 +14,7 @@
 # globals {
 
 # immutable values
-readonly VER="1.7.13"        # Installer version
+readonly VER="1.7.14"        # Installer version
 readonly DIST="ArchLabs"     # Linux distributor
 readonly LIVE="liveuser"     # Live session user
 readonly MNT="/mnt/install"  # Install mountpoint
@@ -76,7 +76,7 @@ select_language() {
         8)  src $srcdir/dutch.trans      && LOC="nl_NL.UTF-8" ;;
         9)  src $srcdir/hungarian.trans  && LOC="hu_HU.UTF-8" FONT="lat2-16" ;;
         10) src $srcdir/chinese.trans    && LOC="zh_CN.UTF-8" ;;
-        *)  die 0
+        *)  die
     esac
 
     sed -i "s/#en_US.UTF-8/en_US.UTF-8/" /etc/locale.gen
@@ -546,7 +546,7 @@ edit_system_configs() {
 
     tput civis
     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" \
         --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^}")
 
     if [[ ! $SELECTED || $SELECTED -eq 1 ]]; then
-        [[ $DEBUG == true ]] && { more /tmp/debug-log; die 'shutdown -h now'; }
-        die 'systemctl -i reboot'
+        [[ $DEBUG == true ]] && more /tmp/debug-log
+        die
     else
         local existing_files=""
         for f in $(printf "%s" "${EDIT_FILES[$SELECTED]}"); do
@@ -615,7 +615,7 @@ main() {
         6) configure_system_settings || SELECTED=5 ;;
         7) display_system_settings ;;
         8) install ;;
-        *) yesno "$_CloseInst" "$_CloseInstBody" "Exit" "Back" && die 0
+        *) yesno "$_CloseInst" "$_CloseInstBody" "Exit" "Back" && die
     esac
 }
 
index 038a7b5..ee88e19 100644 (file)
@@ -40,13 +40,6 @@ mount_install_partitions() {
     return 0
 }
 
-unmount_install_partitions() {
-    swapoff -a
-    if [[ -d $MNT ]]; then
-        umount -R $MNT # >/dev/null 2>&1
-    fi
-}
-
 select_swap() {
     # Ask user to select partition or create swapfile
     tput civis
index 0c29c95..2cc9e9a 100644 (file)
@@ -115,10 +115,8 @@ select_device() {
             --menu "${msg}$_DevSelBody" 0 0 0 $SYS_DEVS)"; then
             return 1
         fi
-    else
-        msg="\nNo available devices to use$([[ $1 == 'boot' ]] && printf " for bootloader")."
-        msgbox "$_ErrTitle" "$msg\n$_Exit"
-        die 1
+    elif [[ $DEV_COUNT -lt 1 && $1 != 'boot' ]]; then
+        msgbox "$_ErrTitle" "\nNo available devices to use.\n$_Exit"; die 1
     fi
 
     # if the device selected was for bootloader, set the BOOT_DEVICE
index b4c08e0..65c3fc4 100644 (file)
@@ -29,16 +29,9 @@ ssd() {
 }
 
 die() {
-    tput cnorm
-    if [[ -d $MNT ]] && cd; then
-        fuser -km $MNT
-        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
+    local exitcode=0
+    (( $# == 0 )) || exitcode=$1
+    tput cnorm; unmount_install_partitions; exit $exitcode
 }
 
 sigint() {
@@ -154,6 +147,8 @@ checks() {
                 infobox "$_ErrTitle" "$_NoNetwork" 3
             fi
         fi
+    else
+        export HAS_NETWORK=true
     fi
     return 0
 }
@@ -173,9 +168,9 @@ echeck() {
     msg="$([[ $err == "" ]] && printf "%s" "$msg")\n$_ErrChoice"
     if [[ -e /tmp/debug-log && $TERM == 'linux' ]]; then
         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
-        yesno "$_ErrTitle" "$msg" "Exit & Shutdown" "Ignore & Continue" && die 'shutdown -h now'
+        yesno "$_ErrTitle" "$msg" "Exit" "Ignore & Continue" && die
     fi
     return 0
 }
@@ -214,3 +209,9 @@ debug() {
     fi
     export DEBUG=true
 }
+
+unmount_install_partitions() {
+    swapoff -a
+    [[ -d $MNT ]] && umount -R $MNT >/dev/null 2>&1
+    return 0
+}