From 63f12aa09fe591948620db1d7c6858458704ff2a Mon Sep 17 00:00:00 2001 From: Laurent Bigonville Date: Fri, 3 Jun 2011 16:22:58 +0200 Subject: [PATCH] Add nut-monitor package --- debian/changelog | 1 + debian/control | 17 ++++++++ debian/nut-monitor.install | 6 +++ debian/patches/0002-nut-monitor-paths.patch | 48 +++++++++++++++++++++ debian/patches/series | 1 + debian/rules | 3 ++ 6 files changed, 76 insertions(+) create mode 100644 debian/nut-monitor.install create mode 100644 debian/patches/0002-nut-monitor-paths.patch diff --git a/debian/changelog b/debian/changelog index a43845b..5783c14 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,6 +12,7 @@ nut (2.6.1-2) UNRELEASED; urgency=low * debian/control: - Add python-nut package and add python build-dependency - Set nut-powerman-pdu priority to extras + - Add nut-monitor package -- Laurent Bigonville Mon, 27 Jun 2011 17:26:59 +0200 diff --git a/debian/control b/debian/control index 9f62c0a..81bcef2 100644 --- a/debian/control +++ b/debian/control @@ -166,3 +166,20 @@ Description: network UPS tools - Python bindings for NUT server changes. . This package provides Python bindings to connect to NUT server. + +Package: nut-monitor +Architecture: all +Depends: ${python:Depends}, + ${misc:Depends}, + python-gobject, + python-gtk2, + python-glade2, + python-nut +Description: network UPS tools - GUI application to monitor UPS status + Network UPS Tools (NUT) is a client/server monitoring system that + allows computers to share uninterruptible power supply (UPS) and + power distribution unit (PDU) hardware. Clients access the hardware + through the server, and are notified whenever the power status + changes. + . + This package provides nut-monitor, a GUI application to monitor UPS status. diff --git a/debian/nut-monitor.install b/debian/nut-monitor.install new file mode 100644 index 0000000..612e8f3 --- /dev/null +++ b/debian/nut-monitor.install @@ -0,0 +1,6 @@ +scripts/python/app/NUT-Monitor usr/bin/ +scripts/python/app/nut-monitor.desktop usr/share/applications/ +scripts/python/app/gui-*.glade usr/share/nut-monitor/ +scripts/python/app/locale/ usr/share/ +scripts/python/app/nut-monitor.png usr/share/pixmaps/ +scripts/python/app/pixmaps usr/share/nut-monitor/ diff --git a/debian/patches/0002-nut-monitor-paths.patch b/debian/patches/0002-nut-monitor-paths.patch new file mode 100644 index 0000000..00fd0de --- /dev/null +++ b/debian/patches/0002-nut-monitor-paths.patch @@ -0,0 +1,48 @@ +--- a/scripts/python/app/NUT-Monitor ++++ b/scripts/python/app/NUT-Monitor +@@ -70,7 +70,7 @@ + ( cmd_opts, args ) = opt_parser.parse_args() + + +- self.__glade_file = os.path.join( os.path.dirname( sys.argv[0] ), "gui-1.3.glade" ) ++ self.__glade_file = '/usr/share/nut-monitor/gui-1.3.glade' + + self.__widgets["interface"] = gtk.glade.XML( self.__glade_file, "window1", APP ) + self.__widgets["main_window"] = self.__widgets["interface"].get_widget("window1") +@@ -103,11 +103,11 @@ + + # Create the tray icon and connect it to the show/hide method... + self.__widgets["status_icon"] = gtk.StatusIcon() +- self.__widgets["status_icon"].set_from_file( os.path.join( os.path.dirname( sys.argv[0] ), "pixmaps", "on_line.png" ) ) ++ self.__widgets["status_icon"].set_from_file( "/usr/share/nut-monitor/pixmaps/on_line.png" ) + self.__widgets["status_icon"].set_visible( True ) + self.__widgets["status_icon"].connect( "activate", self.tray_activated ) + +- self.__widgets["ups_status_image"].set_from_file( os.path.join( os.path.dirname( sys.argv[0] ), "pixmaps", "on_line.png" ) ) ++ self.__widgets["ups_status_image"].set_from_file( "/usr/share/nut-monitor/pixmaps/on_line.png" ) + + # Define interface callbacks actions + self.__callbacks = { "on_window1_destroy" : self.quit, +@@ -265,8 +265,8 @@ + #------------------------------------------------------------------- + # Change the status icon and tray icon + def change_status_icon( self, icon="on_line", blink=False ) : +- self.__widgets["status_icon"].set_from_file( os.path.join( os.path.dirname( sys.argv[0] ), "pixmaps", "%s.png" % icon ) ) +- self.__widgets["ups_status_image"].set_from_file( os.path.join( os.path.dirname( sys.argv[0] ), "pixmaps", "%s.png" % icon ) ) ++ self.__widgets["status_icon"].set_from_file( "/usr/share/nut-monitor/pixmaps/%s.png" % icon ) ++ self.__widgets["ups_status_image"].set_from_file( "/usr/share/nut-monitor/pixmaps/%s.png" % icon ) + self.__widgets["status_icon"].set_blinking( blink ) + + #------------------------------------------------------------------- +@@ -719,9 +719,9 @@ + + for k,v in vars.iteritems() : + if ( rwvars.has_key( k ) ) : +- icon_file = os.path.join( os.path.dirname( sys.argv[0] ), "pixmaps", "var-rw.png" ) ++ icon_file = "/usr/share/nut-monitor/pixmaps/var-rw.png" + else : +- icon_file = os.path.join( os.path.dirname( sys.argv[0] ), "pixmaps", "var-ro.png" ) ++ icon_file = "/usr/share/nut-monitor/pixmaps/var-ro.png" + + icon = gtk.gdk.pixbuf_new_from_file( icon_file ) + self.__widgets["ups_vars_tree_store"].append( [ icon, k, v ] ) diff --git a/debian/patches/series b/debian/patches/series index 52e301b..9e8eaf1 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1 +1,2 @@ 0001-fix_spelling_and_typo.patch +0002-nut-monitor-paths.patch diff --git a/debian/rules b/debian/rules index 88d6ea4..3219e60 100755 --- a/debian/rules +++ b/debian/rules @@ -44,6 +44,9 @@ common-install-arch:: mv $${f} $(CURDIR)/debian/tmp/etc/nut/$${nf}; \ done +binary-install/nut-monitor:: + dh_python2 -pnut-monitor + DEB_DH_INSTALLINIT_ARGS_nut-server := --init-script=nut -- start 50 2 3 4 5 . stop 50 0 1 6 . ifeq (linux,$(DEB_HOST_ARCH_OS))