diff options
Diffstat (limited to 'testing/apt-dater-host/0001-apk-try-to-use-virt-what.patch')
-rw-r--r-- | testing/apt-dater-host/0001-apk-try-to-use-virt-what.patch | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/testing/apt-dater-host/0001-apk-try-to-use-virt-what.patch b/testing/apt-dater-host/0001-apk-try-to-use-virt-what.patch new file mode 100644 index 0000000000..8e106b58ad --- /dev/null +++ b/testing/apt-dater-host/0001-apk-try-to-use-virt-what.patch @@ -0,0 +1,54 @@ +From 7e48746242b55da3fb215d74f0eb69ea0afddc81 Mon Sep 17 00:00:00 2001 +From: Henrik Riomar <henrik.riomar@gmail.com> +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 +--- + 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 + |