From 7e48746242b55da3fb215d74f0eb69ea0afddc81 Mon Sep 17 00:00:00 2001 From: Henrik Riomar Date: Thu, 16 Feb 2017 23:22:09 +0100 Subject: [PATCH] apk; try to use virt-what If searching dmesg for Hypervisor info fails, try virt-what detection (if installed). While at it fix the sudoers file Upstream-Issue: https://github.com/DE-IBH/apt-dater-host/pull/17 --- apk/apt-dater-host | 9 ++++++++- apk/apt-dater-host-sudoers | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/apk/apt-dater-host b/apk/apt-dater-host index a5862ae..2164dea 100755 --- a/apk/apt-dater-host +++ b/apk/apt-dater-host @@ -31,6 +31,7 @@ ADP_VERSION="0.6" ROOT_CMD="sudo" APK_CMD="/sbin/apk" +VIRT_WHAT_CMD="/usr/sbin/virt-what --test-root=/" err=255 # exit code returned by Perl from die() @@ -97,7 +98,13 @@ get_virt() if [ -n "$virt" ]; then echo "VIRT: $virt" else - echo "VIRT: Unknown" + virt=$($VIRT_WHAT_CMD 2> /dev/null) + ret=$? + if [ -z "$virt" ]; then + [ $ret -eq 0 ] && echo "VIRT: Physical" || echo "VIRT: Unknown" + else + echo "VIRT: $(echo $virt | awk '{print $1}')" + fi fi } diff --git a/apk/apt-dater-host-sudoers b/apk/apt-dater-host-sudoers index 6fc868c..ba3dd3d 100644 --- a/apk/apt-dater-host-sudoers +++ b/apk/apt-dater-host-sudoers @@ -6,4 +6,4 @@ #Defaults env_keep += http_proxy # Allow members of group adm to execute the apk command -%adm ALL=NOPASSWD: /sbin/apk +#%adm ALL=NOPASSWD: /sbin/apk -- 2.11.1