rpms/olpc-utils/OLPC-2 xo-register.patch, NONE, 1.1 olpc-utils.spec, 1.1, 1.2

Daniel Williams (dcbw) fedora-extras-commits at redhat.com
Wed Aug 1 02:19:53 UTC 2007


Author: dcbw

Update of /cvs/extras/rpms/olpc-utils/OLPC-2
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv25017

Modified Files:
	olpc-utils.spec 
Added Files:
	xo-register.patch 
Log Message:
* Tue Jul 31 2007 Dan Williams <dcbw at redhat.com> - 0.15-1.1
- Add registration utility



xo-register.patch:

--- NEW FILE xo-register.patch ---
--- /dev/null	2007-07-31 05:44:15.525829500 -0400
+++ olpc-utils-0.15/olpc-register	2007-07-31 22:13:36.000000000 -0400
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+from sugar import profile
+from xmlrpclib import ServerProxy, Error
+import sys
+import os
+
+REGISTER_URL = 'http://schoolserver:8080/'
+
+def register_laptop(url=REGISTER_URL):
+    if not have_ofw_tree():
+        return False
+
+    sn = read_ofw('mfg-data/SN')
+    uuid = read_ofw('mfg-data/U#')
+    sn = sn or 'SHF00000000'
+    uuid = uuid or '00000000-0000-0000-0000-000000000000'
+
+    nick = profile.get_nick_name()
+    pubkey = profile.get_pubkey()
+
+    try:
+        server = ServerProxy(url)
+        data = server.register(sn, nick, uuid, pubkey)
+        if data['success'] != 'OK':
+            print >> sys.stderr, "Error registering laptop: " + data['error']
+            return False
+        backupurl = data['backupurl']
+        jserver = data['jabberserver']
+        profile.set_server(jserver)
+        profile.set_trial2_backup(backupurl)
+    except Error, e:
+        print >> sys.stderr, "Error registering laptop: " + str(e)
+        return False
+
+    return True
+
+def have_ofw_tree():
+    return os.path.exists('/ofw')
+
+def read_ofw(path):
+    path = os.path.join('/ofw', path)
+    if not os.path.exists(path):
+        return None
+    fh = open(path, 'r')
+    data = fh.read().rstrip('\0\n')
+    fh.close()
+    return data
+
+if __name__ == "__main__":
+    url = REGISTER_URL
+    if len(sys.argv) > 1:
+        url = sys.argv[1]
+    register_laptop(url)
--- olpc-utils-0.15/Makefile.in.xo-register	2007-06-23 12:56:23.000000000 -0400
+++ olpc-utils-0.15/Makefile.in	2007-07-31 22:14:08.000000000 -0400
@@ -21,9 +21,11 @@ olpc-bios-sig:
 install: all
 	/usr/bin/install -p -d $(DESTDIR)/$(datadir)/olpc/keycodes
 	/usr/bin/install -p -d $(DESTDIR)/$(sbindir)
+	/usr/bin/install -p -d $(DESTDIR)/$(bindir)
 	/usr/bin/install -p --mode=0664 olpc-evdev $(DESTDIR)/$(datadir)/olpc/keycodes/olpc-evdev
 	/usr/bin/install -p setolpckeys $(DESTDIR)/$(sbindir)
 	/usr/bin/install -p olpc-bios-sig $(DESTDIR)/$(sbindir)
+	/usr/bin/install -p olpc-register $(DESTDIR)/$(bindir)
 
 dist/olpc-utils-$(VERSION):
 	mkdir -p dist/olpc-utils-$(VERSION)


Index: olpc-utils.spec
===================================================================
RCS file: /cvs/extras/rpms/olpc-utils/OLPC-2/olpc-utils.spec,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- olpc-utils.spec	25 Jun 2007 21:42:46 -0000	1.1
+++ olpc-utils.spec	1 Aug 2007 02:19:21 -0000	1.2
@@ -6,21 +6,22 @@
 
 Name:		olpc-utils
 Version:	0.15
-Release:	1%{?dist}
+Release:	1.1%{?dist}
 Summary:	OLPC utilities
 URL:		http://dev.laptop.org/git?p=projects/olpc-utils;a=summary
 Group:		System Environment/Base
 License:	GPL
 Source0:	olpc-utils-0.15.tar.bz2
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-
+Patch0:		xo-register.patch
   
 %description
 
   Tools for mapping keys on the OLPC keyboards and checking BIOS signature.
 
 %prep
-%setup -q 
+%setup -q
+%patch0 -p1 -b .xo-register
 
 %build
 %configure
@@ -46,11 +47,13 @@
 %{_datadir}/olpc/keycodes/olpc-evdev
 %{_sbindir}/setolpckeys
 %{_sbindir}/olpc-bios-sig
-
+%{_bindir}/olpc-register
 
 
 
 %changelog
+* Tue Jul 31 2007 Dan Williams <dcbw at redhat.com> - 0.15-1.1
+- Add registration utility
 
 * Sat Jun 23 2007 Rahul Sundaram <sundaram at redhat.com> 0.15
 - Upstream pull, more spec file cleanup




More information about the fedora-extras-commits mailing list