[Commits] idmgr branch master updated.

Daniel Drake dsd at laptop.org
Fri Feb 10 11:08:11 EST 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "/home/olpc-code/git/projects/idmgr".

The branch, master has been updated
       via  e93529d5c50e98590fdfe4cce1b70b1320f6ad2c (commit)
       via  ba8b6dfa9411589e07a9ecbd8a7bbae880b36206 (commit)
      from  39b74da16354637a72ba1128e73286662d423e96 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

 Makefile                  |   25 ++++++++-------
 idmanager.py              |    4 +-
 idmgr.setup.sh            |   50 ++++++++++++++++++++++++++++++
 idmgr.spec                |   75 ++++----------------------------------------
 scripts/list_registration |    7 ++++
 5 files changed, 79 insertions(+), 82 deletions(-)
 create mode 100644 idmgr.setup.sh

- Log -----------------------------------------------------------------
commit e93529d5c50e98590fdfe4cce1b70b1320f6ad2c
Author: Daniel Drake <dsd at laptop.org>
Date:   Wed Feb 8 08:35:32 2012 -0600

    Move list_registration to /usr/bin
    
    This is an admin script - move it to /usr/bin/xs/list-registration.
    Warn if we can't access the database (root access is probably required).

diff --git a/Makefile b/Makefile
index e1ea9f1..c659128 100644
--- a/Makefile
+++ b/Makefile
@@ -22,11 +22,11 @@ install:
 	install -D scripts/create_user                      $(DESTDIR)/usr/libexec/idmgr
 	install -D scripts/remove_user                      $(DESTDIR)/usr/libexec/idmgr
 	install -D scripts/create_registration              $(DESTDIR)/usr/libexec/idmgr
-	install -D scripts/list_registration                $(DESTDIR)/usr/libexec/idmgr
 	install -D scripts/update_users_0_to_1.py           $(DESTDIR)/usr/libexec/idmgr
 	install -D scripts/update_users_1_to_2.py           $(DESTDIR)/usr/libexec/idmgr
 	install -D scripts/update_users_2_to_3.py           $(DESTDIR)/usr/libexec/idmgr
 	install -D registration-server                      $(DESTDIR)/usr/bin
+	install -D scripts/list_registration                $(DESTDIR)/usr/bin/xs-list-registration
 	install -D -m 644 idmanager.py                      $(DESTDIR)$(PYTHON_SITELIB)
 	install -D conf.schoolserver/idmgr                  $(DESTDIR)/etc/init.d/
 	install -D -m 644 conf.schoolserver/idmgr.conf      $(DESTDIR)/etc/
diff --git a/idmgr.spec b/idmgr.spec
index b5443c3..74c0e9c 100644
--- a/idmgr.spec
+++ b/idmgr.spec
@@ -61,6 +61,7 @@ rm -rf $RPM_BUILD_ROOT
 %{_sysconfdir}/sysconfig/olpc-scripts/setup.d/idmgr
 %{_libexecdir}/%{name}
 %{_bindir}/registration-server
+%{_bindir}/xs-list-registration
 %{python_sitelib}/idmanager.py
 %{python_sitelib}/idmanager.pyc
 %{python_sitelib}/idmanager.pyo
diff --git a/scripts/list_registration b/scripts/list_registration
index a7cb25c..6c79bea 100755
--- a/scripts/list_registration
+++ b/scripts/list_registration
@@ -27,6 +27,13 @@ if [ $# -gt 0 ]; then
 else
     DATABASE=/home/idmgr/identity.db
 fi
+
+if ! [ -r "$DATABASE" ]; then
+	echo "ERROR: Can't read $DATABASE" >&2
+	echo "Maybe you need to run as root?" >&2
+	exit 1
+fi
+
 echo "Listing students from " $DATABASE
 sqlite3 $DATABASE "select nickname, serial, full_name from laptops" | sed "y/|/\t/"
 

commit ba8b6dfa9411589e07a9ecbd8a7bbae880b36206
Author: Daniel Drake <dsd at laptop.org>
Date:   Tue Jan 31 16:38:21 2012 -0600

    Refactor for xs-setup based installation
    
    Now that we are moving towards the XS being packages that are bolted
    onto an existing install, we want the RPM installation not to modify
    the system configuration/behaviour in any way.
    
    Move the setup to an xs-setup hook, and store scripts in
    /usr/libexec to avoid the need of creating the idmgr user during
    RPM installation.

diff --git a/Makefile b/Makefile
index 58feb32..e1ea9f1 100644
--- a/Makefile
+++ b/Makefile
@@ -10,23 +10,24 @@ PY_VERSION = $(shell python -c 'import sys; print sys.version[:3]')
 PYTHON_SITELIB = /usr/lib/python$(PY_VERSION)/site-packages
 
 install:
-	install -D -d $(DESTDIR)/home/idmgr
-	install -D -d $(DESTDIR)/home/idmgr/test
 	install -D -d $(DESTDIR)/usr/bin
+	install -D -d $(DESTDIR)/var/libexec/idmgr/test
 	install -D -d $(DESTDIR)$(PYTHON_SITELIB)
 	install -D -d $(DESTDIR)/etc/init.d
+	install -D -d $(DESTDIR)/etc/sysconfig/olpc-scripts/setup.d
 
-	install -D test/xo-register                         $(DESTDIR)/home/idmgr/test
-	install -D test/local-register                      $(DESTDIR)/home/idmgr/test
-	install -D test/db_dump                             $(DESTDIR)/home/idmgr/test
-	install -D scripts/create_user                      $(DESTDIR)/home/idmgr
-	install -D scripts/remove_user                      $(DESTDIR)/home/idmgr
-	install -D scripts/create_registration              $(DESTDIR)/home/idmgr
-	install -D scripts/list_registration                $(DESTDIR)/home/idmgr
-	install -D scripts/update_users_0_to_1.py           $(DESTDIR)/home/idmgr
-	install -D scripts/update_users_1_to_2.py           $(DESTDIR)/home/idmgr
-	install -D scripts/update_users_2_to_3.py           $(DESTDIR)/home/idmgr
+	install -D test/xo-register                         $(DESTDIR)/usr/libexec/idmgr/test
+	install -D test/local-register                      $(DESTDIR)/usr/libexec/idmgr/test
+	install -D test/db_dump                             $(DESTDIR)/usr/libexec/idmgr/test
+	install -D scripts/create_user                      $(DESTDIR)/usr/libexec/idmgr
+	install -D scripts/remove_user                      $(DESTDIR)/usr/libexec/idmgr
+	install -D scripts/create_registration              $(DESTDIR)/usr/libexec/idmgr
+	install -D scripts/list_registration                $(DESTDIR)/usr/libexec/idmgr
+	install -D scripts/update_users_0_to_1.py           $(DESTDIR)/usr/libexec/idmgr
+	install -D scripts/update_users_1_to_2.py           $(DESTDIR)/usr/libexec/idmgr
+	install -D scripts/update_users_2_to_3.py           $(DESTDIR)/usr/libexec/idmgr
 	install -D registration-server                      $(DESTDIR)/usr/bin
 	install -D -m 644 idmanager.py                      $(DESTDIR)$(PYTHON_SITELIB)
 	install -D conf.schoolserver/idmgr                  $(DESTDIR)/etc/init.d/
 	install -D -m 644 conf.schoolserver/idmgr.conf      $(DESTDIR)/etc/
+	install -m 755 idmgr.setup.sh                       $(DESTDIR)/etc/sysconfig/olpc-scripts/setup.d/idmgr
diff --git a/idmanager.py b/idmanager.py
index 1c969c3..8925be5 100644
--- a/idmanager.py
+++ b/idmanager.py
@@ -108,7 +108,7 @@ class Config:
     BACKUP_PATH = 'backup'
 
     ##Special user creation script
-    NEW_USER_SCRIPT='/home/idmgr/create_user'
+    NEW_USER_SCRIPT='/usr/libexec/idmgr/create_user'
 
     ## Port on which to listen
     PORT = 8080
@@ -121,7 +121,7 @@ class Config:
     WORKDIR = '/'
 
     ##what script creates system users for XO owners?
-    NEW_USER_SCRIPT='/home/idmgr/create_user'
+    NEW_USER_SCRIPT='/usr/libexec/idmgr/create_user'
 
     ##how many XOs before we start grouping them into days.
     USE_GROUPS_THRESHOLD = 40
diff --git a/idmgr.setup.sh b/idmgr.setup.sh
new file mode 100644
index 0000000..69f8259
--- /dev/null
+++ b/idmgr.setup.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+# Make idmgr account, if not already present
+# This should be a system account (no passwd timeout), w. no passwd,
+# but having a home directory.
+if [ ! -d /home/idmgr ] ; then
+   /usr/sbin/useradd -s /sbin/nologin -r -m \
+       -c "idmgr Registration service" idmgr &>/dev/null || :
+fi
+
+# Make directory in /library for user accounts, if not already done
+mkdir -p /library/users
+
+# Make sure the xousers group exists
+getent group xousers > /dev/null 2>&1 || groupadd xousers
+
+#  Create the identity database, if there is no pre-existing one
+#  and set the current rev number
+if [ ! -r /home/idmgr/identity.db ] ; then
+   # creates a v2 format file
+   /usr/libexec/idmgr/create_registration
+fi
+
+if [ ! -r /home/idmgr/storage_format_version ] || \
+   [ `cat /home/idmgr/storage_format_version` == 0 ] ; then
+   # Existing users might not be in the xousers group. Fix that.
+   /usr/libexec/idmgr/update_users_0_to_1.py
+   echo 1 > /home/idmgr/storage_format_version
+fi
+
+if [ ! -r /home/idmgr/storage_format_version ] || \
+   [ `cat /home/idmgr/storage_format_version` == 1 ] ; then
+   # Add database columns for UUID and modification date.
+   /usr/libexec/idmgr/update_users_1_to_2.py && \
+   echo 2 > /home/idmgr/storage_format_version
+fi
+
+if [ ! -r /home/idmgr/storage_format_version ] || \
+   [ `cat /home/idmgr/storage_format_version` == 2 ] ; then
+   # Add database column for group
+   /usr/libexec/idmgr/update_users_2_to_3.py && \
+   echo 3 > /home/idmgr/storage_format_version
+fi
+
+# Make readable by apache and others
+chmod ugo+rx /home/idmgr
+
+/sbin/chkconfig --add idmgr
+/sbin/service idmgr condrestart
+
diff --git a/idmgr.spec b/idmgr.spec
index 3edd738..b5443c3 100644
--- a/idmgr.spec
+++ b/idmgr.spec
@@ -18,6 +18,7 @@ Requires:       python python-sqlalchemy
 Requires(pre):  /usr/bin/sqlite3, /usr/sbin/useradd
 Requires(post): /sbin/chkconfig, /sbin/service
 Requires:       rssh
+Requires:       xs-config
 BuildRequires:  python-devel
 
 
@@ -33,56 +34,6 @@ ID Management Service for the XS School Server
 %prep
 %setup
 
-%pre
-#  Make idmgr account, if not already present
-#  This should be a system account (no passwd timeout), w. no passwd,
-#  but having a home directory.
-if [ ! -d /home/idmgr ] ; then
-   /usr/sbin/useradd -s /sbin/nologin -r -m \
-       -c "idmgr Registration service" idmgr &>/dev/null || :
-fi
-#  Make directory in /library for user accounts, if not already done
-if [ ! -d /library/users/ ] ; then
-   mkdir -p /library/users
-fi
-# Make  sure the xousers group exists
-getent group xousers > /dev/null 2>&1 || groupadd xousers
-
-%post
-#  Create the identity database, if there is no pre-existing one
-#  and set the current rev number
-if [ ! -r /home/idmgr/identity.db ] ; then
-   # creates a v2 format file
-   /home/idmgr/create_registration
-fi
-
-if [ ! -r /home/idmgr/storage_format_version ] || \
-   [ `cat /home/idmgr/storage_format_version` == 0 ] ; then
-   # Existing users might not be in the xousers group. Fix that.
-   /home/idmgr/update_users_0_to_1.py
-   echo 1 > /home/idmgr/storage_format_version
-fi
-
-if [ ! -r /home/idmgr/storage_format_version ] || \
-   [ `cat /home/idmgr/storage_format_version` == 1 ] ; then
-   # Add database columns for UUID and modification date.
-   /home/idmgr/update_users_1_to_2.py && \
-   echo 2 > /home/idmgr/storage_format_version
-fi
-
-if [ ! -r /home/idmgr/storage_format_version ] || \
-   [ `cat /home/idmgr/storage_format_version` == 2 ] ; then
-   # Add database column for group
-   /home/idmgr/update_users_2_to_3.py && \
-   echo 3 > /home/idmgr/storage_format_version
-fi
-
-# Make readable by apache and others
-chmod ugo+rx /home/idmgr
-
-/sbin/chkconfig --add idmgr
-/sbin/service idmgr condrestart
-
 %preun
 if [ $1 -eq 0 ]; then
     /sbin/service idmgr stop &>/dev/null || :
@@ -91,7 +42,7 @@ fi
 
 %postun
 if [ $1 -ge 1 ]; then
-    /sbin/service idmgr restart &>/dev/null || :
+    /sbin/service idmgr condrestart &>/dev/null || :
 fi
 
 %install
@@ -102,27 +53,14 @@ make DESTDIR=$RPM_BUILD_ROOT PYTHON_SITELIB=%{python_sitelib} install
 rm -rf $RPM_BUILD_ROOT
 
 %files
+%defattr(-,root,root,-)
 %doc README
 %doc COPYING
 %config(noreplace) /etc/idmgr.conf
 /etc/init.d/idmgr
-/home/idmgr/create_registration
-/home/idmgr/create_user
-/home/idmgr/remove_user
-/home/idmgr/update_users_0_to_1.py
-/home/idmgr/update_users_0_to_1.pyo
-/home/idmgr/update_users_0_to_1.pyc
-/home/idmgr/update_users_1_to_2.py
-/home/idmgr/update_users_1_to_2.pyo
-/home/idmgr/update_users_1_to_2.pyc
-/home/idmgr/update_users_2_to_3.py
-/home/idmgr/update_users_2_to_3.pyo
-/home/idmgr/update_users_2_to_3.pyc
-/home/idmgr/list_registration
-/home/idmgr/test/xo-register
-/home/idmgr/test/local-register
-/home/idmgr/test/db_dump
-/usr/bin/registration-server
+%{_sysconfdir}/sysconfig/olpc-scripts/setup.d/idmgr
+%{_libexecdir}/%{name}
+%{_bindir}/registration-server
 %{python_sitelib}/idmanager.py
 %{python_sitelib}/idmanager.pyc
 %{python_sitelib}/idmanager.pyo
-----------------------------------------------------------------------


--
/home/olpc-code/git/projects/idmgr


More information about the Commits mailing list