[arch-commits] Commit in (9 files)
Maxime Gauduin
alucryd at archlinux.org
Thu May 28 14:10:20 UTC 2020
Date: Thursday, May 28, 2020 @ 14:10:20
Author: alucryd
Revision: 636325
add nut
Added:
nut/
nut/trunk/
nut/trunk/PKGBUILD
nut/trunk/nut-lowspeed-buffer-size.patch
nut/trunk/nut-no-libdummy.patch
nut/trunk/nut-openssl-1.1.patch
nut/trunk/nut-snmp-usb-order.patch
nut/trunk/nut.sysusers
nut/trunk/nut.tmpfiles
--------------------------------+
PKGBUILD | 129 +++++++++++++++++++++++++++++++++
nut-lowspeed-buffer-size.patch | 19 ++++
nut-no-libdummy.patch | 14 +++
nut-openssl-1.1.patch | 151 +++++++++++++++++++++++++++++++++++++++
nut-snmp-usb-order.patch | 38 +++++++++
nut.sysusers | 2
nut.tmpfiles | 4 +
7 files changed, 357 insertions(+)
Added: nut/trunk/PKGBUILD
===================================================================
--- nut/trunk/PKGBUILD (rev 0)
+++ nut/trunk/PKGBUILD 2020-05-28 14:10:20 UTC (rev 636325)
@@ -0,0 +1,129 @@
+# Maintainer: Maxime Gauduin <alucryd at archlinux.org>
+# Contributor: Florian Bruhin <archlinux.org at the-compiler.org>
+# Contributor: Alex Reznichenko <sa5gap at yandex.ru>
+# Contributor: Roman Kyrylych <roman at archlinux.org>
+# Contributor: Giuseppe Lucarelli <luk at rebelsoft.org>
+# Contributor: Dan Ziemba <zman0900 at gmail.com>
+
+pkgname=nut
+pkgver=2.7.4
+pkgrel=1
+pkgdesc='A collection of programs which provide a common interface for monitoring and administering UPS, PDU and SCD hardware'
+arch=(x86_64)
+url=https://networkupstools.org/
+license=(
+ GPL2
+ GPL3
+)
+depends=(
+ gcc-libs
+ glibc
+ libtool
+ libusb-compat
+ neon
+ net-snmp
+ openssl
+)
+makedepends=(
+ asciidoc
+ gd
+ git
+ python
+)
+optdepends=('gd: CGI support')
+provides=(network-ups-tools)
+conflicts=(network-ups-tools)
+replaces=(network-ups-tools)
+options=(!makeflags)
+backup=(
+ etc/nut/hosts.conf
+ etc/nut/nut.conf
+ etc/nut/ups.conf
+ etc/nut/upsd.conf
+ etc/nut/upsd.users
+ etc/nut/upsmon.conf
+ etc/nut/upssched.conf
+ etc/nut/upsstats.html
+ etc/nut/upsstats-single.html
+)
+source=(
+ git+https://github.com/networkupstools/nut.git#tag=0b4bfddbc609c59ac0a117c758e6893635121166
+ nut.sysusers
+ nut.tmpfiles
+ nut-lowspeed-buffer-size.patch
+ nut-no-libdummy.patch
+ nut-openssl-1.1.patch
+ nut-snmp-usb-order.patch
+)
+sha256sums=('SKIP'
+ '3001e24969545136361670c5d615684d2b37830525e090c2ab3bcfa90d90e4ac'
+ 'bdf4409b5b9bfad1338d587c7639c43be838d37d4942c69879e85eb3a827bb25'
+ '40d6fc328ad2e127f580bb359bd5c2fb721a2c6cf1860334be96c18552d6f8f7'
+ 'b35a8d28fde10668e8e54e97be9c5505f296c989e67da847c5abf1acab6a219b'
+ '717e116aa93f42ccca901de920da3ff97407672003f721b4976caf525f3e5f08'
+ 'c2c7d3b72f94f9c7987ab047bba466923c63ddb80b468485f100b1e44997ec84')
+
+pkgver() {
+ cd nut
+
+ git describe --tags | sed 's/^v//'
+}
+
+prepare() {
+ cd nut
+
+ git cherry-pick -n eea0c5e9e5566c36a8b1e364ed4909231901a8f5
+ patch -Np1 -i ../nut-lowspeed-buffer-size.patch
+ patch -Np1 -i ../nut-no-libdummy.patch
+ patch -Np1 -i ../nut-openssl-1.1.patch
+ patch -Np1 -i ../nut-snmp-usb-order.patch
+
+ ./autogen.sh
+}
+
+build() {
+ cd nut
+
+ ./configure \
+ --prefix=/usr \
+ --datadir=/usr/share/nut \
+ --sbindir=/usr/bin \
+ --sysconfdir=/etc/nut \
+ --disable-static \
+ --with-user=nut \
+ --with-group=nut \
+ --with-altpidpath=/run/nut \
+ --with-cgipath=/usr/share/nut/cgi \
+ --with-drvpath=/usr/lib/nut \
+ --with-htmlpath=/usr/share/nut/html \
+ --with-pidpath=/run/nut \
+ --with-statepath=/var/lib/nut \
+ --with-systemdsystemunitdir=/usr/lib/systemd/system \
+ --with-udev-dir=/usr/lib/udev \
+ --with-cgi \
+ --with-dev \
+ --with-doc=html-single \
+ --with-libltdl \
+ --with-neon \
+ --with-openssl \
+ --with-serial \
+ --with-snmp \
+ --with-usb \
+ --without-avahi \
+ --without-doc \
+ --without-ipmi \
+ --without-freeipmi \
+ --without-powerman \
+ --without-wrap
+ make -j1
+}
+
+package() {
+ make DESTDIR="${pkgdir}" -C nut install
+ find "${pkgdir}"/etc/nut -name *.sample -exec rename '.sample' '' {} \;
+
+ install -Dm 644 nut.sysusers "${pkgdir}"/usr/lib/sysusers.d/nut.conf
+ install -Dm 644 nut.tmpfiles "${pkgdir}"/usr/lib/tmpfiles.d/nut.conf
+}
+
+# vim: ts=2 sw=2 et:
Added: nut/trunk/nut-lowspeed-buffer-size.patch
===================================================================
--- nut/trunk/nut-lowspeed-buffer-size.patch (rev 0)
+++ nut/trunk/nut-lowspeed-buffer-size.patch 2020-05-28 14:10:20 UTC (rev 636325)
@@ -0,0 +1,19 @@
+http://bugs.gentoo.org/show_bug.cgi?id=318937
+http://boxster.ghz.cc/projects/nut/changeset/2407
+
+Respun from nut-2.4.3-lowspeed-buffer-size.patch
+
+Index: a/drivers/libhid.c
+===================================================================
+--- a/drivers/libhid.c
++++ b/drivers/libhid.c
+@@ -477,7 +477,7 @@
+ */
+ int HIDGetEvents(hid_dev_handle_t udev, HIDData_t **event, int eventsize)
+ {
+- unsigned char buf[SMALLBUF];
++ unsigned char buf[8]; /* Maximum size for low-speed USB devices */
+ int itemCount = 0;
+ int buflen, r, i;
+ HIDData_t *pData;
+
Added: nut/trunk/nut-no-libdummy.patch
===================================================================
--- nut/trunk/nut-no-libdummy.patch (rev 0)
+++ nut/trunk/nut-no-libdummy.patch 2020-05-28 14:10:20 UTC (rev 636325)
@@ -0,0 +1,14 @@
+diff --git a/drivers/Makefile.am b/drivers/Makefile.am
+index 99614ca..42b3611 100644
+--- a/drivers/Makefile.am
++++ b/drivers/Makefile.am
+@@ -267,5 +267,6 @@ dist_noinst_HEADERS = apc-mib.h apc-hid.h baytech-mib.h bcmxcp.h \
+
+ # Define a dummy library so that Automake builds rules for the
+ # corresponding object files. This library is not actually built,
+-EXTRA_LIBRARIES = libdummy.a
+-libdummy_a_SOURCES = main.c dstate.c serial.c
++EXTRA_LIBRARIES =
++#EXTRA_LIBRARIES = libdummy.a
++#libdummy_a_SOURCES = main.c dstate.c serial.c
+
Added: nut/trunk/nut-openssl-1.1.patch
===================================================================
--- nut/trunk/nut-openssl-1.1.patch (rev 0)
+++ nut/trunk/nut-openssl-1.1.patch 2020-05-28 14:10:20 UTC (rev 636325)
@@ -0,0 +1,151 @@
+From da1f5aa699f54e0f6977ab64a3bc2f90a51c3104 Mon Sep 17 00:00:00 2001
+From: Arjen de Korte <build+lede at de-korte.org>
+Date: Mon, 27 Nov 2017 21:10:13 +0100
+Subject: [PATCH] Add support for openssl-1.1.0
+
+--- a/clients/upsclient.c
++++ b/clients/upsclient.c
+@@ -299,11 +299,6 @@
+ {
+ #ifdef WITH_OPENSSL
+ int ret, ssl_mode = SSL_VERIFY_NONE;
+-#if OPENSSL_VERSION_NUMBER >= 0x10000000L
+- const SSL_METHOD *ssl_method;
+-#else
+- SSL_METHOD *ssl_method;
+-#endif
+ #elif defined(WITH_NSS) /* WITH_OPENSSL */
+ SECStatus status;
+ #endif /* WITH_OPENSSL | WITH_NSS */
+@@ -315,22 +310,32 @@
+ }
+
+ #ifdef WITH_OPENSSL
+-
+- SSL_library_init();
+- SSL_load_error_strings();
+
+- ssl_method = TLSv1_client_method();
++#if OPENSSL_VERSION_NUMBER < 0x10100000L
++ SSL_load_error_strings();
++ SSL_library_init();
+
+- if (!ssl_method) {
+- return 0;
+- }
++ ssl_ctx = SSL_CTX_new(SSLv23_client_method());
++#else
++ ssl_ctx = SSL_CTX_new(TLS_client_method());
++#endif
+
+- ssl_ctx = SSL_CTX_new(ssl_method);
+ if (!ssl_ctx) {
+ upslogx(LOG_ERR, "Can not initialize SSL context");
+ return -1;
+ }
+
++#if OPENSSL_VERSION_NUMBER < 0x10100000L
++ /* set minimum protocol TLSv1 */
++ SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3);
++#else
++ ret = SSL_CTX_set_min_proto_version(ssl_ctx, TLS1_VERSION);
++ if (ret != 1) {
++ upslogx(LOG_ERR, "Can not set minimum protocol to TLSv1");
++ return -1;
++ }
++#endif
++
+ if (!certpath) {
+ if (certverify == 1) {
+ upslogx(LOG_ERR, "Can not verify certificate if any is specified");
+@@ -737,7 +742,7 @@
+ switch(res)
+ {
+ case 1:
+- upsdebugx(3, "SSL connected");
++ upsdebugx(3, "SSL connected (%s)", SSL_get_version(ups->ssl));
+ break;
+ case 0:
+ upslog_with_errno(1, "SSL_connect do not accept handshake.");
+--- a/clients/upssched.c
++++ b/clients/upssched.c
+@@ -794,7 +794,7 @@
+ }
+
+ if (!strcmp(cmd, "EXECUTE")) {
+- if (ca1 == '\0') {
++ if (ca1[0] == '\0') {
+ upslogx(LOG_ERR, "Empty EXECUTE command argument");
+ return;
+ }
+--- a/m4/nut_check_libopenssl.m4
++++ b/m4/nut_check_libopenssl.m4
+@@ -58,7 +58,7 @@
+
+ dnl check if openssl is usable
+ AC_CHECK_HEADERS(openssl/ssl.h, [nut_have_openssl=yes], [nut_have_openssl=no], [AC_INCLUDES_DEFAULT])
+- AC_CHECK_FUNCS(SSL_library_init, [], [nut_have_openssl=no])
++ AC_CHECK_FUNCS(SSL_CTX_new, [], [nut_have_openssl=no])
+
+ if test "${nut_have_openssl}" = "yes"; then
+ nut_with_ssl="yes"
+--- a/server/netssl.c
++++ b/server/netssl.c
+@@ -274,7 +274,7 @@
+ {
+ case 1:
+ client->ssl_connected = 1;
+- upsdebugx(3, "SSL connected");
++ upsdebugx(3, "SSL connected (%s)", SSL_get_version(client->ssl));
+ break;
+
+ case 0:
+@@ -370,13 +370,7 @@
+ {
+ #ifdef WITH_NSS
+ SECStatus status;
+-#elif defined(WITH_OPENSSL)
+-#if OPENSSL_VERSION_NUMBER >= 0x10000000L
+- const SSL_METHOD *ssl_method;
+-#else
+- SSL_METHOD *ssl_method;
+-#endif
+-#endif /* WITH_NSS|WITH_OPENSSL */
++#endif /* WITH_NSS */
+
+ if (!certfile) {
+ return;
+@@ -386,18 +380,29 @@
+
+ #ifdef WITH_OPENSSL
+
++#if OPENSSL_VERSION_NUMBER < 0x10100000L
+ SSL_load_error_strings();
+ SSL_library_init();
+
+- if ((ssl_method = TLSv1_server_method()) == NULL) {
++ ssl_ctx = SSL_CTX_new(SSLv23_server_method());
++#else
++ ssl_ctx = SSL_CTX_new(TLS_server_method());
++#endif
++
++ if (!ssl_ctx) {
+ ssl_debug();
+- fatalx(EXIT_FAILURE, "TLSv1_server_method failed");
++ fatalx(EXIT_FAILURE, "SSL_CTX_new failed");
+ }
+
+- if ((ssl_ctx = SSL_CTX_new(ssl_method)) == NULL) {
++#if OPENSSL_VERSION_NUMBER < 0x10100000L
++ /* set minimum protocol TLSv1 */
++ SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3);
++#else
++ if (SSL_CTX_set_min_proto_version(ssl_ctx, TLS1_VERSION) != 1) {
+ ssl_debug();
+- fatalx(EXIT_FAILURE, "SSL_CTX_new failed");
++ fatalx(EXIT_FAILURE, "SSL_CTX_set_min_proto_version(TLS1_VERSION)");
+ }
++#endif
+
+ if (SSL_CTX_use_certificate_chain_file(ssl_ctx, certfile) != 1) {
+ ssl_debug();
Added: nut/trunk/nut-snmp-usb-order.patch
===================================================================
--- nut/trunk/nut-snmp-usb-order.patch (rev 0)
+++ nut/trunk/nut-snmp-usb-order.patch 2020-05-28 14:10:20 UTC (rev 636325)
@@ -0,0 +1,38 @@
+The code that generates the SNMP and USB headers to compile against does not
+have a deterministic order, leading to different results at times.
+
+Signed-off-by: Robin H. Johnson <robbat2 at gentoo.org>
+
+diff -Nuar --exclude .libs --exclude '*.o' --exclude core nut-2.7.1.orig/tools/nut-snmpinfo.py nut-2.7.1/tools/nut-snmpinfo.py
+--- nut-2.7.1.orig/tools/nut-snmpinfo.py 2014-01-04 19:08:19.117150636 -0800
++++ nut-2.7.1/tools/nut-snmpinfo.py 2013-07-26 12:41:11.000000000 -0700
+@@ -78,7 +78,9 @@
+ output_file.write( "/* SNMP IDs device table */\n" )
+ output_file.write( "static snmp_device_id_t snmp_device_table[] = {\n" )
+
+-for filename in glob.glob('../drivers/*-mib.c'):
++mibs = glob.glob('../drivers/*-mib.c')
++mibs.sort()
++for filename in mibs:
+ list_of_line = open(filename,'r').read().split(';')
+ for line in list_of_line:
+ if "mib2nut_info_t" in line:
+diff -Nuar --exclude .libs --exclude '*.o' --exclude core nut-2.7.1.orig/tools/nut-usbinfo.pl nut-2.7.1/tools/nut-usbinfo.pl
+--- nut-2.7.1.orig/tools/nut-usbinfo.pl 2014-01-04 19:12:45.595949760 -0800
++++ nut-2.7.1/tools/nut-usbinfo.pl 2013-11-17 11:27:38.000000000 -0800
+@@ -75,7 +75,12 @@
+
+ ################# MAIN #################
+
+-find(\&find_usbdevs,$scanPath);
++find({
++ wanted => \&find_usbdevs,
++ follow => 1,
++ preprocess => sub { return sort @_ },
++ },
++ $scanPath);
+ &gen_usb_files;
+
+ ################# SUB METHOD #################
+
+
Added: nut/trunk/nut.sysusers
===================================================================
--- nut/trunk/nut.sysusers (rev 0)
+++ nut/trunk/nut.sysusers 2020-05-28 14:10:20 UTC (rev 636325)
@@ -0,0 +1,2 @@
+u nut - "Network UPS Tools" /var/lib/nut
+m nut uucp
Added: nut/trunk/nut.tmpfiles
===================================================================
--- nut/trunk/nut.tmpfiles (rev 0)
+++ nut/trunk/nut.tmpfiles 2020-05-28 14:10:20 UTC (rev 636325)
@@ -0,0 +1,4 @@
+d /run/nut 0700 nut nut -
+d /var/lib/nut 0700 nut nut -
+z /etc/nut/upsd.users 0640 root nut -
+
More information about the arch-commits
mailing list