Spritz: add entropy:// URI handler

This commit is contained in:
Fabio Erculiani
2009-05-16 00:14:42 +02:00
parent d11d7c20e6
commit 09856c808f
2 changed files with 40 additions and 0 deletions
+1
View File
@@ -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
+39
View File
@@ -0,0 +1,39 @@
#!/usr/bin/python2
# Spritz (Entropy Interface)
# Copyright: (C) 2007-2009 Fabio Erculiani < lxnay<AT>sabayonlinux<DOT>org >
#
# 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)