update 20160609

This commit is contained in:
stubbfel
2016-06-09 00:41:48 +02:00
parent 784c32a214
commit 010000e5cd
4 changed files with 191 additions and 0 deletions

28
mount_encrypt.sh Normal file
View File

@@ -0,0 +1,28 @@
#!/bin/bash
Device=$1
MountPoint=$2
MapName=$3
ContainerName="${MapName}foo"
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`
CMD=("cryptsetup" "luksOpen" "$Device" "$ContainerName")
if ! "${CMD[@]}"; then
echo "${red} can't open Device $Device ${reset}"
exit 1
fi
sleep 3
vgchange -ay
sleep 3
CMD=("mount" "/dev/mapper/${MapName}" "$MountPoint")
if ! "${CMD[@]}"; then
lvchange -a n "/dev/mapper/${MapName}"
cryptsetup luksClose "$ContainerName"
echo "${red}mount of $Device to $MountPoint failed ${reset}"
exit 1
fi
echo "${green}success mount $Device to $MountPoint ${reset}"