Trying to fix kill_script function once again

This commit is contained in:
Le0xFF 2022-07-28 18:30:35 +02:00
parent 791ce7fcbb
commit 6dd6c11e93

25
vli.sh
View File

@ -37,25 +37,18 @@ function kill_script {
echo -e -n "\n\n${RED_LIGHT}Kill signal captured, unmonting, cleaning and closing everything...${NORMAL}\n" echo -e -n "\n\n${RED_LIGHT}Kill signal captured, unmonting, cleaning and closing everything...${NORMAL}\n"
if [[ -b /dev/mapper/"$encrypted_name" ]] ; then if [[ -b /dev/mapper/"$encrypted_name" ]] ; then
if grep -q /mnt /proc/mounts ; then if [[ -b /dev/mapper/"$vg_name" ]] ; then
for dir in sys dev proc ; do if grep -q /mnt /proc/mounts ; then
umount /mnt/$dir for dir in sys dev proc ; do
done umount /mnt/$dir
umount -l /mnt/home done
umount -l /mnt umount /mnt/home
if [[ "$lvm_yn" == "y" ]] || [[ "$lvm_yn" == "Y" ]] ; then umount /mnt
if [[ -n "$lv_root_name" ]] ; then if [[ -b /dev/mapper/"$vg_name"-"$lv_root_name" ]] ; then
lvchange -an /dev/mapper/"$vg_name"-"$lv_root_name" lvchange -an /dev/mapper/"$vg_name"-"$lv_root_name"
else
vgchange -an /dev/mapper/"$vg_name"
fi
fi
else
if [[ "$lvm_yn" == "y" ]] || [[ "$lvm_yn" == "Y" ]] ; then
if [[ -n "$lv_root_name" ]] ; then
lvchange -an /dev/mapper/"$vg_name"-"$lv_root_name"
fi fi
fi fi
vgchange -an /dev/mapper/"$vg_name"
fi fi
cryptsetup close /dev/mapper/"$encrypted_name" cryptsetup close /dev/mapper/"$encrypted_name"
fi fi