From 6f215404b191f2ab82d5c50c41b1c0ca13ec5e65 Mon Sep 17 00:00:00 2001 From: Chrysostomus Date: Sun, 5 Mar 2017 00:22:22 +0800 Subject: [PATCH] Filter luks_open menu --- lib/0 | 1 + lib/util-disk.sh | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 lib/0 diff --git a/lib/0 b/lib/0 new file mode 100644 index 0000000..f11c82a --- /dev/null +++ b/lib/0 @@ -0,0 +1 @@ +9 \ No newline at end of file diff --git a/lib/util-disk.sh b/lib/util-disk.sh index 8031c6a..eebcd73 100644 --- a/lib/util-disk.sh +++ b/lib/util-disk.sh @@ -188,6 +188,10 @@ list_containing_crypt() { blkid | awk '/TYPE="crypto_LUKS"/{print $1}' | sed 's/.$//' } +list_non_crypt() { + blkid | awk '!/TYPE="crypto_LUKS"/{print $1}' | sed 's/.$//' +} + # delete partition in list $PARTITIONS # param: partition to delete delete_partition_in_list() { @@ -468,6 +472,12 @@ luks_open() { INCLUDE_PART='part\|crypt\|lvm' umount_partitions find_partitions + # Filter out partitions that don't contain crypt device + list_non_crypt > /tmp/.ignore_part + + for part in $(cat /tmp/.ignore_part); do + delete_partition_in_list $part + done # Select encrypted partition to open DIALOG " $_LuksOpen " --menu "$_LuksMenuBody" 0 0 12 ${PARTITIONS} 2>${ANSWER} || return 1