aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2018-12-09 13:27:35 +0100
committerDavid Runge <dave@sleepmap.de>2018-12-09 13:27:35 +0100
commite23ba59267423a3ca67747dcdfd8884c9d5f7de8 (patch)
treee8b8b96eb5596f0f4e17cbedfa96b46540f8d84d
parent96390cd99308fe253aa6a6e811c806db9137395f (diff)
downloaddotfiles-e23ba59267423a3ca67747dcdfd8884c9d5f7de8.tar.gz
dotfiles-e23ba59267423a3ca67747dcdfd8884c9d5f7de8.tar.bz2
dotfiles-e23ba59267423a3ca67747dcdfd8884c9d5f7de8.tar.xz
dotfiles-e23ba59267423a3ca67747dcdfd8884c9d5f7de8.zip
bin/realtime-suggestions: Adding check for virtualization/containerization.
-rwxr-xr-xbin/realtime-suggestions16
1 files changed, 16 insertions, 0 deletions
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