diff options
author | Jonathan Bauer | 2018-02-01 18:01:22 +0100 |
---|---|---|
committer | Jonathan Bauer | 2018-02-01 18:01:22 +0100 |
commit | 94fab6008b14c8b62e8b5a68b5e19cf9797b6499 (patch) | |
tree | 82d968de7f65f33a96147b0b04565f89d698a6aa /core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/run-virt.include | |
parent | [vbox-src] finalized build script + conf (diff) | |
download | mltk-94fab6008b14c8b62e8b5a68b5e19cf9797b6499.tar.gz mltk-94fab6008b14c8b62e8b5a68b5e19cf9797b6499.tar.xz mltk-94fab6008b14c8b62e8b5a68b5e19cf9797b6499.zip |
[vbox-src] run-virt plugin functional (wip)
Diffstat (limited to 'core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/run-virt.include')
-rwxr-xr-x | core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/run-virt.include | 57 |
1 files changed, 57 insertions, 0 deletions
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 new file mode 100755 index 00000000..6fedf15c --- /dev/null +++ b/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/run-virt.include @@ -0,0 +1,57 @@ +# ----------------------------------------------------------------------------- +# Copyright (c) 2009..2018 - RZ Uni Freiburg +# Copyright (c) 2009..2018 - OpenSLX GmbH +# +# This program/file is free software distributed under the GPL version 2. +# See http://openslx.org/COPYING +# +# If you have any feedback please consult http://openslx.org/feedback and +# send your feedback to feedback@openslx.org +# +# General information about OpenSLX can be found at http://openslx.org +# ----------------------------------------------------------------------------- +# run-virt.include +# - component for virtualbox of the vmchooser plugin vmchooser-run_virt +################################################################################ + +declare -rg VBOX_PLUGIN_DIR="$(dirname "${BASH_SOURCE[0]}")" +declare -rg VBOX_INCLUDE_DIR="${VBOX_PLUGIN_DIR}/includes" +declare -rg VBOX_BASE_DIR="/usr/lib/virtualbox" + +#declare -rg PLUGIN_FEATURES="slxfloppy firewall printer usb sound netshares" +declare -rg PLUGIN_FEATURES="slxfloppy" + +run_plugin() { + # declaration of default variables and some sanity checks + $(safesource --exit "${VBOX_INCLUDE_DIR}/init_core.inc") + + # determine hardware limits based on guest OD + $(safesource --exit "${VBOX_INCLUDE_DIR}/guest_hardware_limits.inc") + + # prepare volatile rw layer for the disk image using a snapshot + $(safesource --exit "${VBOX_INCLUDE_DIR}/prepare_snapshot.inc") + + # create main virtualbox configuration + $(safesource --exit "${VBOX_INCLUDE_DIR}/create_vbox_config.inc") + + # finalize machine configuration + $(safesource --exit "${VBOX_INCLUDE_DIR}/finalize_machine_config.inc") + + # log config summary + $(safesource --exit "${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" + + # set headless mode (-v off to disable vrdp) + declare -rg VIRTCMDHL="${VBOX_BASE_DIR}/VBoxHeadless" + declare -rg VIRTCMDOPTSHL="-s ${MACHINE_UUID}" +} |