OSDN Git Service

Allow setting root and boot partitions before running
authornatemaia <natemaia10@gmail.com>
Fri, 18 Oct 2019 00:19:00 +0000 (17:19 -0700)
committernatemaia <natemaia10@gmail.com>
Fri, 18 Oct 2019 00:19:00 +0000 (17:19 -0700)
archlabs-installer

index 2df1347..fc3a768 100755 (executable)
@@ -1007,6 +1007,7 @@ select_mountpoint()
                        EXMNT=''
                fi
        done
+       msg "Mount Extra" "\nMounting Finished\n\n\nNo extra partitions available to mount, returning to main menu.\n" 2
        return 0
 }
 
@@ -1033,25 +1034,27 @@ select_filesystem()
 
 select_efi_partition()
 {
-       if [[ $AUTO_BOOT_PART ]]; then
-               BOOT_PART="$AUTO_BOOT_PART"
-               return 0 # were done here
-       else
-               local pts size dev isize bsize ptcount=0
-
-               # walk partition list and skip ones that are too small/big for boot
-               while read -r dev size; do
-                       size_t="${size: -1:1}"  # size type eg. K, M, G, T
-                       isize=${size:0:-1}      # remove trailing size type character
-                       isize=${isize%.*}       # remove any decimal (round down)
-                       [[ $size_t =~ [KT] || ($size_t == 'G' && $isize -gt 2) || ($size_t == 'M' && $isize -lt 100) ]] || { pts+="$dev $size "; (( ptcount++ )); }
-               done <<< "$PARTS"
-
-               if (( ptcount == 1 )); then
-                       msg "EFI Boot Partition" "\nOnly one partition available that meets size requirements.\n" 1
-                       BOOT_PART="$(awk 'NF > 0 {print $1}' <<< "$pts")"
+       if [[ -z $BOOT_PART ]]; then
+               if [[ $AUTO_BOOT_PART ]]; then
+                       BOOT_PART="$AUTO_BOOT_PART"
+                       return 0 # were done here
                else
-                       dlg BOOT_PART menu "EFI Partition" "$_uefi" $pts
+                       local pts size dev isize bsize ptcount=0
+
+                       # walk partition list and skip ones that are too small/big for boot
+                       while read -r dev size; do
+                               size_t="${size: -1:1}"  # size type eg. K, M, G, T
+                               isize=${size:0:-1}      # remove trailing size type character
+                               isize=${isize%.*}       # remove any decimal (round down)
+                               [[ $size_t =~ [KT] || ($size_t == 'G' && $isize -gt 2) || ($size_t == 'M' && $isize -lt 100) ]] || { pts+="$dev $size "; (( ptcount++ )); }
+                       done <<< "$PARTS"
+
+                       if (( ptcount == 1 )); then
+                               msg "EFI Boot Partition" "\nOnly one partition available that meets size requirements.\n" 1
+                               BOOT_PART="$(awk 'NF > 0 {print $1}' <<< "$pts")"
+                       else
+                               dlg BOOT_PART menu "EFI Partition" "$_uefi" $pts
+                       fi
                fi
        fi
 
@@ -1071,26 +1074,28 @@ select_efi_partition()
 
 select_boot_partition()
 {
-       if [[ $AUTO_BOOT_PART && ! $LVM ]]; then
-               BOOT_PART="$AUTO_BOOT_PART"
-               return 0 # were done here
-       else
-               local pts size dev isize bsize ptcount=0
-
-               # walk partition list and skip ones that are too small/big for boot
-               while read -r dev size; do
-                       size_t="${size: -1:1}"  # size type eg. K, M, G, T
-                       isize=${size:0:-1}      # remove trailing size type character
-                       isize=${isize%.*}       # remove any decimal (round down)
-                       [[ $size_t =~ [KT] || ($size_t == 'G' && $isize -gt 2) || ($size_t == 'M' && $isize -lt 100) ]] || { pts+="$dev $size "; (( ptcount++ )); }
-               done <<< "$PARTS"
-
-               if [[ $LUKS && ! $LVM ]]; then
-                       dlg BOOT_PART menu "Boot Partition" "$_biosluks" $pts
-                       [[ $BOOT_PART ]] || return 1
+       if [[ -z $BOOT_PART ]]; then
+               if [[ $AUTO_BOOT_PART && ! $LVM ]]; then
+                       BOOT_PART="$AUTO_BOOT_PART"
+                       return 0 # were done here
                else
-                       dlg BOOT_PART menu "Boot Partition" "$_bios" "skip" "don't use a separate boot" $pts
-                       [[ -z $BOOT_PART || $BOOT_PART == "skip" ]] && { BOOT_PART=''; return 0; }
+                       local pts size dev isize bsize ptcount=0
+
+                       # walk partition list and skip ones that are too small/big for boot
+                       while read -r dev size; do
+                               size_t="${size: -1:1}"  # size type eg. K, M, G, T
+                               isize=${size:0:-1}      # remove trailing size type character
+                               isize=${isize%.*}       # remove any decimal (round down)
+                               [[ $size_t =~ [KT] || ($size_t == 'G' && $isize -gt 2) || ($size_t == 'M' && $isize -lt 100) ]] || { pts+="$dev $size "; (( ptcount++ )); }
+                       done <<< "$PARTS"
+
+                       if [[ $LUKS && ! $LVM ]]; then
+                               dlg BOOT_PART menu "Boot Partition" "$_biosluks" $pts
+                               [[ $BOOT_PART ]] || return 1
+                       else
+                               dlg BOOT_PART menu "Boot Partition" "$_bios" "skip" "don't use a separate boot" $pts
+                               [[ -z $BOOT_PART || $BOOT_PART == "skip" ]] && { BOOT_PART=''; return 0; }
+                       fi
                fi
        fi
 
@@ -1107,27 +1112,29 @@ select_boot_partition()
 
 select_root_partition()
 {
-       if [[ $AUTO_ROOT_PART && -z $LVM && -z $LUKS ]]; then
-               ROOT_PART="$AUTO_ROOT_PART"
-               msg "Mount Menu" "\nUsing partitions created during automatic format.\n" 2
-               part_mount "$ROOT_PART" || { ROOT_PART=''; return 1; }
-               return 0  # we're done here
-       else
-               local pts size dev isize bsize ptcount=0
-
-               # walk partition list and skip ones that are too small for / (root)
-               while read -r dev size; do
-                       size_t="${size: -1:1}"  # size type eg. K, M, G, T
-                       isize=${size:0:-1}      # remove trailing size type character
-                       isize=${isize%.*}       # remove any decimal (round down)
-                       [[ $size_t =~ [MK] || ($size_t == 'G' && $isize -lt 4) ]] || { pts+="$dev $size "; (( ptcount++ )); }
-               done <<< "$PARTS"
-
-               if (( ptcount == 1 )); then  # only one available device
-                       msg "Root Partition (/)" "\nOnly one partition available that meets size requirements.\n" 2
-                       ROOT_PART="$(awk 'NF > 0 {print $1}' <<< "$pts")"
+       if [[ -z $ROOT_PART ]]; then
+               if [[ $AUTO_ROOT_PART && -z $LVM && -z $LUKS ]]; then
+                       ROOT_PART="$AUTO_ROOT_PART"
+                       msg "Mount Menu" "\nUsing partitions created during automatic format.\n" 2
+                       part_mount "$ROOT_PART" || { ROOT_PART=''; return 1; }
+                       return 0  # we're done here
                else
-                       dlg ROOT_PART menu "Mount Root" "\nSelect the root (/) partition, this is where $DIST will be installed.\n\nDevices smaller than 8G will not be shown here." $pts
+                       local pts size dev isize bsize ptcount=0
+
+                       # walk partition list and skip ones that are too small for / (root)
+                       while read -r dev size; do
+                               size_t="${size: -1:1}"  # size type eg. K, M, G, T
+                               isize=${size:0:-1}      # remove trailing size type character
+                               isize=${isize%.*}       # remove any decimal (round down)
+                               [[ $size_t =~ [MK] || ($size_t == 'G' && $isize -lt 4) ]] || { pts+="$dev $size "; (( ptcount++ )); }
+                       done <<< "$PARTS"
+
+                       if (( ptcount == 1 )); then  # only one available device
+                               msg "Root Partition (/)" "\nOnly one partition available that meets size requirements.\n" 2
+                               ROOT_PART="$(awk 'NF > 0 {print $1}' <<< "$pts")"
+                       else
+                               dlg ROOT_PART menu "Mount Root" "\nSelect the root (/) partition, this is where $DIST will be installed.\n\nDevices smaller than 8G will not be shown here." $pts
+                       fi
                fi
        fi
 
@@ -1135,7 +1142,6 @@ select_root_partition()
                ROOT_PART=''
                return 1
        fi
-
        return 0
 }
 
@@ -2189,7 +2195,7 @@ usage()
        options:
            -h, --help     print this message and exit
            -l, --live     install and setup a live session
-           -d, --debug    enable debugging and log output to $DBG
+           -d, --debug    enable xtrace and log output to $DBG
 
        sessions:
            i3-gaps  - A fork of i3wm with more features including gaps
@@ -2203,6 +2209,18 @@ usage()
            plasma   - A kde software project currently comprising a full desktop environment
            xfce4    - A lightweight and modular desktop environment based on gtk+2/3
 
+       distro name:
+
+           set the DIST environment variable before launching the installer eg.
+
+                   DIST='MyDistro' $1
+
+       editor used:
+
+           set the EDITOR environment variable before launching the installer eg.
+
+                   EDITOR='nano' $1
+
        EOF
        exit 0
 }