diff options
author | Dirk von Suchodoletz | 2009-02-17 21:15:21 +0100 |
---|---|---|
committer | Dirk von Suchodoletz | 2009-02-17 21:15:21 +0100 |
commit | f4438b73ff48269de1e6049257042a092b24ae8f (patch) | |
tree | 938ad04fa92af264a39bf7d3969a0b55883c7f04 /os-plugins/plugins/virtualbox/XX_virtualbox.sh | |
parent | vmchooser binary: (diff) | |
download | core-f4438b73ff48269de1e6049257042a092b24ae8f.tar.gz core-f4438b73ff48269de1e6049257042a092b24ae8f.tar.xz core-f4438b73ff48269de1e6049257042a092b24ae8f.zip |
Framework stuff (not working) for the VirtualBox virtual machine ...
git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2589 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'os-plugins/plugins/virtualbox/XX_virtualbox.sh')
-rw-r--r-- | os-plugins/plugins/virtualbox/XX_virtualbox.sh | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/os-plugins/plugins/virtualbox/XX_virtualbox.sh b/os-plugins/plugins/virtualbox/XX_virtualbox.sh new file mode 100644 index 00000000..5fdf9f49 --- /dev/null +++ b/os-plugins/plugins/virtualbox/XX_virtualbox.sh @@ -0,0 +1,71 @@ +# Copyright (c) 2009 - 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 +# +# script is included from init via the "." load function - thus it has all +# variables and functions available + + +# check if the configuration file is available +if [ -e /initramfs/plugin-conf/virtualbox.conf ]; then + + # load needed variables + . /initramfs/plugin-conf/virtualbox.conf + + # Test if this plugin is activated... more or less useless with the + # new plugin system + if [ $virtualbox_active -ne 0 ]; then + + [ $DEBUGLEVEL -gt 0 ] && echo "executing the 'virtualbox' os-plugin ..."; + # load general configuration + . /initramfs/machine-setup + + # get source of virtualbox image server (get type, server and path) + if strinstr "/" "${virtualbox_imagesrc}" ; then + vbimgprot=$(uri_token ${virtualbox_imagesrc} prot) + vbimgserv=$(uri_token ${virtualbox_imagesrc} server) + vbimgpath="$(uri_token ${virtualbox_imagesrc} path)" + fi + if [ -n "${vbimgserv}" ] ; then + # directory where qemu images are expected in + testmkd /mnt/var/lib/virt/virtualbox + case "${vbimgprot}" in + *nbd) + # TODO: to be filled in ... + ;; + lbdev) + # we expect the stuff on toplevel directory, filesystem type should be + # autodetected here ... (vmimgserv is blockdev here) + vbbdev=/dev/${vbimgserv} + waitfor ${vbbdev} 20000 + echo -e "ext2\nreiserfs\nvfat\nxfs" >/etc/filesystems + mount -o ro ${vbbdev} /mnt/var/lib/virt/virtualbox || \ + error "$scfg_evmlm" nonfatal + ;; + *) + # we expect nfs mounts here ... + for proto in tcp udp fail; do + [ $proto = "fail" ] && { error "$scfg_nfs" nonfatal; + noimg=yes; break;} + mount -n -t nfs -o ro,nolock,$proto ${vbimgserv}:${vbimgpath} \ + /mnt/var/lib/virt/virtualbox && break + done + ;; + esac + fi + # copy version depending files - the vmchooser expects for every virtua- + # lization plugin a file named after it (here run-virtualbox.include) + testmkd /mnt/etc/opt/openslx + cp /mnt/opt/openslx/plugin-repo/run-virtualbox/files/run-virt.include \ + /mnt/etc/opt/openslx/run-virtualbox.include + + fi +else + [ $DEBUGLEVEL -gt 0 ] && echo " * Configuration of virtualbox plugin failed" +fi |