diff options
author | Jonathan Bauer | 2018-04-20 17:34:44 +0200 |
---|---|---|
committer | Jonathan Bauer | 2018-04-20 17:34:44 +0200 |
commit | 0916e3a2de5d99e009907c603d33ce8f28410254 (patch) | |
tree | 7e5a7683b1868180aafe206b2d2123fb2796a3b7 /core | |
parent | [safe-mode] disable screen standby the right way (diff) | |
download | mltk-0916e3a2de5d99e009907c603d33ce8f28410254.tar.gz mltk-0916e3a2de5d99e009907c603d33ce8f28410254.tar.xz mltk-0916e3a2de5d99e009907c603d33ce8f28410254.zip |
[vbox-src] get vdi uuid with od
Using vboxmanage would cause VBoxXPCOMIPCD and VBoxSVC to get started
and thus required to be killed before starting the VM (as the VM's
config file and "global" virtualbox.xml were not yet generated leading
to vboxmanage to not know about the machine uuid we wanted to start).
Diffstat (limited to 'core')
4 files changed, 16 insertions, 12 deletions
diff --git a/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/prepare_snapshot.inc b/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/prepare_snapshot.inc index 48924458..dcbff969 100755 --- a/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/prepare_snapshot.inc +++ b/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/prepare_snapshot.inc @@ -5,12 +5,14 @@ delete_snapshot() { prepare_snapshot() { declare -rg SNAPSHOT_UUID="34f617be-192a-46b3-a8ae-bce1029e093f" # snapshot UUID is static - # get UUID of VBox image - HDD_UUID=$(${VBOX_BASE_DIR}/VBoxManage -q showvdiinfo ${VBOX_HDD_LINK} \ - | grep UUID | grep -v "Parent UUID" | awk '{print $2}' \ - | grep -v use ) # nec. for VBox >= 4 + # get UUID of disk image using od to get 16 bytes (starting at 392) and + # order them according to the VDI UUID format with awk + HDD_UUID="$(od -An -t x1 -j 392 -N 16 ${VBOX_HDD_LINK} | awk '{print $4$3$2$1"-"$6$5"-"$8$7"-"$9$10"-"$11$12$13$14$15$16}')" + if isempty HDD_UUID; then + writelog "Failed to extract VDI UUID of '${VBOX_HDD_LINK}'" + EXIT_TYPE="internal" EXIT_REASON="Konnte UUID der virtuellen Festplatte nicht extrahieren." cleanexit 1 + fi - # TODO support vmdk disks? VBOX_HDD_FORMAT="VDI" if isset VM_DISKFILE_RO; then diff --git a/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/run-virt.include b/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/run-virt.include index 97e82499..30f492e5 100755 --- a/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/run-virt.include +++ b/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/run-virt.include @@ -39,13 +39,6 @@ run_plugin() { # log config summary $(safesource "${VBOX_INCLUDE_DIR}/log_config_summary.inc") - # This is necessary for the VM to start (don't ask me why, yet!) - VBMANPID=$(pstree -p | grep VBoxXPCOMIPCD | grep -ivE "VirtualBox|VBoxHeadless"\ - | sed -e "s/.*VBoxXPCOMIPCD(\(.*\)).*/\1/") - for i in $(echo ${VBMANPID}); do - kill -9 ${VBMANPID} >/dev/null 2>&1 - done - # set the variables appropriately (several interfaces with different names) declare -rg VIRTCMD="${VBOX_BASE_DIR}/VirtualBox" declare -rg VIRTCMDOPTS="--startvm ${MACHINE_UUID} --start-running --fullscreen" diff --git a/core/modules/vbox-src/module.build b/core/modules/vbox-src/module.build index 9660302f..36417f9e 100644 --- a/core/modules/vbox-src/module.build +++ b/core/modules/vbox-src/module.build @@ -81,6 +81,12 @@ build() { perror "Failed to cp '${MODULE_WORK_DIR}/extpack' to '${VBOX_EXTPACK_DIR}'." chown -R root:root "${VBOX_EXTPACK_DIR}" || \ perror "Failed to chown '${VBOX_EXTPACK_DIR}' to root:root." + + # od binary + local OD_BIN="$(which od 2>/dev/null)" + if [ -n "$OD_BIN" -a -e "$OD_BIN" ]; then + tarcopy "$OD_BIN" "$MODULE_BUILD_DIR" + fi } post_copy() { diff --git a/core/modules/vbox-src/module.conf b/core/modules/vbox-src/module.conf index 0da5db67..4763b9e4 100644 --- a/core/modules/vbox-src/module.conf +++ b/core/modules/vbox-src/module.conf @@ -5,3 +5,6 @@ REQUIRED_DIRECTORIES=" /lib/modules /usr/lib/virtualbox " +REQUIRED_BINARIES=" + od +" |