mirror of
https://github.com/Qubes-Community/Contents.git
synced 2025-01-03 11:31:04 -05:00
Create mount_lvm_image.sh
This commit is contained in:
parent
f5e5b64419
commit
aa32e81467
22
code/OS-administration/mount_lvm_image.sh
Normal file
22
code/OS-administration/mount_lvm_image.sh
Normal file
@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
########################################################
|
||||
# Make a LVM image appear in qvm-block
|
||||
# Create a disposable VM
|
||||
# Attach the image to the newly created disposable VM
|
||||
# Wait until the disposable VM is destroyed
|
||||
# Remove the LVM image from the qvm-block list
|
||||
######################################################
|
||||
|
||||
image=${1?Image file is required, exemple "/dev/qubes_dom0/vm-debian-9-tmp-root"}
|
||||
dvm=${2?DVM template name is required, example: "fedora-29-dvm"}
|
||||
dev=$(basename $(readlink "$image"))
|
||||
qubesdb-write /qubes-block-devices/$dev/desc "$image"
|
||||
list_before=$(qvm-ls | cut -d " " -f1 | sort)
|
||||
qvm-run -v --dispvm=$dvm --service qubes.StartApp+xterm &
|
||||
sleep 5
|
||||
list_after=$(qvm-ls | cut -d " " -f1 | sort)
|
||||
diff=$(comm -3 <(echo "$list_before") <(echo "$list_after"))
|
||||
qvm-block attach $diff dom0:$dev
|
||||
wait
|
||||
qubesdb-rm /qubes-block-devices/$dev/
|
Loading…
Reference in New Issue
Block a user