aboutsummaryrefslogtreecommitdiffstats
path: root/testing/apt-dater-host
diff options
context:
space:
mode:
authorHenrik Riomar <henrik.riomar@gmail.com>2017-03-02 08:03:31 +0100
committerWilliam Pitcock <nenolod@dereferenced.org>2017-03-02 16:01:02 +0000
commitf15755e5e7c648936ec422aeb01b7a1e4ec5ff78 (patch)
tree2e2af11ed0dfaed50cf9ee682e69da5613217fda /testing/apt-dater-host
parent67880ae607c02275a085b2bf4752a1e002c7f511 (diff)
downloadaports-f15755e5e7c648936ec422aeb01b7a1e4ec5ff78.tar.bz2
aports-f15755e5e7c648936ec422aeb01b7a1e4ec5ff78.tar.xz
testing/apt-dater-host: use virt-what if installed
While at it change to better defaults in sudoers file
Diffstat (limited to 'testing/apt-dater-host')
-rw-r--r--testing/apt-dater-host/0001-apk-try-to-use-virt-what.patch54
-rw-r--r--testing/apt-dater-host/APKBUILD14
2 files changed, 65 insertions, 3 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
+
diff --git a/testing/apt-dater-host/APKBUILD b/testing/apt-dater-host/APKBUILD
index e639bc2367..ef0e319a2a 100644
--- a/testing/apt-dater-host/APKBUILD
+++ b/testing/apt-dater-host/APKBUILD
@@ -3,7 +3,7 @@
pkgname=apt-dater-host
pkgver=1.0.0
_pkgver=c3d10e0
-pkgrel=0
+pkgrel=1
pkgdesc="host helper application for apt-dater"
url="https://github.com/DE-IBH/apt-dater-host"
arch="noarch"
@@ -12,9 +12,16 @@ depends=""
makedepends=""
install=""
subpackages="$pkgname-doc"
-source="apt-dater-host-$pkgver-g$_pkgver.tar.gz::https://github.com/DE-IBH/apt-dater-host/archive/$_pkgver.tar.gz"
+source="apt-dater-host-$pkgver-g$_pkgver.tar.gz::https://github.com/DE-IBH/apt-dater-host/archive/$_pkgver.tar.gz
+ 0001-apk-try-to-use-virt-what.patch
+ "
builddir="$srcdir/"
+prepare() {
+ cd "$builddir"/"$pkgname"-"$_pkgver"*/ || return 1
+ patch -p1 -i "$srcdir"/0001-apk-try-to-use-virt-what.patch
+}
+
package() {
cd "$builddir"/"$pkgname"-"$_pkgver"*/apk || return 1
make install DESTDIR="$pkgdir" || return 1
@@ -23,4 +30,5 @@ package() {
install -m0644 "$pkgname".1 "$pkgdir"/usr/share/man/man1 || return 1
}
-sha512sums="5398d94209ed0ef8faaf9086240e35d28047c81ac001dc9b55165c4d7505ca7a33eb68101c1357f40c6ef74d5c224bb8d75cf9f9d06676794e828b1f49b01c04 apt-dater-host-1.0.0-gc3d10e0.tar.gz"
+sha512sums="5398d94209ed0ef8faaf9086240e35d28047c81ac001dc9b55165c4d7505ca7a33eb68101c1357f40c6ef74d5c224bb8d75cf9f9d06676794e828b1f49b01c04 apt-dater-host-1.0.0-gc3d10e0.tar.gz
+d93a7dc7e1e119bc948a4eb401a46d8ef28243b78d848194d1c86949da9f02ac01e556ff1c77fa0cf3b219403b5d55b48286cc8729d3e7cc1355b80f33fbabd9 0001-apk-try-to-use-virt-what.patch"