Commit ae72fb1b authored by Henrik Riomar's avatar Henrik Riomar Committed by Jakub Jirutka

community/apt-dater-host: improve-Machine-Type-reporting

See https://github.com/DE-IBH/apt-dater-host/pull/24
parent a7a19674
......@@ -2,7 +2,7 @@
# Maintainer: Henrik Riomar <henrik.riomar@gmail.com>
pkgname=apt-dater-host
pkgver=1.0.1
pkgrel=0
pkgrel=1
pkgdesc="Host helper application for apt-dater"
url="https://github.com/DE-IBH/apt-dater-host"
arch="noarch"
......@@ -11,6 +11,7 @@ checkdepends="bats checkbashisms"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/DE-IBH/$pkgname/archive/v$pkgver.tar.gz
apt-dater-host-fix-bashisms.patch
apk-improve-Machine-Type-reporting.patch
"
builddir="$srcdir/$pkgname-$pkgver"
......@@ -31,4 +32,5 @@ package() {
install -m0644 "$pkgname".1 "$pkgdir"/usr/share/man/man1
}
sha512sums="52d48ade6758cb1150be2f21ed4c9831b4254ccc749ae865321abea077737a49ff7aeefb4e643aa289d953d2847dcf83e94837fe510fa8f8bfe19cfda0fd9dbc apt-dater-host-1.0.1.tar.gz
6f695e1b1785f88217b5a32c509b5cb3c7a3f70069b042ad9770a4c1e86c4477abab2763579130f65e0c880976eb9f292bed3b42dda0d25e801696db479e55e8 apt-dater-host-fix-bashisms.patch"
6f695e1b1785f88217b5a32c509b5cb3c7a3f70069b042ad9770a4c1e86c4477abab2763579130f65e0c880976eb9f292bed3b42dda0d25e801696db479e55e8 apt-dater-host-fix-bashisms.patch
f56c38f9f8af119517965da8fe65a8d55f1e489ae8b3402cb72c55a7b876a658ee6dd7042342922fac3e5e59e872555914ca8e2f8dd723e98566ce6b16c341ce apk-improve-Machine-Type-reporting.patch"
From f90d99ca8c4a04396d94ef42abe794d6ce75173b Mon Sep 17 00:00:00 2001
From: Henrik Riomar <henrik.riomar@gmail.com>
Date: Sat, 27 Jan 2018 19:50:38 +0100
Subject: [PATCH] apk: improve Machine Type reporting
Report Xen-PV, xen-dom0 or xen-domU to apt-dater (instead of just xen).
---
apk/apt-dater-host | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/apk/apt-dater-host b/apk/apt-dater-host
index 25c9fb8..3bd8829 100755
--- a/apk/apt-dater-host
+++ b/apk/apt-dater-host
@@ -4,13 +4,13 @@
#
# Implementation of the protocol described in
# https://github.com/DE-IBH/apt-dater-host/blob/master/doc/ADP-0.6
-# using Busybox ash, awk and sed for use with Alpine Linux
+# using Busybox ash, awk, sed, and tr for use with Alpine Linux
#
# Author:
# Henrik Riomar <henrik.riomar@gmail.com>
#
# Copyright Holder:
-# 2016, 2017 (C) Henrik Riomar
+# 2016-2018 (C) Henrik Riomar
#
# License:
# This program is free software; you can redistribute it and/or modify
@@ -32,6 +32,7 @@ ADP_VERSION="0.6"
ROOT_CMD="sudo"
APK_CMD="/sbin/apk"
VIRT_WHAT_CMD="/usr/sbin/virt-what --test-root=/"
+DMESG_CMD="dmesg"
err=255 # exit code returned by Perl from die()
@@ -94,16 +95,16 @@ get_pkg_stat()
# VIRT: ${Name}
get_virt()
{
- virt=$(dmesg | awk '/Hypervisor detected:/ {print $NF}')
+ virt=$($DMESG_CMD | awk -F': ' '/Hypervisor detected:/ {print $NF}')
if [ -n "$virt" ]; then
- echo "VIRT: $virt"
+ echo "VIRT: $(echo "$virt" | tr -s ' ' '-')"
else
- virt=$($VIRT_WHAT_CMD 2> /dev/null)
+ virt=$($VIRT_WHAT_CMD 2> /dev/null | tail -1)
ret=$?
if [ -z "$virt" ]; then
[ $ret -eq 0 ] && echo "VIRT: Physical" || echo "VIRT: Unknown"
else
- echo "VIRT: $(echo $virt | awk '{print $1}')"
+ echo "VIRT: $(echo "$virt" | tr -s ' ' '-')"
fi
fi
}
--
2.11.0
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment