summaryrefslogtreecommitdiffstats
path: root/remote/modules/vmchooser/data/opt/openslx/scripts/systemd-vmchooser_env
diff options
context:
space:
mode:
authorDirk2013-12-06 18:58:20 +0100
committerDirk2013-12-06 18:58:20 +0100
commitc44f4fed95ed7e45b91e9d7448e1584401f6e04d (patch)
treea9467039b1c223fa7cb901100e898ddc8f21a921 /remote/modules/vmchooser/data/opt/openslx/scripts/systemd-vmchooser_env
parentMerge branch 'master' of dnbd3:openslx-ng/tm-scripts (diff)
downloadtm-scripts-c44f4fed95ed7e45b91e9d7448e1584401f6e04d.tar.gz
tm-scripts-c44f4fed95ed7e45b91e9d7448e1584401f6e04d.tar.xz
tm-scripts-c44f4fed95ed7e45b91e9d7448e1584401f6e04d.zip
Fixing the cdrom and floppy detection ...
Diffstat (limited to 'remote/modules/vmchooser/data/opt/openslx/scripts/systemd-vmchooser_env')
-rwxr-xr-xremote/modules/vmchooser/data/opt/openslx/scripts/systemd-vmchooser_env38
1 files changed, 25 insertions, 13 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 18f5db16..b429bb55 100755
--- a/remote/modules/vmchooser/data/opt/openslx/scripts/systemd-vmchooser_env
+++ b/remote/modules/vmchooser/data/opt/openslx/scripts/systemd-vmchooser_env
@@ -1,16 +1,28 @@
#!/bin/bash
+# Full bash required
+# -----------------------------------------------------------------------------
+# Copyright (c) 2007..2013 - RZ Uni FR
+# Copyright (c) 2007..2013 - 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/
+# -----------------------------------------------------------------------------
+# systemd-vmchooser_env
+# - This is the preparation script for the configuration of the virtuali-
+# zation tools used later on.
+################################################################################
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)
+# 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
+# from plugins/vmchooser/XX_vmchooser.sh
VMCHOOSER_DIR="/opt/openslx/vmchooser"
VMCHOOSER_CONF_DIR="$VMCHOOSER_DIR/config"
@@ -99,18 +111,18 @@ fi
# ip addr
echo "hostip=${SLX_PXE_CLIENT_IP}" >> "${VMCHOOSER_CONF_DIR}/virtualization.conf"
# hostname
-echo "hostname=${SLX_HOSTNAME}" >> "${VMCHOOSER_CONF_DIR}/virtualization.conf"
+echo "hostname=$(hostname -s)" >> "${VMCHOOSER_CONF_DIR}/virtualization.conf"
-# get further hw information
+# get further hw information and check for traces of available optical and floppy drives
j=0
-for i in $(cat /etc/openslx/hwinfo.cdrom); do
- echo "cdrom_$j=$i" >> "${VMCHOOSER_CONF_DIR}/virtualization.conf"
+for cdrom in $(dmesg|grep -i "Attached scsi CD-ROM sr" | sed "s,.*Attached scsi CD-ROM ,,"); do
+ echo "cdrom_$j=/dev/${cdrom}" >> "${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"
+for floppy in $(dmesg|grep -i "Floppy drive"|sed "s,.*(s): ,,;s, is .*,,"); do
+ echo "floppy_$j=/dev/${floppy}" >> "${VMCHOOSER_CONF_DIR}/virtualization.conf"
j=$(expr $j + 1)
done