diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2017-03-17 21:50:05 +0100 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2017-03-17 21:51:19 +0100 |
commit | f8f30b412d2048942f459d92616169357d02858d (patch) | |
tree | 5604a9b6f11cbba5608a7ca47a09adcc810ed5cc /testing/apt-dater-host | |
parent | 92c0c4a812c166ab2ef0dc4704b3464ea4560064 (diff) | |
download | aports-f8f30b412d2048942f459d92616169357d02858d.tar.bz2 aports-f8f30b412d2048942f459d92616169357d02858d.tar.xz |
testing/apt-dater-host: fix abuild, use release and backport patch
Diffstat (limited to 'testing/apt-dater-host')
-rw-r--r-- | testing/apt-dater-host/APKBUILD | 37 | ||||
-rw-r--r-- | testing/apt-dater-host/add-some-unit-tests-called-via-make-check.patch (renamed from testing/apt-dater-host/0001-apk-add-some-unit-tests-called-via-make-check.patch) | 0 | ||||
-rw-r--r-- | testing/apt-dater-host/initial-support-for-alpine.patch | 269 | ||||
-rw-r--r-- | testing/apt-dater-host/try-to-use-virt-what.patch (renamed from testing/apt-dater-host/0001-apk-try-to-use-virt-what.patch) | 2 |
4 files changed, 289 insertions, 19 deletions
diff --git a/testing/apt-dater-host/APKBUILD b/testing/apt-dater-host/APKBUILD index d19683ae9d..5580c341ac 100644 --- a/testing/apt-dater-host/APKBUILD +++ b/testing/apt-dater-host/APKBUILD @@ -2,43 +2,42 @@ # Maintainer: Henrik Riomar <henrik.riomar@gmail.com> pkgname=apt-dater-host pkgver=1.0.0 -_pkgver=c3d10e0 -pkgrel=2 -pkgdesc="host helper application for apt-dater" +pkgrel=3 +pkgdesc="Host helper application for apt-dater" url="https://github.com/DE-IBH/apt-dater-host" arch="noarch" license="GPL2+" checkdepends="bats" -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 - 0001-apk-try-to-use-virt-what.patch - 0001-apk-add-some-unit-tests-called-via-make-check.patch +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 + add-some-unit-tests-called-via-make-check.patch " -builddir="$srcdir/" +builddir="$srcdir/$pkgname-$pkgver" prepare() { - cd "$builddir"/"$pkgname"-"$_pkgver"*/ || return 1 - patch -p1 -i "$srcdir"/0001-apk-try-to-use-virt-what.patch - patch -p1 -i "$srcdir"/0001-apk-add-some-unit-tests-called-via-make-check.patch + default_prepare || return 1 + + cd "$builddir" chmod a+x apk/test-apt-dater-host || return 1 } check() { - cd "$builddir"/"$pkgname"-"$_pkgver"*/apk || return 1 + cd "$builddir"/apk make check || return 1 } package() { - cd "$builddir"/"$pkgname"-"$_pkgver"*/apk || return 1 + cd "$builddir"/apk make install DESTDIR="$pkgdir" || return 1 - cd "$builddir"/"$pkgname"-"$_pkgver"*/man || return 1 + + cd "$builddir"/man || return 1 install -d -m0755 "$pkgdir"/usr/share/man/man1 || return 1 install -m0644 "$pkgname".1 "$pkgdir"/usr/share/man/man1 || return 1 } -sha512sums="5398d94209ed0ef8faaf9086240e35d28047c81ac001dc9b55165c4d7505ca7a33eb68101c1357f40c6ef74d5c224bb8d75cf9f9d06676794e828b1f49b01c04 apt-dater-host-1.0.0-gc3d10e0.tar.gz -d93a7dc7e1e119bc948a4eb401a46d8ef28243b78d848194d1c86949da9f02ac01e556ff1c77fa0cf3b219403b5d55b48286cc8729d3e7cc1355b80f33fbabd9 0001-apk-try-to-use-virt-what.patch -12392a9bd36c3445c47382bb33be2f17609d5badfed51b8b25caa5262c8260f0048da6a3990f695caa0d70b8e908a1452caef9e15eb6211f2c696c974218ed0d 0001-apk-add-some-unit-tests-called-via-make-check.patch" +sha512sums="db750d1c33e425de315ecfe4d7d1a177b64432070ce355adfe24ebf7510f4f3d64522f57578a1157394255ec4c13d5d6fd20639dfdf2a69a94f9364ec1b1a6c8 apt-dater-host-1.0.0.tar.gz +8f427b0f6bf240b753e66e61f4ff069ae5fb46ea2c87df5b0ba6126ccb21d3b104b37af8260da0925eabedecf7e43fee2adf57fb6b1112c309c84817aa8a74c9 initial-support-for-alpine.patch +105b10a811a39b78ed8764318bceb7c44f7dd9781f49bd7b8ce09fc7011e3dd88b41037a5a82f9b05b1324914fab4baa87c836f613cafea606554abe7b35c139 try-to-use-virt-what.patch +12392a9bd36c3445c47382bb33be2f17609d5badfed51b8b25caa5262c8260f0048da6a3990f695caa0d70b8e908a1452caef9e15eb6211f2c696c974218ed0d add-some-unit-tests-called-via-make-check.patch" diff --git a/testing/apt-dater-host/0001-apk-add-some-unit-tests-called-via-make-check.patch b/testing/apt-dater-host/add-some-unit-tests-called-via-make-check.patch index 6d4eec2db2..6d4eec2db2 100644 --- a/testing/apt-dater-host/0001-apk-add-some-unit-tests-called-via-make-check.patch +++ b/testing/apt-dater-host/add-some-unit-tests-called-via-make-check.patch diff --git a/testing/apt-dater-host/initial-support-for-alpine.patch b/testing/apt-dater-host/initial-support-for-alpine.patch new file mode 100644 index 0000000000..196b8066f9 --- /dev/null +++ b/testing/apt-dater-host/initial-support-for-alpine.patch @@ -0,0 +1,269 @@ +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 diff --git a/testing/apt-dater-host/0001-apk-try-to-use-virt-what.patch b/testing/apt-dater-host/try-to-use-virt-what.patch index 8e106b58ad..96aa1de5c3 100644 --- a/testing/apt-dater-host/0001-apk-try-to-use-virt-what.patch +++ b/testing/apt-dater-host/try-to-use-virt-what.patch @@ -7,6 +7,8 @@ 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 +- |