From 9cd82763661b8a05dfe3a87e46c853b2b6efb95f Mon Sep 17 00:00:00 2001 From: natemaia Date: Mon, 9 Sep 2019 20:35:29 -0700 Subject: [PATCH] More fixes and cleanup --- archlabs-installer | 47 +++++++++++++++------------------------------- 1 file changed, 15 insertions(+), 32 deletions(-) diff --git a/archlabs-installer b/archlabs-installer index 7f1c801..08a5e9c 100755 --- a/archlabs-installer +++ b/archlabs-installer @@ -1272,7 +1272,7 @@ select_root_partition() if (( ptcount == 1 )); then # only one available device msg "Select Root Partition (/)" "\nOnly one partition available that meets size requirements.\n" 2 - ROOT_PART="$(awk 'NR==1 {print $1}' <<< "$pts")" + 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 @@ -2111,49 +2111,32 @@ luks_open() luks_pass() { LUKS_PASS='' - local t="$1" op="$2" v='' p='' p2='' + local t="$1" n='' p='' p2='' until [[ $LUKS_PASS ]]; do - i=0 + local i=0 tput cnorm - if [[ $op ]]; then - dialog --insecure --backtitle "$DIST Installer - $SYS - v$VER" --separator $'\n' --title " $t " \ - --mixedform "\nEnter the password to decrypt $ROOT_PART\n\nThis is needed to create a keyfile." 0 0 0 \ - "Password:" 1 1 '' 1 11 "$COLUMNS" 0 1 \ - "Password2:" 2 1 '' 2 12 "$COLUMNS" 0 1 2>"$ANS" || return 1 - - else - dialog --insecure --backtitle "$DIST Installer - $SYS - v$VER" --separator $'\n' --title " $t " --mixedform "$_luksomenu" 0 0 0 \ - "Name:" 1 1 "${LUKS_NAME:-cryptroot}" 1 7 "$COLUMNS" 0 0 \ - "Password:" 2 1 '' 2 11 "$COLUMNS" 0 1 \ - "Password2:" 3 1 '' 3 12 "$COLUMNS" 0 1 2>"$ANS" || return 1 - - fi + dialog --insecure --backtitle "$DIST Installer - $SYS - v$VER" --separator $'\n' --title " $t " --mixedform "$_luksomenu" 0 0 0 \ + "Name:" 1 1 "${LUKS_NAME:-cryptroot}" 1 7 "$COLUMNS" 0 0 \ + "Password:" 2 1 '' 2 11 "$COLUMNS" 0 1 \ + "Password2:" 3 1 '' 3 12 "$COLUMNS" 0 1 2>"$ANS" || return 1 while read -r line; do - if [[ $op ]]; then - case $i in - 0) p="$line" ;; - 1) p2="$line" ;; - esac - else - case $i in - 0) n="$line" ;; - 1) p="$line" ;; - 2) p2="$line" ;; - esac - fi + case $i in + 0) n="$line" ;; + 1) p="$line" ;; + 2) p2="$line" ;; + esac (( i++ )) done < "$ANS" - if [[ -z $op && -z $n ]]; then + if [[ -z $n ]]; then msg "Name Empty" "\nEncrypted device name cannot be empty.\n\nPlease try again.\n" 2 elif [[ -z $p || "$p" != "$p2" ]]; then - [[ $op ]] || LUKS_NAME="$n" + LUKS_NAME="$n" msg "Password Mismatch" "\nThe passwords entered do not match.\n\nPlease try again.\n" 2 else - [[ $op ]] || LUKS_NAME="$n" - LUKS_PASS="$p" + LUKS_NAME="$n" LUKS_PASS="$p" fi done