Modification : vm_{host,hosted,remote} -> {host,local,remote}/ .
[lhc/ateliers.git] / host / part-luks-mount
diff --git a/host/part-luks-mount b/host/part-luks-mount
new file mode 100755 (executable)
index 0000000..e1d26d9
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh -eu
+tool=$(readlink -e "${0%/*}/..")
+. "$tool"/host/lib.sh
+
+part="$1"
+eval "dev=\"\$vm_dev_disk_$part\""
+test -e /dev/mapper/${vm_lvm_lv}_${part}_deciphered ||
+sudo /bin/sh -c "/lib/cryptsetup/scripts/decrypt_derived ${vm_lvm_lv}_root_deciphered |
+cryptsetup luksOpen --key-file=- $dev ${vm_lvm_lv}_${part}_deciphered"