mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-08-06 13:57:14 +02:00
testing/apt-dater-host: upgrade to 1.0.1
Drop patches that are now in upstream
This commit is contained in:
parent
89b194c36d
commit
e975641dc8
@ -1,94 +0,0 @@
|
|||||||
From 93ce508fdd073f652d148425eb1f4bf48edd7cee Mon Sep 17 00:00:00 2001
|
|
||||||
From: Henrik Riomar <henrik.riomar@gmail.com>
|
|
||||||
Date: Wed, 15 Mar 2017 06:38:05 +0100
|
|
||||||
Subject: [PATCH] apk: add some unit tests, called via "make check"
|
|
||||||
|
|
||||||
---
|
|
||||||
apk/Makefile | 3 +++
|
|
||||||
apk/apt-dater-host | 6 +++++-
|
|
||||||
apk/test-apt-dater-host | 36 ++++++++++++++++++++++++++++++++++++
|
|
||||||
3 files changed, 44 insertions(+), 1 deletion(-)
|
|
||||||
create mode 100755 apk/test-apt-dater-host
|
|
||||||
|
|
||||||
diff --git a/apk/Makefile b/apk/Makefile
|
|
||||||
index 227f366..dfe7d9e 100644
|
|
||||||
--- a/apk/Makefile
|
|
||||||
+++ b/apk/Makefile
|
|
||||||
@@ -1,5 +1,8 @@
|
|
||||||
clean:
|
|
||||||
|
|
||||||
+check:
|
|
||||||
+ ./test-apt-dater-host
|
|
||||||
+
|
|
||||||
install:
|
|
||||||
install -D -m0755 apt-dater-host \
|
|
||||||
$(DESTDIR)/usr/bin/apt-dater-host
|
|
||||||
diff --git a/apk/apt-dater-host b/apk/apt-dater-host
|
|
||||||
index 2164dea..e0c9b65 100755
|
|
||||||
--- a/apk/apt-dater-host
|
|
||||||
+++ b/apk/apt-dater-host
|
|
||||||
@@ -10,7 +10,7 @@
|
|
||||||
# Henrik Riomar <henrik.riomar@gmail.com>
|
|
||||||
#
|
|
||||||
# Copyright Holder:
|
|
||||||
-# 2016 (C) Henrik Riomar
|
|
||||||
+# 2016,2017 (C) Henrik Riomar
|
|
||||||
#
|
|
||||||
# License:
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
@@ -212,6 +212,10 @@ case "$1" in
|
|
||||||
get_kern
|
|
||||||
;;
|
|
||||||
|
|
||||||
+ source-only)
|
|
||||||
+ # do nothing (used for unit testing)
|
|
||||||
+ ;;
|
|
||||||
+
|
|
||||||
*)
|
|
||||||
echo Invalid command \'$1\'\!
|
|
||||||
exit $err
|
|
||||||
diff --git a/apk/test-apt-dater-host b/apk/test-apt-dater-host
|
|
||||||
new file mode 100755
|
|
||||||
index 0000000..eef6d2b
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/apk/test-apt-dater-host
|
|
||||||
@@ -0,0 +1,36 @@
|
|
||||||
+#!/usr/bin/env bats
|
|
||||||
+
|
|
||||||
+source ./apt-dater-host source-only
|
|
||||||
+
|
|
||||||
+check_tag()
|
|
||||||
+{
|
|
||||||
+ TAG=$1
|
|
||||||
+ STR=$2
|
|
||||||
+ [ $(echo $STR | grep -E -v -c "^$TAG:") -eq 0 ]
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+@test "say_hi()" {
|
|
||||||
+ result="$(say_hi)"
|
|
||||||
+ check_tag ADPROTO $result
|
|
||||||
+ [ "$result" = "ADPROTO: 0.6" ]
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+@test "get_lsbrel()" {
|
|
||||||
+ result="$(get_lsbrel)"
|
|
||||||
+ check_tag LSBREL $result
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+@test "get_pkg_stat()" {
|
|
||||||
+ result="$(get_pkg_stat)"
|
|
||||||
+ check_tag STATUS $result
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+@test "get_virt()" {
|
|
||||||
+ result="$(get_virt)"
|
|
||||||
+ check_tag VIRT $result
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+@test "get_kern()" {
|
|
||||||
+ result="$(get_kern)"
|
|
||||||
+ check_tag KERNELINFO $result
|
|
||||||
+}
|
|
||||||
--
|
|
||||||
2.13.0
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
|||||||
From 28d424bdd838821c38170fe9120b9ceec809e8da Mon Sep 17 00:00:00 2001
|
|
||||||
From: Henrik Riomar <henrik.riomar@gmail.com>
|
|
||||||
Date: Fri, 19 May 2017 17:22:17 +0200
|
|
||||||
Subject: [PATCH] apk: handle packages installed with Repository_pinning
|
|
||||||
|
|
||||||
If the package is pinned the last element of the version
|
|
||||||
line will contain @<pin name>, strip that before getting the
|
|
||||||
version number.
|
|
||||||
|
|
||||||
https://wiki.alpinelinux.org/wiki/Alpine_Linux_package_management#Repository_pinning
|
|
||||||
---
|
|
||||||
apk/apt-dater-host | 4 ++--
|
|
||||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/apk/apt-dater-host b/apk/apt-dater-host
|
|
||||||
index e0c9b65..cc0a1eb 100755
|
|
||||||
--- a/apk/apt-dater-host
|
|
||||||
+++ b/apk/apt-dater-host
|
|
||||||
@@ -10,7 +10,7 @@
|
|
||||||
# Henrik Riomar <henrik.riomar@gmail.com>
|
|
||||||
#
|
|
||||||
# Copyright Holder:
|
|
||||||
-# 2016,2017 (C) Henrik Riomar
|
|
||||||
+# 2016, 2017 (C) Henrik Riomar
|
|
||||||
#
|
|
||||||
# License:
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
@@ -71,7 +71,7 @@ get_pkg_stat()
|
|
||||||
$APK_CMD info | while read -r pkg
|
|
||||||
do
|
|
||||||
line=$(grep -E "^${pkg}-[0-9]" $tmp)
|
|
||||||
- new_ver=$(echo $line | awk '{print $NF}')
|
|
||||||
+ new_ver=$(echo $line | sed 's/ @.\+$//' | awk '{print $NF}')
|
|
||||||
cur_ver=$(echo $line | awk '{print $1}' | sed "s/$pkg-//")
|
|
||||||
if [ x"$new_ver" = x"$cur_ver" ]; then
|
|
||||||
echo "STATUS: $pkg|$cur_ver|i"
|
|
||||||
--
|
|
||||||
2.13.0
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
|||||||
From 77f70cd961923e9caa5e5a83bf32eeb5ea125255 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Henrik Riomar <henrik.riomar@gmail.com>
|
|
||||||
Date: Fri, 19 May 2017 17:28:24 +0200
|
|
||||||
Subject: [PATCH] apk: an alpine package can be held back with < as well
|
|
||||||
|
|
||||||
https://wiki.alpinelinux.org/wiki/Alpine_Linux_package_management#Holding_a_specific_package_back
|
|
||||||
---
|
|
||||||
apk/apt-dater-host | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/apk/apt-dater-host b/apk/apt-dater-host
|
|
||||||
index cc0a1eb..25c9fb8 100755
|
|
||||||
--- a/apk/apt-dater-host
|
|
||||||
+++ b/apk/apt-dater-host
|
|
||||||
@@ -52,7 +52,7 @@ get_prl()
|
|
||||||
# check if a pkg is held back
|
|
||||||
is_held()
|
|
||||||
{
|
|
||||||
- grep -E -q ^$1\= /etc/apk/world
|
|
||||||
+ grep -E -q -e ^$1\= -e ^$1\< /etc/apk/world
|
|
||||||
}
|
|
||||||
|
|
||||||
# check if $1 > $2
|
|
||||||
--
|
|
||||||
2.13.0
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
|||||||
# Contributor: Henrik Riomar <henrik.riomar@gmail.com>
|
# Contributor: Henrik Riomar <henrik.riomar@gmail.com>
|
||||||
# Maintainer: Henrik Riomar <henrik.riomar@gmail.com>
|
# Maintainer: Henrik Riomar <henrik.riomar@gmail.com>
|
||||||
pkgname=apt-dater-host
|
pkgname=apt-dater-host
|
||||||
pkgver=1.0.0
|
pkgver=1.0.1
|
||||||
pkgrel=5
|
pkgrel=0
|
||||||
pkgdesc="Host helper application for apt-dater"
|
pkgdesc="Host helper application for apt-dater"
|
||||||
url="https://github.com/DE-IBH/apt-dater-host"
|
url="https://github.com/DE-IBH/apt-dater-host"
|
||||||
arch="noarch"
|
arch="noarch"
|
||||||
@ -10,23 +10,11 @@ license="GPL-2.0-or-later"
|
|||||||
checkdepends="bats checkbashisms"
|
checkdepends="bats checkbashisms"
|
||||||
subpackages="$pkgname-doc"
|
subpackages="$pkgname-doc"
|
||||||
source="$pkgname-$pkgver.tar.gz::https://github.com/DE-IBH/$pkgname/archive/v$pkgver.tar.gz
|
source="$pkgname-$pkgver.tar.gz::https://github.com/DE-IBH/$pkgname/archive/v$pkgver.tar.gz
|
||||||
initial-support-for-alpine.patch
|
|
||||||
try-to-use-virt-what.patch
|
|
||||||
0001-apk-add-some-unit-tests-called-via-make-check.patch
|
|
||||||
0002-apk-handle-packages-installed-with-Repository_pinnin.patch
|
|
||||||
0003-apk-an-alpine-package-can-be-held-back-with-as-well.patch
|
|
||||||
apt-dater-host-fix-bashisms.patch
|
apt-dater-host-fix-bashisms.patch
|
||||||
"
|
"
|
||||||
|
|
||||||
builddir="$srcdir/$pkgname-$pkgver"
|
builddir="$srcdir/$pkgname-$pkgver"
|
||||||
|
|
||||||
prepare() {
|
|
||||||
default_prepare
|
|
||||||
|
|
||||||
cd "$builddir"
|
|
||||||
chmod a+x apk/test-apt-dater-host
|
|
||||||
}
|
|
||||||
|
|
||||||
check() {
|
check() {
|
||||||
cd "$builddir"/apk
|
cd "$builddir"/apk
|
||||||
make check
|
make check
|
||||||
@ -42,10 +30,5 @@ package() {
|
|||||||
install -d -m0755 "$pkgdir"/usr/share/man/man1
|
install -d -m0755 "$pkgdir"/usr/share/man/man1
|
||||||
install -m0644 "$pkgname".1 "$pkgdir"/usr/share/man/man1
|
install -m0644 "$pkgname".1 "$pkgdir"/usr/share/man/man1
|
||||||
}
|
}
|
||||||
sha512sums="db750d1c33e425de315ecfe4d7d1a177b64432070ce355adfe24ebf7510f4f3d64522f57578a1157394255ec4c13d5d6fd20639dfdf2a69a94f9364ec1b1a6c8 apt-dater-host-1.0.0.tar.gz
|
sha512sums="52d48ade6758cb1150be2f21ed4c9831b4254ccc749ae865321abea077737a49ff7aeefb4e643aa289d953d2847dcf83e94837fe510fa8f8bfe19cfda0fd9dbc apt-dater-host-1.0.1.tar.gz
|
||||||
8f427b0f6bf240b753e66e61f4ff069ae5fb46ea2c87df5b0ba6126ccb21d3b104b37af8260da0925eabedecf7e43fee2adf57fb6b1112c309c84817aa8a74c9 initial-support-for-alpine.patch
|
|
||||||
105b10a811a39b78ed8764318bceb7c44f7dd9781f49bd7b8ce09fc7011e3dd88b41037a5a82f9b05b1324914fab4baa87c836f613cafea606554abe7b35c139 try-to-use-virt-what.patch
|
|
||||||
d316c9cb8d465112b7c838103a6d0fe5acf437819bf3a7e8d51a2e317cded71d53a36f6db980f71f5aa789ee28c9ffbfd2af2a333e3ae16fcd4ac05cf48c84bc 0001-apk-add-some-unit-tests-called-via-make-check.patch
|
|
||||||
ee606e48869c83b4f36515e3ffc23be1f99779aab848414601cf86722122fa2c433283dba6872571ec47af1a0b83d38f21dfa054221f7196b0273e7fce4904e5 0002-apk-handle-packages-installed-with-Repository_pinnin.patch
|
|
||||||
bea084d448e1679e3910cb642177182a5ae75505b334b909989a4cdfaf1b5059286f90fcfcd39deb3e504a1816e5ba662e4c4c4f229493847a666396d1138f36 0003-apk-an-alpine-package-can-be-held-back-with-as-well.patch
|
|
||||||
6f695e1b1785f88217b5a32c509b5cb3c7a3f70069b042ad9770a4c1e86c4477abab2763579130f65e0c880976eb9f292bed3b42dda0d25e801696db479e55e8 apt-dater-host-fix-bashisms.patch"
|
6f695e1b1785f88217b5a32c509b5cb3c7a3f70069b042ad9770a4c1e86c4477abab2763579130f65e0c880976eb9f292bed3b42dda0d25e801696db479e55e8 apt-dater-host-fix-bashisms.patch"
|
||||||
|
@ -1,269 +0,0 @@
|
|||||||
From 05dde83e45d64a82b89e5c10b0f74b28f424379a Mon Sep 17 00:00:00 2001
|
|
||||||
From: Henrik Riomar <henrik.riomar@gmail.com>
|
|
||||||
Date: Sun, 10 Jul 2016 13:44:15 +0200
|
|
||||||
Subject: [PATCH] initial support for Alpine Linux (apk)
|
|
||||||
|
|
||||||
Note that Alpine host code is not implemented in Perl as that is not
|
|
||||||
present on an Alpine Linux system by default.
|
|
||||||
|
|
||||||
Implements ADP 0.6
|
|
||||||
|
|
||||||
---
|
|
||||||
This patch is backported from upstream.
|
|
||||||
---
|
|
||||||
apk/Makefile | 9 ++
|
|
||||||
apk/apt-dater-host | 212 +++++++++++++++++++++++++++++++++++++++++++++
|
|
||||||
apk/apt-dater-host-sudoers | 9 ++
|
|
||||||
3 files changed, 230 insertions(+)
|
|
||||||
create mode 100644 apk/Makefile
|
|
||||||
create mode 100755 apk/apt-dater-host
|
|
||||||
create mode 100644 apk/apt-dater-host-sudoers
|
|
||||||
|
|
||||||
diff --git a/apk/Makefile b/apk/Makefile
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..227f366
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/apk/Makefile
|
|
||||||
@@ -0,0 +1,9 @@
|
|
||||||
+clean:
|
|
||||||
+
|
|
||||||
+install:
|
|
||||||
+ install -D -m0755 apt-dater-host \
|
|
||||||
+ $(DESTDIR)/usr/bin/apt-dater-host
|
|
||||||
+
|
|
||||||
+ install -m0750 -d $(DESTDIR)/etc/sudoers.d
|
|
||||||
+ install -m0640 apt-dater-host-sudoers \
|
|
||||||
+ $(DESTDIR)/etc/sudoers.d/apt-dater-host
|
|
||||||
diff --git a/apk/apt-dater-host b/apk/apt-dater-host
|
|
||||||
new file mode 100755
|
|
||||||
index 0000000..a5862ae
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/apk/apt-dater-host
|
|
||||||
@@ -0,0 +1,212 @@
|
|
||||||
+#!/bin/sh
|
|
||||||
+
|
|
||||||
+# apt-dater - terminal-based remote package update manager
|
|
||||||
+#
|
|
||||||
+# 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
|
|
||||||
+#
|
|
||||||
+# Author:
|
|
||||||
+# Henrik Riomar <henrik.riomar@gmail.com>
|
|
||||||
+#
|
|
||||||
+# Copyright Holder:
|
|
||||||
+# 2016 (C) Henrik Riomar
|
|
||||||
+#
|
|
||||||
+# License:
|
|
||||||
+# This program is free software; you can redistribute it and/or modify
|
|
||||||
+# it under the terms of the GNU General Public License as published by
|
|
||||||
+# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
+# (at your option) any later version.
|
|
||||||
+#
|
|
||||||
+# This program is distributed in the hope that it will be useful,
|
|
||||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
+# GNU General Public License for more details.
|
|
||||||
+#
|
|
||||||
+# You should have received a copy of the GNU General Public License
|
|
||||||
+# along with this package; if not, write to the Free Software
|
|
||||||
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
+#
|
|
||||||
+
|
|
||||||
+ADP_VERSION="0.6"
|
|
||||||
+ROOT_CMD="sudo"
|
|
||||||
+APK_CMD="/sbin/apk"
|
|
||||||
+
|
|
||||||
+err=255 # exit code returned by Perl from die()
|
|
||||||
+
|
|
||||||
+# LSBREL: ${Distri}|{Version}|${Codename}
|
|
||||||
+get_lsbrel()
|
|
||||||
+{
|
|
||||||
+ name=$(awk -F= '/^ID/ {print $NF}' /etc/os-release)
|
|
||||||
+ version=$(awk -F= '/^VERSION_ID/ {print $NF}' /etc/os-release)
|
|
||||||
+ echo "LSBREL: ${name}|${version}|"
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+# PRL: ${URI}
|
|
||||||
+get_prl()
|
|
||||||
+{
|
|
||||||
+ sed -n 's/^http/PRL: http/p' /etc/apk/repositories
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+# check if a pkg is held back
|
|
||||||
+is_held()
|
|
||||||
+{
|
|
||||||
+ grep -E -q ^$1\= /etc/apk/world
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+# check if $1 > $2
|
|
||||||
+newer_then()
|
|
||||||
+{
|
|
||||||
+ [ x"$($APK_CMD version -t $1 $2)" = x">" ] && return 0
|
|
||||||
+
|
|
||||||
+ return 1
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+# STATUS: ${Package}|${InstVersion}|${Status}...
|
|
||||||
+get_pkg_stat()
|
|
||||||
+{
|
|
||||||
+ tmp=$(mktemp)
|
|
||||||
+ $APK_CMD version -v | grep -v "^Installed:" > $tmp
|
|
||||||
+ $APK_CMD info | while read -r pkg
|
|
||||||
+ do
|
|
||||||
+ line=$(grep -E "^${pkg}-[0-9]" $tmp)
|
|
||||||
+ new_ver=$(echo $line | awk '{print $NF}')
|
|
||||||
+ cur_ver=$(echo $line | awk '{print $1}' | sed "s/$pkg-//")
|
|
||||||
+ if [ x"$new_ver" = x"$cur_ver" ]; then
|
|
||||||
+ echo "STATUS: $pkg|$cur_ver|i"
|
|
||||||
+ elif is_held $pkg; then
|
|
||||||
+ echo "STATUS: $pkg|$cur_ver|h"
|
|
||||||
+ elif [ x"$new_ver" = x"?" ]; then
|
|
||||||
+ echo "STATUS: $pkg|$cur_ver|x"
|
|
||||||
+ elif newer_then $new_ver $cur_ver; then
|
|
||||||
+ echo "STATUS: $pkg|$cur_ver|u=$new_ver"
|
|
||||||
+ else
|
|
||||||
+ # newer installed ($cur_ver) than available,
|
|
||||||
+ # ADP 0.6 does not describe this case
|
|
||||||
+ # x should be suitable for now.
|
|
||||||
+ echo "STATUS: $pkg|$cur_ver|x"
|
|
||||||
+ fi
|
|
||||||
+ done
|
|
||||||
+ rm $tmp
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+# VIRT: ${Name}
|
|
||||||
+get_virt()
|
|
||||||
+{
|
|
||||||
+ virt=$(dmesg | awk '/Hypervisor detected:/ {print $NF}')
|
|
||||||
+ if [ -n "$virt" ]; then
|
|
||||||
+ echo "VIRT: $virt"
|
|
||||||
+ else
|
|
||||||
+ echo "VIRT: Unknown"
|
|
||||||
+ fi
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+# UNAME: ${KERNEL-NAME}|${MACHINE}
|
|
||||||
+get_uname()
|
|
||||||
+{
|
|
||||||
+ echo "UNAME: $(uname -s)|$(uname -m)"
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+# KERNELINFO: ${Code} ${Release}
|
|
||||||
+get_kern()
|
|
||||||
+{
|
|
||||||
+ # 0 - latest running
|
|
||||||
+ # 1 - reboot
|
|
||||||
+ # 9 - Unknown
|
|
||||||
+ running=$(uname -r)
|
|
||||||
+ flavor=$(uname -r | awk -F- '{print $NF}')
|
|
||||||
+ vmlinuz="/boot/vmlinuz-$flavor"
|
|
||||||
+ if [ -r $vmlinuz ]; then
|
|
||||||
+ installed=$($APK_CMD info --who-owns $vmlinuz | grep -E -o "[0-9]+.[0-9]+.[0-9]+-r[0-9]")
|
|
||||||
+ with_r=$(echo $running | sed -e "s/[0-9]-${flavor}$/r&/g" | sed "s/-${flavor}//")
|
|
||||||
+ if [ x"$($APK_CMD version -t $with_r $installed)" = x'=' ]; then
|
|
||||||
+ echo "KERNELINFO: 0 $running"
|
|
||||||
+ else
|
|
||||||
+ echo "KERNELINFO: 1 $running"
|
|
||||||
+ fi
|
|
||||||
+ else
|
|
||||||
+ echo "KERNELINFO: 9 $running"
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+# FORBID: ${Operations}
|
|
||||||
+check_forbid()
|
|
||||||
+{
|
|
||||||
+ echo "FORBID: 0"
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+# ADPROTO: ${ProtoVersion}
|
|
||||||
+say_hi()
|
|
||||||
+{
|
|
||||||
+ echo "ADPROTO: $ADP_VERSION"
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+do_status()
|
|
||||||
+{
|
|
||||||
+ get_lsbrel
|
|
||||||
+ get_prl
|
|
||||||
+ get_virt
|
|
||||||
+ get_uname
|
|
||||||
+ check_forbid
|
|
||||||
+ get_pkg_stat
|
|
||||||
+ get_kern
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+run_as_root()
|
|
||||||
+{
|
|
||||||
+ err_str="ADPERR:"
|
|
||||||
+ interactive=$1
|
|
||||||
+ [ $interactive -eq 1 ] && err_str="ERROR:"
|
|
||||||
+ shift
|
|
||||||
+
|
|
||||||
+ proxy="/etc/profile.d/proxy.sh"
|
|
||||||
+ [ -r $proxy ] && source $proxy
|
|
||||||
+
|
|
||||||
+ cmd="$ROOT_CMD $*"
|
|
||||||
+ $cmd
|
|
||||||
+ ret=$?
|
|
||||||
+ if [ $ret -ne 0 ]; then
|
|
||||||
+ echo "$err_str \"$cmd\" returned $ret"
|
|
||||||
+ exit $err
|
|
||||||
+ fi
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+if [ -z "$1" ]; then
|
|
||||||
+ echo "Don't call this script directly!"
|
|
||||||
+ exit $err
|
|
||||||
+fi
|
|
||||||
+
|
|
||||||
+case "$1" in
|
|
||||||
+ refresh)
|
|
||||||
+ say_hi
|
|
||||||
+ run_as_root 0 $APK_CMD update
|
|
||||||
+ do_status
|
|
||||||
+ ;;
|
|
||||||
+
|
|
||||||
+ status)
|
|
||||||
+ say_hi
|
|
||||||
+ do_status
|
|
||||||
+ ;;
|
|
||||||
+
|
|
||||||
+ upgrade)
|
|
||||||
+ run_as_root 1 $APK_CMD upgrade
|
|
||||||
+ ;;
|
|
||||||
+
|
|
||||||
+ install)
|
|
||||||
+ shift
|
|
||||||
+ echo "Installing PKG: $*"
|
|
||||||
+ run_as_root 1 $APK_CMD add $*
|
|
||||||
+ ;;
|
|
||||||
+
|
|
||||||
+ kernel)
|
|
||||||
+ say_hi
|
|
||||||
+ get_kern
|
|
||||||
+ ;;
|
|
||||||
+
|
|
||||||
+ *)
|
|
||||||
+ echo Invalid command \'$1\'\!
|
|
||||||
+ exit $err
|
|
||||||
+ ;;
|
|
||||||
+esac
|
|
||||||
diff --git a/apk/apt-dater-host-sudoers b/apk/apt-dater-host-sudoers
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..6fc868c
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/apk/apt-dater-host-sudoers
|
|
||||||
@@ -0,0 +1,9 @@
|
|
||||||
+# apt-dater-host sudoers.d config file
|
|
||||||
+# ------------------------------------
|
|
||||||
+#
|
|
||||||
+
|
|
||||||
+# Keep http_proxy environment variable
|
|
||||||
+#Defaults env_keep += http_proxy
|
|
||||||
+
|
|
||||||
+# Allow members of group adm to execute the apk command
|
|
||||||
+%adm ALL=NOPASSWD: /sbin/apk
|
|
@ -1,56 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user