Add test script for development

This commit is contained in:
Suikan 2022-03-02 07:24:56 +09:00
parent fdfd8953d5
commit 4699f87cc7
5 changed files with 346 additions and 2 deletions

38
script/test/testutil.sh Normal file
View file

@ -0,0 +1,38 @@
# *******************************************************************************
# Deactivate all LV in the VG and close LUKS volume
# *******************************************************************************
function util_deactivate_and_close(){
echo "...Deactivating all logical volumes in volume group \"${VGNAME}\"."
vgchange -a n "${VGNAME}"
echo "...Closing LUKS volume \"${CRYPTPARTNAME}\"."
cryptsetup close "${CRYPTPARTNAME}"
cat <<- HEREDOC
...Installation process terminated..
HEREDOC
}
# *******************************************************************************
# Delete the nwe volume if overwrite install, and close all
# *******************************************************************************
function util_cleanup(){
echo "...Deleting the new logical volume \"${VGNAME}-${LVROOTNAME}\"."
lvremove -f /dev/mapper/"${VGNAME}"-"${LVROOTNAME}"
if [ "${USELVEXT1}" -ne 0 ] ; then # if using extra volume 1
# Remove newly created extra volume 1
echo "...Deleting the new logical volume \"${VGNAME}-${LVROOTNAME}${LVEXT1SUFFIX}\"."
lvremove -f /dev/mapper/"${VGNAME}"-"${LVROOTNAME}${LVEXT1SUFFIX}"
fi
if [ "${USELVEXT2}" -ne 0 ] ; then # if using extra volume 2
# Remove newly created extra volume 2
echo "...Deleting the new logical volume \"${VGNAME}-${LVROOTNAME}${LVEXT2SUFFIX}\"."
lvremove -f /dev/mapper/"${VGNAME}"-"${LVROOTNAME}${LVEXT2SUFFIX}"
fi
}