From e23ba59267423a3ca67747dcdfd8884c9d5f7de8 Mon Sep 17 00:00:00 2001 From: David Runge Date: Sun, 9 Dec 2018 13:27:35 +0100 Subject: bin/realtime-suggestions: Adding check for virtualization/containerization. --- bin/realtime-suggestions | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/bin/realtime-suggestions b/bin/realtime-suggestions index cc552fe..c5e7355 100755 --- a/bin/realtime-suggestions +++ b/bin/realtime-suggestions @@ -2,6 +2,7 @@ set -euo pipefail +warning="WARNING:" change="CHANGE:" info="INFO:" kernel_config="/proc/config.gz" @@ -21,6 +22,20 @@ check_kernel_name() { fi } +check_virtualization() { + local virt_type="" + if command -v systemd-detect-virt >/dev/null 2>&1; then + set +e + virt_type=$(systemd-detect-virt) + set -e + if systemd-detect-virt -q; then + echo "$change Running in a virtual machine or container (type: ${virt_type}). This is not recommended!" + fi + else + echo "$warning Unable to detect if in a virtual machine." + fi +} + check_filesystems() { local mount_points=() local mount_point_data=() @@ -207,6 +222,7 @@ check_for_useful_tools() { check_kernel_name check_root +check_virtualization check_filesystems check_groups check_ulimits -- cgit v1.2.3-70-g09d2