From 6d1061719ea1387de56ee3883d788f8a5c40cf7d Mon Sep 17 00:00:00 2001 From: Laurent Bigonville Date: Sun, 18 Aug 2019 15:29:41 +0200 Subject: [PATCH] Add the apport script coming from Ubuntu, thanks to them again --- debian/changelog | 3 ++- debian/nut-client.install | 1 + debian/nut-server.install | 1 + debian/nut.install | 1 + debian/rules | 7 +++++++ debian/source_nut.py | 43 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 debian/nut.install create mode 100644 debian/source_nut.py diff --git a/debian/changelog b/debian/changelog index 575749f..b0adf12 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,8 +6,9 @@ nut (2.7.4-10) UNRELEASED; urgency=medium x32 * debian/tests: Import changes from the ubuntu package, thanks to them. Add psmisc to the dependencies as it's not installed by default in debian + * Add the apport script coming from Ubuntu, thanks to them again - -- Laurent Bigonville Sun, 04 Aug 2019 20:52:43 +0200 + -- Laurent Bigonville Sun, 18 Aug 2019 15:29:14 +0200 nut (2.7.4-9) unstable; urgency=medium diff --git a/debian/nut-client.install b/debian/nut-client.install index dd7cc04..7dc3e36 100644 --- a/debian/nut-client.install +++ b/debian/nut-client.install @@ -12,6 +12,7 @@ debian/tmp/lib/systemd/system/nut-monitor.service debian/tmp/lib/systemd/system/ups-monitor.service debian/tmp/sbin/upsmon debian/tmp/sbin/upssched +debian/tmp/usr/share/apport/package-hooks/source_nut-client.py debian/tmp/usr/share/augeas/lenses/nuthostsconf.aug debian/tmp/usr/share/augeas/lenses/nutnutconf.aug debian/tmp/usr/share/augeas/lenses/nutupsconf.aug diff --git a/debian/nut-server.install b/debian/nut-server.install index 367bad1..7247dba 100644 --- a/debian/nut-server.install +++ b/debian/nut-server.install @@ -59,5 +59,6 @@ debian/tmp/lib/systemd/system/nut-driver.service debian/tmp/lib/systemd/system/nut-server.service debian/tmp/sbin/upsd debian/tmp/sbin/upsdrvctl +debian/tmp/usr/share/apport/package-hooks/source_nut-server.py debian/tmp/usr/share/nut/cmdvartab debian/tmp/usr/share/nut/driver.list diff --git a/debian/nut.install b/debian/nut.install new file mode 100644 index 0000000..281f143 --- /dev/null +++ b/debian/nut.install @@ -0,0 +1 @@ +debian/tmp/usr/share/apport/package-hooks/source_nut.py diff --git a/debian/rules b/debian/rules index 07ba4e3..f8482c1 100755 --- a/debian/rules +++ b/debian/rules @@ -93,6 +93,10 @@ override_dh_auto_install-arch: ln -s nut-monitor.service $(CURDIR)/debian/tmp/lib/systemd/system/nut-client.service ln -s /dev/null $(CURDIR)/debian/tmp/lib/systemd/system/ups-monitor.service + # install apport hooks + install -D -m 644 debian/source_nut.py $(CURDIR)/debian/tmp/usr/share/apport/package-hooks/source_nut-server.py + install -D -m 644 debian/source_nut.py $(CURDIR)/debian/tmp/usr/share/apport/package-hooks/source_nut-client.py + override_dh_auto_install-indep: #install documentation mkdir -p $(CURDIR)/debian/tmp/usr/share/doc/nut-doc/pdf @@ -105,6 +109,9 @@ override_dh_auto_install-indep: cp -a $${f} $(CURDIR)/debian/tmp/usr/share/doc/nut-doc/html/$${nf}/; \ done + # install apport hooks + install -D -m 644 debian/source_nut.py $(CURDIR)/debian/tmp/usr/share/apport/package-hooks/source_nut.py + override_dh_installinit: dh_installinit --error-handler=handle_start_failure diff --git a/debian/source_nut.py b/debian/source_nut.py new file mode 100644 index 0000000..1dd5fd5 --- /dev/null +++ b/debian/source_nut.py @@ -0,0 +1,43 @@ +#!/usr/bin/python + +'''nut Apport interface + +Copyright (C) 2010 Canonical Ltd. +Author: Chuck Short + +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. See http://www.gnu.org/copyleft/gpl.html for +the full text of the license. +''' +from apport.hookutils import * + + +def add_info(report,ui): + + response = ui.yesno("The contents of your nut configuration files may help developers diagnose your bug more quickly, however, it may contain sensitive information. Do you want to include it in your bug report?") + + if response == None: #use cancelled + raise StropIteration + + elif response == True: + attach_file(report, '/etc/nut/ups.conf', 'UpsConf') + + elif response == False: + ui.information("The contents of your nut configuration files will NOT be included in the bug report") + + report['USBDevices'] = command_output(['lsusb']) + packages = ['nut', 'nut-client','nut-server', 'nut-cgi', 'nut-snmp', 'nut-hal-drivers', 'nut-xml', 'libupsclient1', + 'libupsclient1-dev', 'python-nut', 'nut-monitor'] + versions = '' + for package in packages: + try: + version = packaging.get_version(package) + except ValueError: + version = 'N/A' + if version is None: + version = 'N/A' + versions += '%s %s\n' %(package, version) + report['NutInstalledVersions'] = versions + report['KernelVersion'] = command_output(['uname', '-a'])