Skip to content

Commit

Permalink
NVMe fix and disallow blank encryption passphrases
Browse files Browse the repository at this point in the history
Creating partitions on NVMe drives appears to take place so quickly that when the script was attempting to access the new partition, the OS was not yet aware of it. This is fixed by waiting until the partition is visible to return its path (new lines 169-172).

Blank encryption passphrases are pointless, throw error on blank passphrase in case someone is just hitting the Enter key to select all the defaults for the preceding queries.
  • Loading branch information
nbros652 authored Aug 15, 2019
1 parent 90c1e44 commit 0b570ba
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions LGMP.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ do
read -sp "Encryption passphrase: " luksPass && echo
read -sp "Confirm encryption passphrase: " confirm
clear
[ "$luksPass" == "$confirm" ] && break
echo "passphrases didn't match! Try again"
[ "$luksPass" == "$confirm" ] && [ "$luksPass" == "" ] break
echo "passphrases didn't match or passphrase was blank! Try again"
done
echo -e 'In addition to the passphrase you provided, a keyfile can be generated that can \nalso be used for decryption. It is STRONGLY RECOMMENDED that you create this \nfile and store it in a secure location to be used in the event that you ever \nforget your passphrase!\n'
read -p "Key file size in bytes, or 'none' to prevent key file creation [512]: " keyfileSize
Expand Down Expand Up @@ -164,6 +164,13 @@ getDiskPartitionByNumber() {
# partitions for this disk follow a SATA, IDE, SCSI naming standard
part="${disk}${partNum}"
fi

# wait until partition is visible to the system; fixes NVMe race condition following partition creation
while [ ! -e "${part}" ]
do
sleep .5
done

echo "$part"
}

Expand Down

0 comments on commit 0b570ba

Please sign in to comment.