[debian-edu-commits] r78686 - in trunk/src: . hw-support-handler hw-support-handler/debian
pere at alioth.debian.org
pere at alioth.debian.org
Wed Jan 9 14:28:54 UTC 2013
Author: pere
Date: 2013-01-09 14:28:54 +0000 (Wed, 09 Jan 2013)
New Revision: 78686
Added:
trunk/src/hw-support-handler/
trunk/src/hw-support-handler/debian/
trunk/src/hw-support-handler/debian/changelog
trunk/src/hw-support-handler/debian/compat
trunk/src/hw-support-handler/debian/control
trunk/src/hw-support-handler/debian/copyright
trunk/src/hw-support-handler/debian/debhelper.log
trunk/src/hw-support-handler/debian/hw-support-handler.install
trunk/src/hw-support-handler/debian/rules
trunk/src/hw-support-handler/debian/substvars
trunk/src/hw-support-handler/hw-support-handlerd
trunk/src/hw-support-handler/hw-support-handlerd.desktop
Log:
Draft package to make it easier to figure out what packages to install to use hw dongles.
Added: trunk/src/hw-support-handler/debian/changelog
===================================================================
--- trunk/src/hw-support-handler/debian/changelog (rev 0)
+++ trunk/src/hw-support-handler/debian/changelog 2013-01-09 14:28:54 UTC (rev 78686)
@@ -0,0 +1,5 @@
+hw-support-handler (0.0.1) UNRELEASED; urgency=low
+
+ * Initial release.
+
+ -- Petter Reinholdtsen <pere at debian.org> Wed, 09 Jan 2013 14:14:54 +0100
Added: trunk/src/hw-support-handler/debian/compat
===================================================================
--- trunk/src/hw-support-handler/debian/compat (rev 0)
+++ trunk/src/hw-support-handler/debian/compat 2013-01-09 14:28:54 UTC (rev 78686)
@@ -0,0 +1 @@
+8
Added: trunk/src/hw-support-handler/debian/control
===================================================================
--- trunk/src/hw-support-handler/debian/control (rev 0)
+++ trunk/src/hw-support-handler/debian/control 2013-01-09 14:28:54 UTC (rev 78686)
@@ -0,0 +1,29 @@
+Source: hw-support-handler
+Section: misc
+Priority: optional
+Maintainer: Petter Reinholdtsen <pere at debian.org>
+Build-Depends: debhelper (>= 8), po-debconf
+Build-Depends-Indep: dash (>= 0.5.4-12)
+ , discover
+ , python-dbus
+ , python-gobject
+ , python-notify
+Standards-Version: 3.9.1
+Vcs-Browser: http://anonscm.debian.org/viewvc/debian-edu/trunk/src/debian-edu-install/
+Vcs-Svn: svn://svn.debian.org/debian-edu/trunk/src/debian-edu-install/
+XS-DM-Upload-Allowed: yes
+
+Package: hw-support-handler
+Priority: extra
+Architecture: all
+Depends: ${misc:Depends}
+ , ${python:Depends}
+ , discover
+ , python-dbus
+ , python-gobject
+ , python-notify
+Description: Set d-i values to install Debian Edu without questions
+ This package provides default answers for packages using debconf, and
+ configures services to work out of the box after an installation.
+ .
+ This is part of the Debian Edu project.
Added: trunk/src/hw-support-handler/debian/copyright
===================================================================
--- trunk/src/hw-support-handler/debian/copyright (rev 0)
+++ trunk/src/hw-support-handler/debian/copyright 2013-01-09 14:28:54 UTC (rev 78686)
@@ -0,0 +1,22 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0
+
+Files: *
+Copyright: © 2013, Petter Reinholdtsen <pere at debian.org>
+License: GPL-2.0+
+
+License: GPL-2.0+
+ This package 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 package 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 program. If not, see <http://www.gnu.org/licenses/>
+ .
+ On Debian systems, the complete text of the GNU General
+ Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
Added: trunk/src/hw-support-handler/debian/debhelper.log
===================================================================
--- trunk/src/hw-support-handler/debian/debhelper.log (rev 0)
+++ trunk/src/hw-support-handler/debian/debhelper.log 2013-01-09 14:28:54 UTC (rev 78686)
@@ -0,0 +1,45 @@
+dh_auto_configure
+dh_auto_build
+dh_auto_test
+dh_prep
+dh_installdirs
+dh_auto_install
+dh_install
+dh_installdocs
+dh_installchangelogs
+dh_installexamples
+dh_installman
+dh_installcatalogs
+dh_installcron
+dh_installdebconf
+dh_installemacsen
+dh_installifupdown
+dh_installinfo
+dh_pysupport
+dh_installinit
+dh_installmenu
+dh_installmime
+dh_installmodules
+dh_installlogcheck
+dh_installlogrotate
+dh_installpam
+dh_installppp
+dh_installudev
+dh_installwm
+dh_installxfonts
+dh_bugfiles
+dh_lintian
+dh_gconf
+dh_icons
+dh_perl
+dh_usrlocal
+dh_link
+dh_compress
+dh_fixperms
+dh_strip
+dh_makeshlibs
+dh_shlibdeps
+dh_installdeb
+dh_gencontrol
+dh_md5sums
+dh_builddeb
Added: trunk/src/hw-support-handler/debian/hw-support-handler.install
===================================================================
--- trunk/src/hw-support-handler/debian/hw-support-handler.install (rev 0)
+++ trunk/src/hw-support-handler/debian/hw-support-handler.install 2013-01-09 14:28:54 UTC (rev 78686)
@@ -0,0 +1,2 @@
+hw-support-handlerd usr/bin
+hw-support-handlerd.desktop usr/share/autostart
Added: trunk/src/hw-support-handler/debian/rules
===================================================================
--- trunk/src/hw-support-handler/debian/rules (rev 0)
+++ trunk/src/hw-support-handler/debian/rules 2013-01-09 14:28:54 UTC (rev 78686)
@@ -0,0 +1,3 @@
+#!/usr/bin/make -f
+%:
+ dh $@
Property changes on: trunk/src/hw-support-handler/debian/rules
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/src/hw-support-handler/debian/substvars
===================================================================
--- trunk/src/hw-support-handler/debian/substvars (rev 0)
+++ trunk/src/hw-support-handler/debian/substvars 2013-01-09 14:28:54 UTC (rev 78686)
@@ -0,0 +1 @@
+misc:Depends=
Added: trunk/src/hw-support-handler/hw-support-handlerd
===================================================================
--- trunk/src/hw-support-handler/hw-support-handlerd (rev 0)
+++ trunk/src/hw-support-handler/hw-support-handlerd 2013-01-09 14:28:54 UTC (rev 78686)
@@ -0,0 +1,92 @@
+#!/usr/bin/python
+
+import string
+import dbus
+from dbus.mainloop.glib import DBusGMainLoop
+import pygtk
+import gtk
+import gobject
+import pynotify
+
+hw_seen = {}
+pkg_suggested = {}
+
+def notify_pleaseinstall(notification=None, action=None, data=None):
+ pkgs = data
+ print "Buttonclicked: %s" % string.join(pkgs, " ")
+
+def notify(bus, vendor, device, pkgs):
+ msg ="New %s device [%04x:%04x] supported by package(s) %s. To install, run /sbin/discover-pkginstall as user root." \
+ % (bus, vendor, device, string.join(pkgs, " "))
+
+ # Initializite pynotify
+ if not pynotify.init("test"):
+ return False
+
+ n = pynotify.Notification(msg)
+ n.set_timeout(3000)
+ n.add_action("clicked",
+ "Please install program(s)",
+ notify_pleaseinstall, pkgs)
+ n.show()
+ return True
+
+# While get_pkg_suggestions always return all suggestions, start by
+# igoring those plugged in when we start.
+def ignore_initial_suggestions():
+ pkgs = get_pkg_suggestions("", 0, 0);
+ for pkg in pkgs:
+ pkg_suggested[pkg] = True
+
+# Currently just ask discover for the set of suggested packages.
+# FIXME Should only return the suggested packages for the provided
+# bus+vendor+device.
+def get_pkg_suggestions(bus, vendor, device):
+ pkgs = []
+ cmd = ["/sbin/discover-pkginstall", "-l"]
+ import subprocess
+ p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ while True:
+ retcode = p.poll()
+ pkg = p.stdout.readline()
+ if pkg != "":
+ pkgs.append(pkg)
+ if(retcode is not None):
+ break
+ return pkgs
+
+def catchall_signal_handler(*args, **kwargs):
+# Trigger on
+# dbus_interface="org.freedesktop.Hal.Manager"
+# member="DeviceAdded"
+# args[0]="/org/freedesktop/Hal/devices/usb_device_781_5530_200531467118B5A19655"
+ if "org.freedesktop.Hal.Manager" == kwargs['dbus_interface'] and \
+ "DeviceAdded" == kwargs['member']:
+ devinfo = args[0].split('/')[5]
+# print devinfo
+ if "usb_device" == devinfo[0:len("usb_device")]:
+ bus = "usb"
+ f = devinfo.split('_')
+ vendor = int(f[2], 16)
+ device = int(f[3], 16)
+ if (vendor, device) not in hw_seen:
+ pkgs = get_pkg_suggestions(bus, vendor, device)
+ hw_seen[(vendor, device)] = True
+ newpkg = []
+ for pkg in pkgs:
+ if pkg not in pkg_suggested:
+ newpkg.append(pkg)
+ pkg_suggested[pkg] = True
+ if 0 < len(newpkg):
+ notify(bus, vendor, device, newpkg)
+
+def main():
+ ignore_initial_suggestions()
+ DBusGMainLoop(set_as_default=True)
+ system_bus = dbus.SystemBus()
+ system_bus.add_signal_receiver(catchall_signal_handler, interface_keyword='dbus_interface', member_keyword='member')
+ loop = gobject.MainLoop()
+ loop.run()
+
+if __name__ == '__main__':
+ main()
Property changes on: trunk/src/hw-support-handler/hw-support-handlerd
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/src/hw-support-handler/hw-support-handlerd.desktop
===================================================================
--- trunk/src/hw-support-handler/hw-support-handlerd.desktop (rev 0)
+++ trunk/src/hw-support-handler/hw-support-handlerd.desktop 2013-01-09 14:28:54 UTC (rev 78686)
@@ -0,0 +1,6 @@
+[Desktop Entry]
+Exec=hw-support-handlerd
+Type=Application
+Terminal=false
+Name=hw-support-handler
+GenericName=Suggest new packages when hardware devices are plugged in
More information about the debian-edu-commits
mailing list