diff options
-rwxr-xr-x | 3 | 2 | ||||
-rw-r--r-- | functions | 19 |
2 files changed, 21 insertions, 0 deletions
diff --git a/3 b/3 index c40c894..d0428d6 100755 --- a/3 +++ b/3 @@ -49,6 +49,8 @@ fi sync if [ -z "$VIRTUALIZATION" ]; then + deactivate_vgs + deactivate_crypt if [ -e /run/runit/reboot ] && command -v kexec >/dev/null; then msg "Triggering kexec..." kexec -e 2>/dev/null diff --git a/functions b/functions index 35449c1..971d288 100644 --- a/functions +++ b/functions @@ -34,3 +34,22 @@ detect_virt() { export VIRTUALIZATION=1 fi } + +deactivate_vgs() { + _group=${1:-All} + if [ -x /sbin/vgchange ]; then + vgs=$(vgs|wc -l) + if [ $vgs -gt 0 ]; then + msg "Deactivating $_group LVM Volume Groups..." + vgchange -an + fi + fi +} + +deactivate_crypt() { + if [ -x /sbin/dmsetup ]; then + msg "Deactivating Crypt Volumes" + dmsetup ls --target crypt --exec 'cryptsetup close' + deactivate_vgs "Crypt" + fi +} |