summaryrefslogtreecommitdiffstats
path: root/remote/modules/vmchooser/data/opt
diff options
context:
space:
mode:
authorJonathan Bauer2013-08-02 17:27:28 +0200
committerJonathan Bauer2013-08-02 17:27:28 +0200
commit3ba5a58e5b04b771e6ee99ee6d6f772991c1c236 (patch)
tree0d91e40266c79ac1f06cf07cef82fe70563f9a34 /remote/modules/vmchooser/data/opt
parent[rootfs-stage32] add find and grep to config file (diff)
downloadtm-scripts-3ba5a58e5b04b771e6ee99ee6d6f772991c1c236.tar.gz
tm-scripts-3ba5a58e5b04b771e6ee99ee6d6f772991c1c236.tar.xz
tm-scripts-3ba5a58e5b04b771e6ee99ee6d6f772991c1c236.zip
[vmchooser] moved all vmchooser specific files and scripts to /opt/openslx. Renamed 'var/lib/virt' to 'mnt/vmstore'. Added bwlehrpool theme for vmchooser#
Diffstat (limited to 'remote/modules/vmchooser/data/opt')
-rw-r--r--remote/modules/vmchooser/data/opt/openslx/etc/vmchooser/smb.conf25
-rw-r--r--remote/modules/vmchooser/data/opt/openslx/etc/vmchooser/vmchooser.conf4
-rwxr-xr-xremote/modules/vmchooser/data/opt/openslx/scripts/systemd-mount_vm_store6
-rwxr-xr-xremote/modules/vmchooser/data/opt/openslx/scripts/systemd-vmchooser_env112
-rwxr-xr-xremote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt (renamed from remote/modules/vmchooser/data/opt/openslx/scripts/run-virt.sh)20
-rwxr-xr-xremote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-xml_filter (renamed from remote/modules/vmchooser/data/opt/openslx/bin/xmlfilter.sh)0
-rw-r--r--remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/bwlehrpool/bwlehrpool-left.pngbin0 -> 5361 bytes
-rw-r--r--remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/bwlehrpool/bwlehrpool-right.pngbin0 -> 3390 bytes
-rw-r--r--remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/bwlehrpool/bwlehrpool.ini4
-rw-r--r--remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/openslx/openslx-left.pngbin0 -> 9187 bytes
-rw-r--r--remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/openslx/openslx-right.pngbin0 -> 3390 bytes
-rw-r--r--remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/openslx/openslx.ini4
-rw-r--r--remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/planets/planets-left.pngbin0 -> 11337 bytes
-rw-r--r--remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/planets/planets-right.pngbin0 -> 3082 bytes
-rw-r--r--remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/planets/planets.ini4
-rwxr-xr-xremote/modules/vmchooser/data/opt/openslx/xsessions/default.desktop2
16 files changed, 165 insertions, 16 deletions
diff --git a/remote/modules/vmchooser/data/opt/openslx/etc/vmchooser/smb.conf b/remote/modules/vmchooser/data/opt/openslx/etc/vmchooser/smb.conf
new file mode 100644
index 00000000..ec757ce4
--- /dev/null
+++ b/remote/modules/vmchooser/data/opt/openslx/etc/vmchooser/smb.conf
@@ -0,0 +1,25 @@
+# basic samba configuration file for OpenSLX host-internal networking
+[global]
+ workgroup = OPENSLX
+ netbios name = HOMESERVER
+ security = SHARE
+ server string = Home and Print Provider
+ bind interfaces only = Yes
+ interfaces = NWIF
+ pid directory = PIDDIR
+
+[userhome]
+ comment = Home Directory of USER
+ path = /home/USER
+ create mask = 0700
+ guest ok = No
+ read only = No
+
+[scratch]
+ comment = Host System Temp Folder
+ path = /tmp
+ create mask = 0700
+ guest ok = Yes
+ read only = No
+ browseable = Yes
+
diff --git a/remote/modules/vmchooser/data/opt/openslx/etc/vmchooser/vmchooser.conf b/remote/modules/vmchooser/data/opt/openslx/etc/vmchooser/vmchooser.conf
new file mode 100644
index 00000000..92578ead
--- /dev/null
+++ b/remote/modules/vmchooser/data/opt/openslx/etc/vmchooser/vmchooser.conf
@@ -0,0 +1,4 @@
+pool=default
+theme=openslx
+pvs=0
+path=/mnt/vmstore
diff --git a/remote/modules/vmchooser/data/opt/openslx/scripts/systemd-mount_vm_store b/remote/modules/vmchooser/data/opt/openslx/scripts/systemd-mount_vm_store
index 27a8f55c..75af39fe 100755
--- a/remote/modules/vmchooser/data/opt/openslx/scripts/systemd-mount_vm_store
+++ b/remote/modules/vmchooser/data/opt/openslx/scripts/systemd-mount_vm_store
@@ -2,7 +2,5 @@
. /opt/openslx/config || exit 1
-export PATH="$PATH:/opt/openslx/bin:/opt/openslx/usr/bin:/opt/openslx/sbin:/opt/openslx/usr/sbin"
-
-mkdir -p /var/lib/virt
-mount -t nfs -o ro,async,nolock,vers=3 "$SLX_VM_NFS" /var/lib/virt
+mkdir -p /mnt/vmstore
+mount -t nfs -o ro,async,nolock,vers=3 "$SLX_VM_NFS" /mnt/vmstore
diff --git a/remote/modules/vmchooser/data/opt/openslx/scripts/systemd-vmchooser_env b/remote/modules/vmchooser/data/opt/openslx/scripts/systemd-vmchooser_env
new file mode 100755
index 00000000..50eace20
--- /dev/null
+++ b/remote/modules/vmchooser/data/opt/openslx/scripts/systemd-vmchooser_env
@@ -0,0 +1,112 @@
+#!/bin/sh
+
+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)
+. /opt/openslx/config
+
+#from plugins/vmchooser/40-started-hw-config/run-virt.sh
+#TODO: extra systemd-service for hwinfo
+hwinfo --cdrom | grep -i "Device File:" | awk {'print $3'} >/etc/openslx/hwinfo.cdrom
+hwinfo --floppy | grep -i "Device File:" | awk {'print $3'} >/etc/openslx/hwinfo.floppy
+
+#from plugins/vmchooser/XX_vmchooser.sh
+VMCHOOSER_CONF_DIR=/opt/openslx/etc/vmchooser
+
+mkdir -p ${VMCHOOSER_CONF_DIR}/loopimg
+mkdir -p ${VMCHOOSER_CONF_DIR}/fd-loop -m 1777
+
+# mount a clean tempfs (bug in UnionFS prevents loopmount to work)
+grep -qE "unionfs |aufs " /proc/mounts && \
+mount -n -o size=1500k -t tmpfs vm-loopimg ${VMCHOOSER_CONF_DIR}/loopimg
+
+# create an empty floppy image of 1.4MByte size
+dd if=/dev/zero of=${VMCHOOSER_CONF_DIR}/loopimg/fd.img count=2880 bs=512 2>/dev/null
+chmod 0777 ${VMCHOOSER_CONF_DIR}/loopimg/fd.img
+
+# use dos formatter copied into stage3
+mkdosfs ${VMCHOOSER_CONF_DIR}/loopimg/fd.img >/dev/null 2>&1 #|| error
+mount -n -t msdos -o loop,umask=000 ${VMCHOOSER_CONF_DIR}/loopimg/fd.img \
+ ${VMCHOOSER_CONF_DIR}/fd-loop
+
+#pvs integration
+#if [ $vmchooser_pvs -ne 0 ]; then
+# sed -i /usr/share/xsessions/default.desktop \
+# -e "s,vmchooser$,vmchooser --pvs,"
+#fi
+
+# setup more scratch space for virtual machines, if configured
+mkdir -p /tmp/virt
+mkdir -p /var/log/samba
+
+# enable normal users to setup the extended virtual machine redo file space
+# and image source via network block device (NBD only at the moment)
+# allow to start/stop samba on virtual devices (latter one ignores multiple
+# independent daemons)
+
+#cat >> /mnt/etc/sudoers << EOF
+# allow to start and stop the special /tmp redo file space (RAM + NBD/NFS server RAID)
+#ALL ALL=NOPASSWD: /sbin/losetup /dev/loop*
+#ALL ALL=NOPASSWD: /sbin/mdadm -C /dev/md0 -l linear --raid-devices=2 /dev/loop* /dev/*
+#ALL ALL=NOPASSWD: /opt/openslx/rootfs/usr/sbin/nbd-client * * /dev/nbd*
+# allow to configure and start/stop samba services
+#ALL ALL=NOPASSWD: /opt/openslx/rootfs/bin/sed -i /etc/*/smb.conf -e *
+#ALL ALL=NOPASSWD: /usr/sbin/nmbd -s /etc/*/smb.conf
+#ALL ALL=NOPASSWD: /usr/sbin/smbd -s /etc/*/smb.conf
+#ALL ALL=NOPASSWD: /opt/openslx/rootfs/usr/bin/killall nmbd smbd
+#EOF
+
+#from plugins/vmchooser/80-after-plugins/virtualization.sh
+
+# change free mem
+mem_free=$(grep -i "^memfree:" /proc/meminfo | awk '{print $2}')
+mem_cached=$(grep -i "^cached:" /proc/meminfo | awk '{print $2}')
+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
+
+# cpu cores
+CPU_CORES=$(grep '^processor.*:' /proc/cpuinfo | wc -l)
+if [ "${CPU_CORES}" -gt "1" 2>/dev/null ]; then
+ echo "cpu_cores=${CPU_CORES}" >> ${VMCHOOSER_CONF_DIR}/virtualization.conf
+else
+ echo 'cpu_cores=1' >> ${VMCHOOSER_CONF_DIR}/virtualization.conf
+fi
+
+# arch
+echo "host_arch=$(uname -m)" >> ${VMCHOOSER_CONF_DIR}/virtualization.conf
+
+# 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
+ elif grep -q ^flags.*\\\<svm\\\> /proc/cpuinfo; then
+ echo "vtflag=1" >> ${VMCHOOSER_CONF_DIR}/virtualization.conf
+ echo 'kvm_module="kvm_amd"' >> ${VMCHOOSER_CONF_DIR}/virtualization.conf
+ else
+ echo "vtflag=0" >> ${VMCHOOSER_CONF_DIR}/virtualization.conf
+fi
+
+# write mac
+echo "hostmacaddr=${SLX_PXE_MAC}" >> ${VMCHOOSER_CONF_DIR}/virtualization.conf
+# ip addr
+echo "hostip=${SLX_PXE_CLIENT_IP}" >> ${VMCHOOSER_CONF_DIR}/virtualization.conf
+# hostname
+echo "hostname=${SLX_HOSTNAME}" >> ${VMCHOOSER_CONF_DIR}/virtualization.conf
+
+# get further hw information
+j=0
+for i in $(cat /etc/openslx/hwinfo.cdrom); do
+ echo "cdrom_$j=$i" >> ${VMCHOOSER_CONF_DIR}/virtualization.conf
+ j=$(expr $j + 1)
+done
+
+j=0
+for i in $(cat /etc/openslx/hwinfo.floppy); do
+ echo "floppy_$j=$i" >> ${VMCHOOSER_CONF_DIR}/virtualization.conf
+ j=$(expr $j + 1)
+done
+
diff --git a/remote/modules/vmchooser/data/opt/openslx/scripts/run-virt.sh b/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt
index 473dfbc7..874669dd 100755
--- a/remote/modules/vmchooser/data/opt/openslx/scripts/run-virt.sh
+++ b/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt
@@ -22,14 +22,12 @@
### Define default dirs / get configs
################################################################################
-PLUGINCONFROOT=/etc/opt/openslx/plugins
-PLUGINCONFDIR=/etc/opt/openslx/plugins/vmchooser
# include general configuration from vmchooser
-[ -f /etc/openslx/vmchooser/vmchooser.conf ] && \
-. /etc/openslx/vmchooser/vmchooser.conf
+[ -f /opt/openslx/etc/vmchooser/vmchooser.conf ] && \
+. /opt/openslx/etc/vmchooser/vmchooser.conf
# load general virtualization information
-[ -f /etc/openslx/vmchooser/virtualization.conf ] && \
-. /etc/openslx/vmchooser/virtualization.conf
+[ -f /opt/openslx/etc/vmchooser/virtualization.conf ] && \
+. /opt/openslx/etc/vmchooser/virtualization.conf
################################################################################
### Functions used throughout the script
@@ -356,7 +354,7 @@ fdtest=${floppy_0:+"TRUE"}
# if $fdtest not set floppy0="FALSE", else "TRUE"
floppy0=${fdtest:-"FALSE"}
floppy1="TRUE"
-floppy1name="/etc/openslx/vmchooser/loopimg/fd.img"
+floppy1name="/opt/openslx/etc/vmchooser/loopimg/fd.img"
# if $cdrom_0 from run-virt.include set then cdtest="TRUE"
cdtest=
cdtest=${cdrom_0:+"TRUE"}
@@ -415,14 +413,14 @@ fi
# Copy guest configuration (with added information) config.xml to be accessed
# via virtual floppy
-cp "$xmlfile" "/etc/openslx/vmchooser/fd-loop/config.xml"
+cp "$xmlfile" "/opt/openslx/etc/vmchooser/fd-loop/config.xml"
# Add another file with resolution information
-xrandr | grep -o -E 'current\s*[0-9]+\s*x\s*[0-9]+' | cut -c 8- | sed -r 's/(\s|\t|\n)//g' | head -n 1 > "/etc/openslx/vmchooser/fd-loop/hostres.txt"
+xrandr | grep -o -E 'current\s*[0-9]+\s*x\s*[0-9]+' | cut -c 8- | sed -r 's/(\s|\t|\n)//g' | head -n 1 > "/opt/openslx/etc/vmchooser/fd-loop/hostres.txt"
# Get all virtual machine specific stuff from the respective include file
-if [ -e /etc/openslx/"${xmlvirt}"/run-virt.include ] ; then
+if [ -e /opt/openslx/etc/"${xmlvirt}"/run-virt.include ] ; then
self="${xmlvirt}"
- . /etc/openslx/"${xmlvirt}"/run-virt.include
+ . /opt/openslx/etc/"${xmlvirt}"/run-virt.include
# start a windowmanager for easier handling
# (expect problems /w windows opening in background /w vmware without wm)
for dm in twm xfwm4 metacity openbox blackbox kwin fvwm2 ; do
diff --git a/remote/modules/vmchooser/data/opt/openslx/bin/xmlfilter.sh b/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-xml_filter
index 67e49d3e..67e49d3e 100755
--- a/remote/modules/vmchooser/data/opt/openslx/bin/xmlfilter.sh
+++ b/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-xml_filter
diff --git a/remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/bwlehrpool/bwlehrpool-left.png b/remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/bwlehrpool/bwlehrpool-left.png
new file mode 100644
index 00000000..c9d8ab0d
--- /dev/null
+++ b/remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/bwlehrpool/bwlehrpool-left.png
Binary files differ
diff --git a/remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/bwlehrpool/bwlehrpool-right.png b/remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/bwlehrpool/bwlehrpool-right.png
new file mode 100644
index 00000000..8ca9347b
--- /dev/null
+++ b/remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/bwlehrpool/bwlehrpool-right.png
Binary files differ
diff --git a/remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/bwlehrpool/bwlehrpool.ini b/remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/bwlehrpool/bwlehrpool.ini
new file mode 100644
index 00000000..90d00617
--- /dev/null
+++ b/remote/modules/vmchooser/data/opt/openslx/usr/share/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/remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/openslx/openslx-left.png b/remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/openslx/openslx-left.png
new file mode 100644
index 00000000..900dd867
--- /dev/null
+++ b/remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/openslx/openslx-left.png
Binary files differ
diff --git a/remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/openslx/openslx-right.png b/remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/openslx/openslx-right.png
new file mode 100644
index 00000000..8ca9347b
--- /dev/null
+++ b/remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/openslx/openslx-right.png
Binary files differ
diff --git a/remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/openslx/openslx.ini b/remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/openslx/openslx.ini
new file mode 100644
index 00000000..57a22821
--- /dev/null
+++ b/remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/openslx/openslx.ini
@@ -0,0 +1,4 @@
+background-color=#ffffff
+image-right=openslx-right.png
+image-left=openslx-left.png
+
diff --git a/remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/planets/planets-left.png b/remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/planets/planets-left.png
new file mode 100644
index 00000000..c8736b72
--- /dev/null
+++ b/remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/planets/planets-left.png
Binary files differ
diff --git a/remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/planets/planets-right.png b/remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/planets/planets-right.png
new file mode 100644
index 00000000..e21f0d8b
--- /dev/null
+++ b/remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/planets/planets-right.png
Binary files differ
diff --git a/remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/planets/planets.ini b/remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/planets/planets.ini
new file mode 100644
index 00000000..d9aa17f6
--- /dev/null
+++ b/remote/modules/vmchooser/data/opt/openslx/usr/share/vmchooser/themes/planets/planets.ini
@@ -0,0 +1,4 @@
+background-color=#ffffff
+image-right=planets-right.png
+image-left=planets-left.png
+
diff --git a/remote/modules/vmchooser/data/opt/openslx/xsessions/default.desktop b/remote/modules/vmchooser/data/opt/openslx/xsessions/default.desktop
index d33615cf..66f97e68 100755
--- a/remote/modules/vmchooser/data/opt/openslx/xsessions/default.desktop
+++ b/remote/modules/vmchooser/data/opt/openslx/xsessions/default.desktop
@@ -4,7 +4,7 @@ Name=virtual machine chooser (default)
Name[de]=Virtuelle Maschine auswählen
Comment=This session starts the vm session chooser
Comment[de]=Diese Sitzung startet das Auswahlmenü für die vorhandenen Sitzungen
-Exec=/opt/openslx/bin/vmchooser -c /etc/openslx/vmchooser/vmchooser.conf
+Exec=/opt/openslx/bin/vmchooser -c /opt/openslx/etc/vmchooser/vmchooser.conf
TryExec=/opt/openslx/bin/vmchooser
Icon=
Type=Application