summaryrefslogtreecommitdiffstats
path: root/remote/modules/vmchooser
diff options
context:
space:
mode:
authorDirk2013-12-12 11:44:51 +0100
committerDirk2013-12-12 11:44:51 +0100
commit5ab38b16d5f0bd07958ec10679019a66c0523de6 (patch)
tree6f76bb59ae60ac787d1156adc19cf9828ab5bb1d /remote/modules/vmchooser
parentMerge branch 'master' of git.openslx.org:openslx-ng/tm-scripts (diff)
downloadtm-scripts-5ab38b16d5f0bd07958ec10679019a66c0523de6.tar.gz
tm-scripts-5ab38b16d5f0bd07958ec10679019a66c0523de6.tar.xz
tm-scripts-5ab38b16d5f0bd07958ec10679019a66c0523de6.zip
Restructuring run-virt.include for vmware ...
Diffstat (limited to 'remote/modules/vmchooser')
-rwxr-xr-xremote/modules/vmchooser/data/opt/openslx/scripts/systemd-vmchooser_env23
-rwxr-xr-xremote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt2
2 files changed, 15 insertions, 10 deletions
diff --git a/remote/modules/vmchooser/data/opt/openslx/scripts/systemd-vmchooser_env b/remote/modules/vmchooser/data/opt/openslx/scripts/systemd-vmchooser_env
index b429bb55..c796b3db 100755
--- a/remote/modules/vmchooser/data/opt/openslx/scripts/systemd-vmchooser_env
+++ b/remote/modules/vmchooser/data/opt/openslx/scripts/systemd-vmchooser_env
@@ -1,5 +1,4 @@
-#!/bin/bash
-# Full bash required
+#!/bin/ash
# -----------------------------------------------------------------------------
# Copyright (c) 2007..2013 - RZ Uni FR
# Copyright (c) 2007..2013 - OpenSLX GmbH
@@ -17,6 +16,10 @@
# zation tools used later on.
################################################################################
+################################################################################
+### Define default dirs / get configs
+################################################################################
+
export PATH=$PATH:/opt/openslx/bin:/opt/openslx/sbin:/opt/openslx/usr/bin:/opt/openslx/usr/sbin
# source config file with vars (e.g. ipaddr, macaddr, hostname)
@@ -68,7 +71,9 @@ mkdir -p /var/log/samba
#ALL ALL=NOPASSWD: /opt/openslx/rootfs/usr/bin/killall nmbd smbd
#EOF
-#from plugins/vmchooser/80-after-plugins/virtualization.sh
+################################################################################
+### Determine hardware configuration
+################################################################################
# estimate free mem
mem_free=$(grep -i "^memfree:" /proc/meminfo | awk '{print $2}')
@@ -77,8 +82,8 @@ mem_swapcached=$(grep -i "^swapcached:" /proc/meminfo | awk '{print $2}')
[ -z "$mem_free" ] && mem_free="2048000"
[ -z "$mem_cached" ] && mem_cached="0"
[ -z "$mem_swapcached" ] && mem_swapcached="0"
-totalmem="$[ ( $mem_free + $mem_cached + $mem_swapcached ) / 1024 ]"
-echo "totalmem=${totalmem}" >> "${VMCHOOSER_CONF_DIR}/virtualization.conf"
+totalmem="$(expr $(expr $mem_free + $mem_cached + $mem_swapcached) / 1024)"
+echo "totalmem=${totalmem}" > "${VMCHOOSER_CONF_DIR}/virtualization.conf"
# determine number of cpu cores
CPU_CORES=$(grep '^processor.*:' /proc/cpuinfo | wc -l)
@@ -88,10 +93,10 @@ else
echo 'cpu_cores=1' >> "${VMCHOOSER_CONF_DIR}/virtualization.conf"
fi
-# arch
+# general machine architecture (32/64bit)
echo "host_arch=$(uname -m)" >> "${VMCHOOSER_CONF_DIR}/virtualization.conf"
-# VT enabled cpu?
+# check for VT enabled CPU
if grep -q '^flags.*\<vmx\>' "/proc/cpuinfo"; then
echo "vtflag=1" >> "${VMCHOOSER_CONF_DIR}/virtualization.conf"
echo 'kvm_module="kvm_intel"' >> "${VMCHOOSER_CONF_DIR}/virtualization.conf"
@@ -108,10 +113,10 @@ if [ -n "$SLX_PXE_MAC" ]; then
else ## Fallback:
echo "hostmacaddr=$(ip a | grep ether | grep -o -E -i '([0-9a-f]{2}:){5}[0-9a-f]{2}' | head -n 1)" >> "${VMCHOOSER_CONF_DIR}/virtualization.conf"
fi
-# ip addr
+# read in ip address
echo "hostip=${SLX_PXE_CLIENT_IP}" >> "${VMCHOOSER_CONF_DIR}/virtualization.conf"
# hostname
-echo "hostname=$(hostname -s)" >> "${VMCHOOSER_CONF_DIR}/virtualization.conf"
+echo "hostname=\"$(hostname -s)\"" >> "${VMCHOOSER_CONF_DIR}/virtualization.conf"
# get further hw information and check for traces of available optical and floppy drives
j=0
diff --git a/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt b/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt
index 2a6a3272..43880a2c 100755
--- a/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt
+++ b/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt
@@ -433,7 +433,7 @@ amixer -q sset Front "$VOL" unmute 2>/dev/null # in SUSE 11.0 it's headphon
amixer -q sset Speaker "$VOL" unmute 2>/dev/null # annoying built-in speaker
-# # # # # # Start printer daemon # # # # # # #
+# Start printer daemon
USER="$(whoami)"
SPOOLDIR="/var/spool"
QUEUE="STANDARD"