From 03299295a4ee37d9cf3e6ec91fdbdac66dec68a1 Mon Sep 17 00:00:00 2001 From: Suikan <26223147+suikan4github@users.noreply.github.com> Date: Thu, 1 Jul 2021 07:33:42 +0900 Subject: [PATCH] Added volume name sanity check --- script/ubuntu-kaiten-yaki.sh | 39 ++++++++++++++++++++++++++++++++++++ script/void-kaiten-yaki.sh | 39 ++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) diff --git a/script/ubuntu-kaiten-yaki.sh b/script/ubuntu-kaiten-yaki.sh index a098bdb..47c97ed 100644 --- a/script/ubuntu-kaiten-yaki.sh +++ b/script/ubuntu-kaiten-yaki.sh @@ -41,6 +41,45 @@ HEREDOC fi # "Ubuntu" is not found in the OS name. +# Sanity check for volume group name +echo ${VGNAME} | grep "-" -i > /dev/null +if [ $? -eq 0 ] ; then # "-" is found in the volume group name. + cat <&2 +***** ERROR : VGNAME is "${VGNAME}" ***** +THe "-" is not allowed in the volume name. +Check passphrase and config.txt + +Installation terminated. +HEREDOC + return +fi # "-" is found in the volume group name. + +# Sanity check for root volume name +echo ${LVROOTNAME} | grep "-" -i > /dev/null +if [ $? -eq 0 ] ; then # "-" is found in the volume name. + cat <&2 +***** ERROR : LVROOTNAME is "${LVROOTNAME}" ***** +THe "-" is not allowed in the volume name. +Check passphrase and config.txt + +Installation terminated. +HEREDOC + return +fi # "-" is found in the volume name. + +# Sanity check for swap volume name +echo ${LVSWAPNAME} | grep "-" -i > /dev/null +if [ $? -eq 0 ] ; then # "-" is found in the volume name. + cat <&2 +***** ERROR : LVSWAPNAME is "${LVSWAPNAME}" ***** +THe "-" is not allowed in the volume name. +Check passphrase and config.txt + +Installation terminated. +HEREDOC + return +fi # "-" is found in the volume name. + # For surre ask the config.sh is edited cat < /dev/null +if [ $? -eq 0 ] ; then # "-" is found in the volume group name. + cat <&2 +***** ERROR : VGNAME is "${VGNAME}" ***** +THe "-" is not allowed in the volume name. +Check passphrase and config.txt + +Installation terminated. +HEREDOC + return +fi # "-" is found in the volume group name. + +# Sanity check for root volume name +echo ${LVROOTNAME} | grep "-" -i > /dev/null +if [ $? -eq 0 ] ; then # "-" is found in the volume name. + cat <&2 +***** ERROR : LVROOTNAME is "${LVROOTNAME}" ***** +THe "-" is not allowed in the volume name. +Check passphrase and config.txt + +Installation terminated. +HEREDOC + return +fi # "-" is found in the volume name. + +# Sanity check for swap volume name +echo ${LVSWAPNAME} | grep "-" -i > /dev/null +if [ $? -eq 0 ] ; then # "-" is found in the volume name. + cat <&2 +***** ERROR : LVSWAPNAME is "${LVSWAPNAME}" ***** +THe "-" is not allowed in the volume name. +Check passphrase and config.txt + +Installation terminated. +HEREDOC + return +fi # "-" is found in the volume name. + # For surre ask the config.sh is edited cat <