summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2016-09-01 14:25:33 +0200
committerroot2016-09-01 14:25:33 +0200
commit9feb645feedb66412408b9562ccac74d86f6f822 (patch)
treedceb8e5ae10ec3ea7c7a581e5140e4d4ae315cc6
parent[vmchooser2] Extend remote logging format (diff)
downloadtm-scripts-9feb645feedb66412408b9562ccac74d86f6f822.tar.gz
tm-scripts-9feb645feedb66412408b9562ccac74d86f6f822.tar.xz
tm-scripts-9feb645feedb66412408b9562ccac74d86f6f822.zip
[dmidecode] New module: Compile on our own so we support 'em all
The distro's dmidecode might be a little out of date and won't support all the latest hardware at all times.
-rw-r--r--remote/modules/dmidecode/module.build27
-rw-r--r--remote/modules/dmidecode/module.conf4
-rwxr-xr-xremote/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats4
-rw-r--r--remote/modules/hardware-stats/module.conf4
4 files changed, 36 insertions, 3 deletions
diff --git a/remote/modules/dmidecode/module.build b/remote/modules/dmidecode/module.build
new file mode 100644
index 00000000..1d58d03c
--- /dev/null
+++ b/remote/modules/dmidecode/module.build
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+
+fetch_source() {
+ [ -d "${MODULE_DIR}/src/.git" ] && return 0
+ rm -rf -- "${MODULE_DIR}/src"
+ git clone "${REQUIRED_GIT}" "${MODULE_DIR}/src" || perror "Could not create ${MODULE_DIR}/src"
+}
+
+build() {
+
+ # compilation
+ cd "${MODULE_DIR}/src" || perror "Could not cd to '${MODULE_DIR}/src'. Did fetch_source work?"
+
+ make || perror "Could not compile dmidecode using 'make'."
+
+ # NO MAKE INSTALL: Copy to build dir, since there are no shared libs linked in
+ mkdir -p "${MODULE_BUILD_DIR}/usr/sbin"
+ cp "${MODULE_DIR}/src/dmidecode" "${MODULE_BUILD_DIR}/usr/sbin/" || perror "Could not copy dmidecode binary to ${MODULE_BUILD_DIR}"
+
+ cd - &>/dev/null
+}
+
+post_copy() {
+ :
+}
+
diff --git a/remote/modules/dmidecode/module.conf b/remote/modules/dmidecode/module.conf
new file mode 100644
index 00000000..3f58cff4
--- /dev/null
+++ b/remote/modules/dmidecode/module.conf
@@ -0,0 +1,4 @@
+REQUIRED_GIT="git://git.savannah.nongnu.org/dmidecode.git"
+REQUIRED_BINARIES="
+ dmidecode
+"
diff --git a/remote/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats b/remote/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats
index 4227070f..5a776054 100755
--- a/remote/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats
+++ b/remote/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats
@@ -40,7 +40,7 @@ fi
MAC=${BOOTIF:3}
# 2) Get machine UUID, with fallback to MAC address if it fails for some reason
-UUID=$(dmidecode -q -s system-uuid | head -n 1)
+UUID=$(dmidecode -q -s system-uuid | grep -v '^#' | head -n 1)
if [ "${#UUID}" -ne "36" ]; then
echo "Determined UUID (${UUID}) has not expected length of 36, falling back to MAC..."
UUID="000000000000000-$BOOTIF"
@@ -143,7 +143,7 @@ fi
# A) Read system model and manufacturer
dmidec() {
- local LMODEL=$(dmidecode "$@" 2>/dev/null | grep -v '^Invalid' | sed 's/\s\s*/ /g;s/^ //;s/ $//')
+ local LMODEL=$(dmidecode "$@" 2>/dev/null | grep -v '^#' | grep -v '^Invalid' | sed 's/\s\s*/ /g;s/^ //;s/ $//')
case "$LMODEL" in
""|*"Product Name"*|*"be filled"*|"unknown"|*"product name"*)
LMODEL="Unknown"
diff --git a/remote/modules/hardware-stats/module.conf b/remote/modules/hardware-stats/module.conf
index 5850b267..8e371d5b 100644
--- a/remote/modules/hardware-stats/module.conf
+++ b/remote/modules/hardware-stats/module.conf
@@ -1,6 +1,8 @@
+REQUIRED_MODULES="
+ dmidecode
+"
REQUIRED_BINARIES="
rdmsr
- dmidecode
blockdev
"