summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2016-07-12 13:02:53 +0200
committerJonathan Bauer2016-07-12 13:02:53 +0200
commita2e4686cf67f80e29c902bbb3437c6926029b0e6 (patch)
treebf2e16fe38a167ab19ac9a3e355ba28e3592fdb9
parentMerge branch 'master' of git.openslx.org:openslx-ng/tm-scripts (diff)
parent[kernel-vanilla] 4.4.13 (diff)
downloadtm-scripts-a2e4686cf67f80e29c902bbb3437c6926029b0e6.tar.gz
tm-scripts-a2e4686cf67f80e29c902bbb3437c6926029b0e6.tar.xz
tm-scripts-a2e4686cf67f80e29c902bbb3437c6926029b0e6.zip
Merge branch 'master' of git.openslx.org:openslx-ng/tm-scripts
-rw-r--r--remote/modules/kernel-vanilla/module.conf2
-rw-r--r--remote/modules/run-virt/data/opt/openslx/scripts/includes/set_runvirt_hardware_variables.inc36
-rwxr-xr-xremote/modules/run-virt/data/opt/openslx/scripts/systemd-run_virt_env21
-rw-r--r--remote/modules/vmware/data/opt/openslx/vmchooser/vmware/includes/logging.inc2
-rw-r--r--remote/modules/xorg/module.conf1
-rw-r--r--remote/modules/xorg/module.conf.ubuntu1
-rw-r--r--remote/rootfs/rootfs-stage31/data/inc/activate_sysconfig6
-rw-r--r--remote/rootfs/rootfs-stage31/module.conf1
-rw-r--r--remote/rootfs/rootfs-stage31/module.conf.ubuntu1
9 files changed, 53 insertions, 18 deletions
diff --git a/remote/modules/kernel-vanilla/module.conf b/remote/modules/kernel-vanilla/module.conf
index fe822b91..a0973a2b 100644
--- a/remote/modules/kernel-vanilla/module.conf
+++ b/remote/modules/kernel-vanilla/module.conf
@@ -1,5 +1,5 @@
REQUIRED_BINARIES=""
REQUIRED_LIBRARIES=""
REQUIRED_DIRECTORIES=""
-REQUIRED_KERNEL="4.4.12"
+REQUIRED_KERNEL="4.4.13"
REQUIRED_GIT="git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git"
diff --git a/remote/modules/run-virt/data/opt/openslx/scripts/includes/set_runvirt_hardware_variables.inc b/remote/modules/run-virt/data/opt/openslx/scripts/includes/set_runvirt_hardware_variables.inc
index 1b386092..9a46bc88 100644
--- a/remote/modules/run-virt/data/opt/openslx/scripts/includes/set_runvirt_hardware_variables.inc
+++ b/remote/modules/run-virt/data/opt/openslx/scripts/includes/set_runvirt_hardware_variables.inc
@@ -2,8 +2,26 @@
# Include: Set hardware related variables #
###########################################
-# take last two digits of current pid...
-VM_ID=$(expr substr $$ $(expr ${#$} - 1) 2)
+get_vm_id() {
+ local script=${BASH_SOURCE[-1]}
+ [ -z "$script" ] && script="$0"
+ if [ -n "$script" ]; then
+ script=$(readlink -f "$script")
+ if [ -n "$script" ] && [ -s "$script" ]; then
+ #bingo
+ VM_ID=$(ps ax | grep -F "$script" | grep -v 'grep' | grep -o -- "${script}.*\$" | sort -u | wc -l)
+ if [ "$VM_ID" -gt 0 ]; then
+ [ "${#VM_ID}" -eq 1 ] && VM_ID="0${VM_ID}"
+ [ "${#VM_ID}" -gt 2 ] && VM_ID="${VM_ID:0:2}"
+ [ "${#VM_ID}" -eq 2 ] && return
+ fi
+ fi
+ fi
+ # fallback: take last two digits of current pid...
+ VM_ID=$(expr substr $$ $(expr ${#$} - 1) 2)
+}
+
+get_vm_id
# Make sure cpu_cores is not empty
cpu_cores=${cpu_cores:-"1"}
@@ -33,18 +51,16 @@ if [ -n "$mainvirtmem" ]; then
fi
hostmem="$[ $totalmem - $mem ]"
-# TODO: We should only generate the suffix here (last 3 octets) as the first 3 are
-# dependant on the virtualizer/emulator. Check if any run-virt.include still relies on
-# $macguestpart/$macaddr. If so, fix it to use its specific first 3 bytes
-# and append $macaddrssuffix
-macguestpart="00:50:56:${VM_ID}"
-machostpart=$(echo "${hostmacaddr}" | awk -F ":" '{print $(NF-1)":"$NF}')
-macaddr=$(echo "${macguestpart}:${machostpart}" | tr "[a-z]" "[A-Z]")
-macaddrsuffix=$(echo "${VM_ID}:${machostpart}" | tr "[a-z]" "[A-Z]")
+# Fill in VMID
+macaddrsuffix=$(echo "$macaddrsuffix" | sed "s/%VMID%/${VM_ID}/")
+if ! echo "$macaddrprefix" | grep -q -E '^[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}$'; then
+ slxlog "virt-mac" "Could not properly generate mac address prefix (got $macaddrprefix)"
+fi
if ! echo "$macaddrsuffix" | grep -q -E '^[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}$'; then
slxlog "virt-mac" "Could not properly generate mac address suffix (got $macaddrsuffix)"
fi
+macaddr="$macaddrprefix:$macaddrsuffix"
# Virtual fd/cd/dvd and drive devices, floppy b: for configuration
# if $floppy_0 from virtualization.conf set then fdtest="TRUE"
diff --git a/remote/modules/run-virt/data/opt/openslx/scripts/systemd-run_virt_env b/remote/modules/run-virt/data/opt/openslx/scripts/systemd-run_virt_env
index 5f9036ba..ba3122a1 100755
--- a/remote/modules/run-virt/data/opt/openslx/scripts/systemd-run_virt_env
+++ b/remote/modules/run-virt/data/opt/openslx/scripts/systemd-run_virt_env
@@ -28,6 +28,7 @@ export PATH=$PATH:/opt/openslx/bin:/opt/openslx/sbin
# from plugins/vmchooser/XX_vmchooser.sh
VMCHOOSER_DIR="/opt/openslx/vmchooser"
VMCHOOSER_CONF_DIR="$VMCHOOSER_DIR/config"
+DHCP_NAT_CONF="/opt/openslx/vmchooser/config/udhcpd-nat1.conf"
mkdir -p "${VMCHOOSER_DIR}/data/loopimg"
mkdir -p "${VMCHOOSER_DIR}/fd-loop" -m 1777
@@ -104,10 +105,20 @@ fi
# write mac
if [ -n "$SLX_PXE_MAC" ]; then
- echo "hostmacaddr=${SLX_PXE_MAC}" >> "${VMCHOOSER_CONF_DIR}/virtualization.conf"
+ hostmacaddr="${SLX_PXE_MAC}"
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"
+ hostmacaddr="$(ip a | grep ether | grep -o -E -i '([0-9a-f]{2}:){5}[0-9a-f]{2}' | head -n 1)"
fi
+echo "hostmacaddr='$hostmacaddr'" >> "${VMCHOOSER_CONF_DIR}/virtualization.conf"
+# TODO: We should only generate the suffix here (last 3 octets) as the first 3 are
+# dependant on the virtualizer/emulator. Check if any run-virt.include still relies on
+# $macguestpart/$macaddr. If so, fix it to use its specific first 3 bytes
+# and append $macaddrssuffix
+macaddrprefix='00:50:56'
+macaddrsuffix="$(echo "$hostmacaddr" | awk -F ":" '{print "%VMID%:" $(NF-1) ":" $NF}' | tr '[a-z]' '[A-Z]')"
+echo "macaddrprefix='$macaddrprefix'" >> "${VMCHOOSER_CONF_DIR}/virtualization.conf"
+echo "macaddrsuffix='$macaddrsuffix'" >> "${VMCHOOSER_CONF_DIR}/virtualization.conf"
+
# read in ip address
echo "hostip=${SLX_PXE_CLIENT_IP}" >> "${VMCHOOSER_CONF_DIR}/virtualization.conf"
# hostname
@@ -166,10 +177,12 @@ done
# read the DNS configuration and configure the udhcpd
[ -z "${SLX_DNS}" ] && SLX_DNS="8.8.8.8"
sed -i "s,DNSSERVER,${SLX_DNS},;s,DOMAIN,${SLX_NET_DOMAIN}," \
- /opt/openslx/vmchooser/config/udhcpd-nat1.conf
+ "${DHCP_NAT_CONF}"
+
+echo "static_lease $(echo "$macaddrprefix:$macaddrsuffix" | sed 's/%VMID%/01/') 192.168.101.20" >> "${DHCP_NAT_CONF}"
mkdir -p /var/lib/udhcpd
-udhcpd -S /opt/openslx/vmchooser/config/udhcpd-nat1.conf
+udhcpd -S "${DHCP_NAT_CONF}"
# creating and configuring vsw2
brctl addbr vsw2
diff --git a/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/includes/logging.inc b/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/includes/logging.inc
index 160fbc17..f7ee634a 100644
--- a/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/includes/logging.inc
+++ b/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/includes/logging.inc
@@ -19,7 +19,7 @@ logging() {
writelog "\t/tmp info: $(grep "/tmp " /proc/mounts) $(df -h | grep " /tmp$" | awk '{print $2}')"
# hw setup
writelog "Hardware:"
- writelog "\tMAC:\t\t00:50:56:$macaddrsuffix" # TODO: Make var at top for this, it's hard coded twice
+ writelog "\tMAC:\t\t$macaddr"
if [ -n "${network_card}" ]; then
writelog "\tNet Adaptor:\t${network_card}"
fi
diff --git a/remote/modules/xorg/module.conf b/remote/modules/xorg/module.conf
index 929fc8e5..2fc6ab94 100644
--- a/remote/modules/xorg/module.conf
+++ b/remote/modules/xorg/module.conf
@@ -10,6 +10,7 @@ REQUIRED_BINARIES="
xkbbell
xkbevd
xrandr
+ xset
xkbcomp
vmmouse_detect
"
diff --git a/remote/modules/xorg/module.conf.ubuntu b/remote/modules/xorg/module.conf.ubuntu
index f0517f66..90a46747 100644
--- a/remote/modules/xorg/module.conf.ubuntu
+++ b/remote/modules/xorg/module.conf.ubuntu
@@ -2,6 +2,7 @@ REQUIRED_INSTALLED_PACKAGES="
fonts-dejavu-core
fonts-dejavu-extra
ttf-dejavu-core
+ x11-xserver-utils
"
REQUIRED_CONTENT_PACKAGES="
xserver-xorg$UBUNTU_XORG_PKG_SUFFIX
diff --git a/remote/rootfs/rootfs-stage31/data/inc/activate_sysconfig b/remote/rootfs/rootfs-stage31/data/inc/activate_sysconfig
index 135408f3..39680afc 100644
--- a/remote/rootfs/rootfs-stage31/data/inc/activate_sysconfig
+++ b/remote/rootfs/rootfs-stage31/data/inc/activate_sysconfig
@@ -5,6 +5,8 @@ echo "Configuring stage 3.2 ..."
# first a few variables
CONFIG="${FUTURE_ROOT}/opt/openslx/config"
+UUID=$(dmidecode -s system-uuid | grep -m1 -E '^[0-9A-F\-]{36}$')
+
#########################################################################
#
# This function downloads the config containing environment variables
@@ -13,7 +15,7 @@ fetch_sysconfig() {
[ -e "$CONFIG" ] && grep -E '^#_RCONFIG_TAG$' "$CONFIG" > /dev/null \
&& echo "Config already fetched." && return 0
- download "${SLX_BASE_PATH}/config" "${CONFIG}-remote" || return 1
+ download "${SLX_BASE_PATH}/config?uuid=${UUID}" "${CONFIG}-remote" || return 1
echo "# Config fetched from $URL" >> "$CONFIG"
echo "#_RCONFIG_TAG" >> "$CONFIG"
@@ -26,7 +28,7 @@ fetch_sysconfig() {
fetch_config_files() {
[ -e "${CONFIG}.tgz" ] && echo "config.tgz already downloaded." && return 0
- download "${SLX_BASE_PATH}/config.tgz" "${CONFIG}.tgz"
+ download "${SLX_BASE_PATH}/config.tgz?uuid=${UUID}" "${CONFIG}.tgz"
}
diff --git a/remote/rootfs/rootfs-stage31/module.conf b/remote/rootfs/rootfs-stage31/module.conf
index b41b1f10..e09e744b 100644
--- a/remote/rootfs/rootfs-stage31/module.conf
+++ b/remote/rootfs/rootfs-stage31/module.conf
@@ -1,5 +1,6 @@
REQUIRED_BINARIES="
ntpdate
+ dmidecode
"
REQUIRED_MODULES="
busybox
diff --git a/remote/rootfs/rootfs-stage31/module.conf.ubuntu b/remote/rootfs/rootfs-stage31/module.conf.ubuntu
index 35c9927b..6ced7b11 100644
--- a/remote/rootfs/rootfs-stage31/module.conf.ubuntu
+++ b/remote/rootfs/rootfs-stage31/module.conf.ubuntu
@@ -1,3 +1,4 @@
REQUIRED_INSTALLED_PACKAGES="
ntpdate
+ dmidecode
"