From 5acda3eaeabae9045609539303a8c12c4ce401f1 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 25 Apr 2016 12:01:08 +0200 Subject: merge with latest dev version --- .../data/etc/tmpfiles.d/vmchooser-cache.conf | 2 ++ .../vmchooser2/data/opt/openslx/bin/vmchooser | 36 +++++++++++++++++++ .../data/opt/openslx/vmchooser/sessionstart | 18 ++++++++++ .../vmchooser/sessionstart.d/log-selected-session | 5 +++ .../themes/bwlehrpool/bwlehrpool-left.png | Bin 0 -> 5361 bytes .../themes/bwlehrpool/bwlehrpool-right.png | Bin 0 -> 3390 bytes .../vmchooser/themes/bwlehrpool/bwlehrpool.ini | 4 +++ core/modules/vmchooser2/module.build | 39 +++++++++++++++++++++ core/modules/vmchooser2/module.conf | 3 ++ core/modules/vmchooser2/module.conf.debian | 4 +++ core/modules/vmchooser2/module.conf.opensuse | 4 +++ core/modules/vmchooser2/module.conf.ubuntu | 4 +++ 12 files changed, 119 insertions(+) create mode 100644 core/modules/vmchooser2/data/etc/tmpfiles.d/vmchooser-cache.conf create mode 100755 core/modules/vmchooser2/data/opt/openslx/bin/vmchooser create mode 100755 core/modules/vmchooser2/data/opt/openslx/vmchooser/sessionstart create mode 100755 core/modules/vmchooser2/data/opt/openslx/vmchooser/sessionstart.d/log-selected-session create mode 100644 core/modules/vmchooser2/data/opt/openslx/vmchooser/themes/bwlehrpool/bwlehrpool-left.png create mode 100644 core/modules/vmchooser2/data/opt/openslx/vmchooser/themes/bwlehrpool/bwlehrpool-right.png create mode 100644 core/modules/vmchooser2/data/opt/openslx/vmchooser/themes/bwlehrpool/bwlehrpool.ini create mode 100644 core/modules/vmchooser2/module.build create mode 100644 core/modules/vmchooser2/module.conf create mode 100644 core/modules/vmchooser2/module.conf.debian create mode 100644 core/modules/vmchooser2/module.conf.opensuse create mode 100644 core/modules/vmchooser2/module.conf.ubuntu (limited to 'core/modules/vmchooser2') diff --git a/core/modules/vmchooser2/data/etc/tmpfiles.d/vmchooser-cache.conf b/core/modules/vmchooser2/data/etc/tmpfiles.d/vmchooser-cache.conf new file mode 100644 index 00000000..3b2219d1 --- /dev/null +++ b/core/modules/vmchooser2/data/etc/tmpfiles.d/vmchooser-cache.conf @@ -0,0 +1,2 @@ +d /tmp/vmchooser2 0777 root root +d /tmp/vmchooser2/icons 0777 root root diff --git a/core/modules/vmchooser2/data/opt/openslx/bin/vmchooser b/core/modules/vmchooser2/data/opt/openslx/bin/vmchooser new file mode 100755 index 00000000..a99207ff --- /dev/null +++ b/core/modules/vmchooser2/data/opt/openslx/bin/vmchooser @@ -0,0 +1,36 @@ +#!/bin/ash + +# This script launches the real vmchooser (vmchooser.real) +# It's here to pass the XML URL, coming from +# /opt/openslx/config, as well as the pool filter (if any) + +. /opt/openslx/config + +if [ -n "$SLX_VMCHOOSER_BASE_URL" ]; then + URL="$SLX_VMCHOOSER_BASE_URL" +elif [ -n "$SLX_PXE_SERVER_IP" ]; then + URL="http://$SLX_PXE_SERVER_IP/vmchooser/" +else + slxlog "virt-vmchooser" "vmchooser: Could not determine URL to fetch VM list from! (need SLX_VMCHOOSER_BASE_URL)" + # TODO: Tell user +fi + +MEM=$(grep -m1 '^MemTotal:' /proc/meminfo | awk '{print $2}') +if [ -n "$SLX_VMCHOOSER_TAB" ] && [ "$SLX_VMCHOOSER_TAB" -ge 0 -a "$SLX_VMCHOOSER_TAB" -le 2 ] 2>/dev/null; then + TAB="$SLX_VMCHOOSER_TAB" +elif [ "$MEM" -lt 3000000 ]; then # Check RAM size; if it's not that much, default to the native linux sessions + TAB=0 +else + TAB=2 +fi + +EXTRA= +[ -n "$SLX_VMCHOOSER_TEMPLATES" ] && EXTRA="$EXTRA --template-mode $SLX_VMCHOOSER_TEMPLATES" +[ -n "$SLX_VMCHOOSER_FORLOCATION" ] && EXTRA="$EXTRA --location-mode $SLX_VMCHOOSER_FORLOCATION" + +if [ -z "$SLX_LOCATIONS" ]; then + exec vmchooser.real "$@" --url "$URL" --fullscreen --tab "$TAB" $EXTRA +fi + +exec vmchooser.real "$@" --url "$URL" --fullscreen --tab "$TAB" --locations "$SLX_LOCATIONS" $EXTRA + diff --git a/core/modules/vmchooser2/data/opt/openslx/vmchooser/sessionstart b/core/modules/vmchooser2/data/opt/openslx/vmchooser/sessionstart new file mode 100755 index 00000000..1cc7eb5f --- /dev/null +++ b/core/modules/vmchooser2/data/opt/openslx/vmchooser/sessionstart @@ -0,0 +1,18 @@ +#!/bin/ash + +SOURCEPATH="/opt/openslx/vmchooser/sessionstart.d" + +if [ -d "$SOURCEPATH" ]; then + for file in $SOURCEPATH/*; do + "$file" + RET=$? + if [ "$RET" != 0 ]; then + param="$file" + [ "$(head -n 1 "$file" | cut -b 1)" != "#" ] && param= + slxlog "vmchooser-sessionstart" "$file returned $RET at session start!" "$param" + fi + done +fi + +exit 0 + diff --git a/core/modules/vmchooser2/data/opt/openslx/vmchooser/sessionstart.d/log-selected-session b/core/modules/vmchooser2/data/opt/openslx/vmchooser/sessionstart.d/log-selected-session new file mode 100755 index 00000000..2499b3b7 --- /dev/null +++ b/core/modules/vmchooser2/data/opt/openslx/vmchooser/sessionstart.d/log-selected-session @@ -0,0 +1,5 @@ +#!/bin/ash + +[ -n "$SESSION_NAME" ] && slxlog ".vmchooser-session-name" "$SESSION_NAME" + +exit 0 diff --git a/core/modules/vmchooser2/data/opt/openslx/vmchooser/themes/bwlehrpool/bwlehrpool-left.png b/core/modules/vmchooser2/data/opt/openslx/vmchooser/themes/bwlehrpool/bwlehrpool-left.png new file mode 100644 index 00000000..c9d8ab0d Binary files /dev/null and b/core/modules/vmchooser2/data/opt/openslx/vmchooser/themes/bwlehrpool/bwlehrpool-left.png differ diff --git a/core/modules/vmchooser2/data/opt/openslx/vmchooser/themes/bwlehrpool/bwlehrpool-right.png b/core/modules/vmchooser2/data/opt/openslx/vmchooser/themes/bwlehrpool/bwlehrpool-right.png new file mode 100644 index 00000000..8ca9347b Binary files /dev/null and b/core/modules/vmchooser2/data/opt/openslx/vmchooser/themes/bwlehrpool/bwlehrpool-right.png differ diff --git a/core/modules/vmchooser2/data/opt/openslx/vmchooser/themes/bwlehrpool/bwlehrpool.ini b/core/modules/vmchooser2/data/opt/openslx/vmchooser/themes/bwlehrpool/bwlehrpool.ini new file mode 100644 index 00000000..90d00617 --- /dev/null +++ b/core/modules/vmchooser2/data/opt/openslx/vmchooser/themes/bwlehrpool/bwlehrpool.ini @@ -0,0 +1,4 @@ +background-color=#ffffff +image-right=bwlehrpool-right.png +image-left=bwlehrpool-left.png + diff --git a/core/modules/vmchooser2/module.build b/core/modules/vmchooser2/module.build new file mode 100644 index 00000000..3686aa75 --- /dev/null +++ b/core/modules/vmchooser2/module.build @@ -0,0 +1,39 @@ + +fetch_source() { + git clone "${REQUIRED_GIT}" src +} + +build() { + local SRCDIR="${MODULE_WORK_DIR}/src/" + + [ ! -d "${MODULE_BUILD_DIR}/${REQUIRED_PREFIX}" ] && mkdir -p "${MODULE_BUILD_DIR}/${REQUIRED_PREFIX}" + cd "${MODULE_BUILD_DIR}/${REQUIRED_PREFIX}" + + # patch globals.cpp and globals.h to use standardised paths /opt/openslx/... + if ! grep -q VMCHOOSER_SCRIPTS_PATH "$SRCDIR/src/globals.h"; then + sed -i 's/^#define VMCHOOSER_ETC_BASE_PATH.*/#define VMCHOOSER_ETC_BASE_PATH "\/opt\/openslx\/vmchooser\/config"/g' "${SRCDIR}/src/globals.h" + sed -i 's/^#define VMCHOOSER_BIN_PATH.*/#define VMCHOOSER_BIN_PATH "\/opt\/openslx\/bin"\n#define VMCHOOSER_SCRIPTS_PATH "\/opt\/openslx\/scripts"/g' "${SRCDIR}/src/globals.h" + sed -i 's/^#define VMCHOOSER_THEME_BASE.*/#define VMCHOOSER_THEME_BASE "\/opt\/openslx\/vmchooser\/themes"/g' "${SRCDIR}/src/globals.h" + + sed -i 's/^QString binPath(VMCHOOSER_BIN_PATH);/QString binPath(VMCHOOSER_BIN_PATH);\nQString scriptsPath(VMCHOOSER_SCRIPTS_PATH);/g' "${SRCDIR}/src/globals.cpp" + sed -i 's/^QString runVmScript(binPath + "\/run-virt.sh");/QString runVmScript(scriptsPath + "\/vmchooser-run_virt");/g' "${SRCDIR}/src/globals.cpp" + sed -i 's/^QString filterScript(binPath + "\/xmlfilter.sh");/QString filterScript(scriptsPath + "\/vmchooser-xml_filter");/g' "${SRCDIR}/src/globals.cpp" + sed -i 's/^#define VMCHOOSER_VMPATH.*/#define VMCHOOSER_VMPATH "\/mnt\/vmstore"/g' "${SRCDIR}/src/globals.h" + fi + + pinfo "Running cmake" + + # use qt4-dev (in case eg. qt4 and 5 are installed) + activate_qt 4 + + cmake "$SRCDIR" || perror "'cmake $SRCDIR' failed." + make || perror "'make' failed." + mv "vmchooser" "vmchooser.real" || perror "Could not rename vmchooser binary to vmchooser.real" + + cd - > /dev/null +} + +post_copy() { + : +} + diff --git a/core/modules/vmchooser2/module.conf b/core/modules/vmchooser2/module.conf new file mode 100644 index 00000000..b098d7a5 --- /dev/null +++ b/core/modules/vmchooser2/module.conf @@ -0,0 +1,3 @@ +REQUIRED_GIT="git://git.openslx.org/openslx-ng/vmchooser2.git" +REQUIRED_PREFIX="/opt/openslx/bin" +REQUIRED_BINARIES="vmchooser.real" diff --git a/core/modules/vmchooser2/module.conf.debian b/core/modules/vmchooser2/module.conf.debian new file mode 100644 index 00000000..2953ac63 --- /dev/null +++ b/core/modules/vmchooser2/module.conf.debian @@ -0,0 +1,4 @@ +REQUIRED_INSTALLED_PACKAGES=" + cmake + libqt4-dev +" diff --git a/core/modules/vmchooser2/module.conf.opensuse b/core/modules/vmchooser2/module.conf.opensuse new file mode 100644 index 00000000..75cb7dd6 --- /dev/null +++ b/core/modules/vmchooser2/module.conf.opensuse @@ -0,0 +1,4 @@ +REQUIRED_INSTALLED_PACKAGES=" + cmake + libqt4-devel +" diff --git a/core/modules/vmchooser2/module.conf.ubuntu b/core/modules/vmchooser2/module.conf.ubuntu new file mode 100644 index 00000000..2953ac63 --- /dev/null +++ b/core/modules/vmchooser2/module.conf.ubuntu @@ -0,0 +1,4 @@ +REQUIRED_INSTALLED_PACKAGES=" + cmake + libqt4-dev +" -- cgit v1.2.3-55-g7522