diff options
author | bougyman <bougyman@users.noreply.github.com> | 2015-04-07 14:11:53 -0500 |
---|---|---|
committer | bougyman <bougyman@users.noreply.github.com> | 2015-04-07 14:11:53 -0500 |
commit | c6c53024e237ea395b97991c04cdc39b1bb98eef (patch) | |
tree | 0e17c2d4cfe907a981782ccf7cecaa3312549d88 /functions | |
parent | 41372a524a97915a52f85caab68a003f4ae0dea8 (diff) | |
parent | b935de9d7be296aca2dfffbc97fdcdf0beb69ea0 (diff) | |
download | runit-void-c6c53024e237ea395b97991c04cdc39b1bb98eef.tar.gz runit-void-c6c53024e237ea395b97991c04cdc39b1bb98eef.tar.xz runit-void-c6c53024e237ea395b97991c04cdc39b1bb98eef.zip |
Merge pull request #35 from bougyman/master 20150407
3: Detect and deactivate LVM Volume Groups on shutdown
Diffstat (limited to 'functions')
-rw-r--r-- | functions | 19 |
1 files changed, 19 insertions, 0 deletions
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 +} |