From 6408e5ac7430a9365c91c26ad42ca2fe1248aa18 Mon Sep 17 00:00:00 2001 From: Suikan <26223147+suikan4github@users.noreply.github.com> Date: Tue, 29 Jun 2021 08:59:33 +0900 Subject: [PATCH] Change volume group existence check --- ubuntu/1-pre-install.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ubuntu/1-pre-install.sh b/ubuntu/1-pre-install.sh index da8e114..6ed9247 100644 --- a/ubuntu/1-pre-install.sh +++ b/ubuntu/1-pre-install.sh @@ -113,8 +113,9 @@ HEREDOC fi # if crypt volume is unable to open # ----- Configure the LVM in LUKS volume ----- -# Create a Physical Volume and Volume Group, if not exist -if [ -e /dev/${VGNAME} ]; then +# Check volume group ${VGNAME} exist or not +vgdisplay -s ${VGNAME} > /dev/null +if [ $? -eq 0 ] ; then # is return value 0? ( exist ?) echo "...Volume group ${VGNAME} already exist. Skipped to create" else echo "...Initialize a physical volume on ${CRYPTPARTNAME}"