From 09856c808f71f00004e2d3f1ea2e72df5a861bea Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Sat, 16 May 2009 00:14:42 +0200 Subject: [PATCH] Spritz: add entropy:// URI handler --- spritz/Makefile | 1 + spritz/misc/spritz-uri-handler | 39 ++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100755 spritz/misc/spritz-uri-handler diff --git a/spritz/Makefile b/spritz/Makefile index 11110ad26..8436b7186 100644 --- a/spritz/Makefile +++ b/spritz/Makefile @@ -30,6 +30,7 @@ install: install -m644 COPYING $(DESTDIR)/$(LIBDIR)/entropy/spritz/. install -m755 $(MISCDIR)/entropy-repo-manager $(DESTDIR)/usr/bin/. install -m755 $(MISCDIR)/spritz $(DESTDIR)/usr/bin/. + install -m755 $(MISCDIR)/spritz-uri-handler $(DESTDIR)/usr/bin/. install -m644 $(PIXDIR)/*.png $(DESTDIR)/usr/share/pixmaps/spritz/. install -m644 $(PIXDIR)/packages/*.png $(DESTDIR)/usr/share/pixmaps/spritz/packages/. install -m644 $(MISCDIR)/spritz.pam $(DESTDIR)/etc/pam.d/spritz diff --git a/spritz/misc/spritz-uri-handler b/spritz/misc/spritz-uri-handler new file mode 100755 index 000000000..5fa5366e4 --- /dev/null +++ b/spritz/misc/spritz-uri-handler @@ -0,0 +1,39 @@ +#!/usr/bin/python2 +# Spritz (Entropy Interface) +# Copyright: (C) 2007-2009 Fabio Erculiani < lxnaysabayonlinuxorg > +# +# 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 program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +import sys, os + +# working string: entropy://media-foo/abc;media-foo/abc2 + +spritz_path = "/usr/bin/spritz" +spritz_install_arg = "--install" +entropy_uri_pfx = "entropy://" +atoms = [] +for arg in sys.argv[1:]: + if arg.startswith(entropy_uri_pfx): + uri_data = arg[len(entropy_uri_pfx):] + for atom in uri_data.split(";"): + atoms.append(atom) + elif arg == "--fetch": + atoms.append(arg) + +if atoms: + args = [spritz_path, spritz_install_arg] + atoms + rc = os.system(' '.join(args)) + raise SystemExit(rc) + +raise SystemExit(1)