diff options
| author | Michael Pereira Neves | 2014-03-31 21:14:19 +0200 |
|---|---|---|
| committer | Michael Pereira Neves | 2014-03-31 21:14:19 +0200 |
| commit | c68cfbfde55cf8565ba186dd60f2065e2269650a (patch) | |
| tree | 6dbe7a31e0d943c968fad644f653effc903ae9b7 /remote/modules/vbox | |
| parent | [brazilian] add brazilian locale and keymaps (diff) | |
| parent | [vbox] re-set permissions: openslx/script entries (diff) | |
| download | tm-scripts-c68cfbfde55cf8565ba186dd60f2065e2269650a.tar.gz tm-scripts-c68cfbfde55cf8565ba186dd60f2065e2269650a.tar.xz tm-scripts-c68cfbfde55cf8565ba186dd60f2065e2269650a.zip | |
Merge branch 'master' of git.openslx.org:openslx-ng/tm-scripts
Diffstat (limited to 'remote/modules/vbox')
| -rwxr-xr-x | remote/modules/vbox/data/opt/openslx/scripts/systemd-vbox_env | 3 | ||||
| -rwxr-xr-x | remote/modules/vbox/data/opt/openslx/scripts/vmchooser-xml_filter | 74 | ||||
| -rw-r--r-- | remote/modules/vbox/module.build (renamed from remote/modules/vbox/vbox.build) | 0 | ||||
| -rw-r--r-- | remote/modules/vbox/module.conf (renamed from remote/modules/vbox/vbox.conf) | 0 | ||||
| -rw-r--r-- | remote/modules/vbox/module.conf.opensuse (renamed from remote/modules/vbox/vbox.conf.opensuse) | 0 | ||||
| -rw-r--r-- | remote/modules/vbox/module.conf.opensuse.12.3 (renamed from remote/modules/vbox/vbox.conf.opensuse.12.3) | 0 | ||||
| -rw-r--r-- | remote/modules/vbox/module.conf.ubuntu (renamed from remote/modules/vbox/vbox.conf.ubuntu) | 0 | ||||
| -rw-r--r-- | remote/modules/vbox/module.conf.ubuntu.13.04 (renamed from remote/modules/vbox/vbox.conf.ubuntu.13.04) | 0 |
8 files changed, 77 insertions, 0 deletions
diff --git a/remote/modules/vbox/data/opt/openslx/scripts/systemd-vbox_env b/remote/modules/vbox/data/opt/openslx/scripts/systemd-vbox_env index a69719ac..ece8c9f1 100755 --- a/remote/modules/vbox/data/opt/openslx/scripts/systemd-vbox_env +++ b/remote/modules/vbox/data/opt/openslx/scripts/systemd-vbox_env @@ -19,6 +19,9 @@ export PATH="$PATH":/opt/openslx/bin:/opt/openslx/sbin:/opt/openslx/usr/bin:/opt VBOX_CONF_DIR=/opt/openslx/etc/vbox VBOXMANAGE=$(which vboxmanage) +# create required standard directories +mkdir -p "/tmp/virt/virtualbox" -m 1777 + # load required Vbox modules for module in vboxdrv.ko vboxnetadp.ko vboxnetflt.ko vboxpci.ko ; do insmod /lib/modules/vbox/${module} || slxlog "vbox-systemd" "Loading of ${module} failed." diff --git a/remote/modules/vbox/data/opt/openslx/scripts/vmchooser-xml_filter b/remote/modules/vbox/data/opt/openslx/scripts/vmchooser-xml_filter new file mode 100755 index 00000000..c50b01a5 --- /dev/null +++ b/remote/modules/vbox/data/opt/openslx/scripts/vmchooser-xml_filter @@ -0,0 +1,74 @@ +#!/bin/bash +# Probably needs bash somewhere +# ----------------------------------------------------------------------------- +# Copyright (c) 2007..2009 - RZ Uni FR +# Copyright (c) 2007..2011 - OpenSLX GmbH +# +# This program 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 suggestions, praise, or complaints to feedback@openslx.org +# +# General information about OpenSLX can be found at http://openslx.org/ +# ----------------------------------------------------------------------------- +# xmlfilter.sh +# - This script is invoked by the vmchooser tool. It simply filters xml- +# files (taking the path to these files in $1). You might modify it in any +# way to match your needs, e.g. ask some database instead. You can re- +# implement it in any other programming language too. You simply have to +# return a list of proper xml files to be interpreted by the vmchooser +# binary). Please check for vmchooser.sh too ... +# ----------------------------------------------------------------------------- + +# This script . +# +# currently: +# - filter for slxgrp (which comes from /etc/machine-setup) +# + +# include default directories +. /opt/openslx/config + +if [ -f "${OPENSLX_DEFAULT_CONFDIR}/plugins/vmchooser/vmchooser.conf" ]; then + . "${OPENSLX_DEFAULT_CONFDIR}/plugins/vmchooser/vmchooser.conf" +fi + +function handlePersistentVM() { + if grep --extended-regexp -q "<persistent param=\"(|.+:)$USER(|:.+)\"" "$1"; then + # If this virtual machine is useable as persistent version for current + # user we provide an additional persistent version. + # TODO: This evil black magic needs to be rewritten some day (by someone who understands it) + local originalImagePath=$(grep -io '<image_name param=.*"' "$1" | sed -e "s/&.*;/; /g" | awk -F '"' '{ print $2 }') + local imageName=$(basename "$originalImagePath") + eval export SLX_VM_PERSISTENT_PATH="${SLX_VM_PERSISTENT_PATH}" && \ + local imagePath="${SLX_VM_PERSISTENT_PATH}${imageName}" + local persistentConfigVersionFilePath="$(mktemp --directory)/$(basename "$1")" + local vmchooserFilePath="$(dirname "$0")/vmchooser-clc" + if [ ! -f "$vmchooserFilePath" ]; then + vmchooserFilePath='/opt/openslx/scripts/vmchooser-clc' + fi + "$vmchooserFilePath" "$1" "$persistentConfigVersionFilePath" \ + --create-persistent-config "$imagePath" && \ + echo "$persistentConfigVersionFilePath" + fi +} + +for FILE in $(find -L "$1" -iname "*.xml"); do + # filter all xmls which aren't set active + grep -i -q "<active param=.*true.*" "$FILE" || continue + # HACK: filter all virtualbox images, as vbox is not ready yet + #grep -i -q "<virtualmachine param=.*virtualbox.*" "$FILE" && continue + if [ -n "${SLX_VM_POOL_FILTER}" ]; then + # filter all xmls with pool-param not equal to vmchooser::env + if [ $(grep "<pools param=\"${SLX_VM_POOL_FILTER}\"" "$FILE" | wc -l) -eq 1 ]; then + handlePersistentVM "$FILE" + echo "$FILE" + fi + else + handlePersistentVM "$FILE" + # if there is no pool set, just take all available xmls + echo "$FILE" + fi +done + diff --git a/remote/modules/vbox/vbox.build b/remote/modules/vbox/module.build index f095b4e2..f095b4e2 100644 --- a/remote/modules/vbox/vbox.build +++ b/remote/modules/vbox/module.build diff --git a/remote/modules/vbox/vbox.conf b/remote/modules/vbox/module.conf index 29067791..29067791 100644 --- a/remote/modules/vbox/vbox.conf +++ b/remote/modules/vbox/module.conf diff --git a/remote/modules/vbox/vbox.conf.opensuse b/remote/modules/vbox/module.conf.opensuse index e69de29b..e69de29b 100644 --- a/remote/modules/vbox/vbox.conf.opensuse +++ b/remote/modules/vbox/module.conf.opensuse diff --git a/remote/modules/vbox/vbox.conf.opensuse.12.3 b/remote/modules/vbox/module.conf.opensuse.12.3 index ae42e8aa..ae42e8aa 100644 --- a/remote/modules/vbox/vbox.conf.opensuse.12.3 +++ b/remote/modules/vbox/module.conf.opensuse.12.3 diff --git a/remote/modules/vbox/vbox.conf.ubuntu b/remote/modules/vbox/module.conf.ubuntu index 4efbd571..4efbd571 100644 --- a/remote/modules/vbox/vbox.conf.ubuntu +++ b/remote/modules/vbox/module.conf.ubuntu diff --git a/remote/modules/vbox/vbox.conf.ubuntu.13.04 b/remote/modules/vbox/module.conf.ubuntu.13.04 index fbef8447..fbef8447 100644 --- a/remote/modules/vbox/vbox.conf.ubuntu.13.04 +++ b/remote/modules/vbox/module.conf.ubuntu.13.04 |
