OSDN Git Service

Reorder main menu so show is last.
[pacbang-linux/installer-arch.git] / archlabs-installer
index 4fcbca7..1904d82 100755 (executable)
@@ -8,7 +8,7 @@
 # check for syntax errors
 # set -n
 
-VER=2.0.94
+VER=2.0.95
 
 # default values {
 
@@ -190,8 +190,8 @@ main()
                8 "* System configuration" \
                9 "Select window manager or desktop" \
                10 "Select additional packages" \
-               11 "View configuration selections" \
-               12 "Run a command on the installed system" \
+               11 "Run a command on the installed system" \
+               12 "View configuration and command selections" \
                13 "* Confirm choices and start the installation" 2> "$ANS"
 
        read -r SEL < "$ANS"
@@ -207,8 +207,8 @@ main()
                8) prechecks 2 && { select_config || (( SEL-- )); } ;;
                9) prechecks 3 && { select_sessions || (( SEL-- )); } ;;
                10) prechecks 3 && { select_packages || (( SEL-- )); } ;;
-               11) prechecks 3 && select_show ;;
-               12) prechecks 3 && select_usercmd ;;
+               11) prechecks 3 && select_usercmd ;;
+               12) prechecks 3 && select_show ;;
                13) prechecks 3 && install_main ;;
                *) yesno "Exit" "\nUnmount partitions (if any) and exit the installer?\n" && die 0
        esac
@@ -257,6 +257,8 @@ select_show()
   Hostname: ${MYHOST:-none}
   Timezone: ${ZONE:-none}/${SUBZ:-none}
 
+  Chroot cmd: ${USER_CMD:-none}
+
 ------------ USER CONFIGURATION ---------------
 
   Username:      ${NEWUSER:-none}
@@ -285,8 +287,8 @@ select_login()
                "sddm"    "Simple desktop display manager" || return 1
 
        case $LOGIN_TYPE in
-               ly) EDIT_FILES[login]="/etc/ly/config.ini" ;;
                gdm|sddm) EDIT_FILES[login]="" ;;
+               ly) EDIT_FILES[login]="/etc/ly/config.ini" ;;
                lightdm) EDIT_FILES[login]="/etc/lightdm/lightdm.conf /etc/lightdm/lightdm-gtk-greeter.conf" ;;
                xinit) EDIT_FILES[login]="/home/$NEWUSER/.xinitrc /home/$NEWUSER/.xprofile"
                        if (( $(wc -w <<< "$INSTALL_WMS") > 1 )); then
@@ -574,11 +576,11 @@ part_menu()
                choice=""
                dlg choice menu "Edit Partitions" "$_part\n\n$(lsblk -no NAME,MODEL,SIZE,TYPE,FSTYPE $device)" \
                        "auto"   "Whole device automatic partitioning" \
-                       "shrink" "Shrink an existing ext or ntfs partition" \
                        "cfdisk" "Curses based variant of fdisk" \
                        "parted" "GNU partition editor" \
                        "fdisk"  "Dialog-driven creation and manipulation of partitions" \
                        "done"   "Return to the main menu"
+                       # "shrink" "Shrink an existing ext or ntfs partition" \
 
                if [[ -z $choice || $choice == 'done' ]]; then
                        return 0
@@ -733,6 +735,7 @@ part_shrink()
 part_find()
 {
        local regexp="$1" err=''
+       local pts dev size isize ptcount=0
 
        # string of partitions as /TYPE/PART SIZE.. eg. /dev/sda1 256G
        if [[ $IGNORE_DEV ]]; then
@@ -743,10 +746,19 @@ part_find()
 
        # ensure we have enough partitions for the system and action were trying to do
        COUNT=$(wc -l <<< "$PARTS")
+
+       while read -r dev size; do  # walk partition list and skip ones that are too small
+               [[ $dev && $size ]] || continue
+               size_t="${size: -1:1}"
+               isize=${size:0:-1}
+               isize=${isize%.*}
+               [[ $size_t == 'K' || ($size_t == 'M' && $isize -lt 100) ]] || { pts+="$dev $size "; (( ptcount++ )); }
+       done <<< "$PARTS"
+
        case "$regexp" in
-               'part|lvm|crypt') [[ $COUNT -lt 1 || ($SYS == 'UEFI' && $COUNT -lt 2) ]] && err="$_errpart" ;;
-               'part|crypt') (( COUNT < 1 )) && err="$_lvmerr" ;;
-               'part|lvm') (( COUNT < 2 )) && err="$_lukserr" ;;
+               'part|lvm|crypt') [[ $ptcount -lt 1 || ($SYS == 'UEFI' && $COUNT -lt 2) ]] && err="$_errpart" ;;
+               'part|crypt') (( ptcount < 1 )) && err="$_lvmerr" ;;
+               'part|lvm') (( ptcount < 2 )) && err="$_lukserr" ;;
        esac
 
        if [[ $err ]]; then
@@ -907,6 +919,7 @@ part_mountconf()
 
 mount_menu()
 {
+       msg "Mount Menu" "\nGathering device and partition information.\n" 0
        no_bg_install || return 0
        lvm_detect
        umount_dir "$MNT"
@@ -1869,17 +1882,14 @@ lvm_menu()
 
 lvm_detect()
 {
-       local v pv
-       pv="$(pvs -o pv_name --noheading 2> /dev/null)"
-       v="$(lvs -o vg_name,lv_name --noheading --separator - 2> /dev/null)"
-       VGROUP="$(vgs -o vg_name --noheading 2> /dev/null)"
-
-       if [[ $VGROUP && $v && $pv ]]; then
-               msg "LVM Setup" "\nActivating existing logical volume management.\n" 0
-               modprobe dm-mod > /dev/null 2> "$ERR"
-               errshow 'modprobe dm-mod'
-               vgscan > /dev/null 2>&1
-               vgchange -ay > /dev/null 2>&1
+       if [[ $(vgs -o vg_name --noheading 2> /dev/null) ]]; then
+               if [[ $(lvs -o vg_name,lv_name --noheading --separator - 2> /dev/null) && $(pvs -o pv_name --noheading 2> /dev/null) ]]; then
+                       msg "LVM Setup" "\nActivating existing logical volume management.\n" 0
+                       modprobe dm-mod > /dev/null 2> "$ERR"
+                       errshow 'modprobe dm-mod'
+                       vgscan > /dev/null 2>&1
+                       vgchange -ay > /dev/null 2>&1
+               fi
        fi
 }