[sabayon] Bug #610488: Kill previous sabayon processes, wait at most 30 seconds for the processes to die. Even
- From: Warren Togami <wtogami src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sabayon] Bug #610488: Kill previous sabayon processes, wait at most 30 seconds for the processes to die. Even
- Date: Sat, 20 Feb 2010 04:49:49 +0000 (UTC)
commit b4414f41c2c671ba1aa5853f46ed795362163d7e
Author: Warren Togami <wtogami redhat com>
Date: Fri Feb 19 23:48:16 2010 -0500
Bug #610488: Kill previous sabayon processes, wait at most 30 seconds for the processes to die.
Even without the kill it seems to take at most 5 seconds.
admin-tool/profilesdialog.py | 2 +-
lib/protosession.py | 13 ++++++++++---
lib/usermod.py | 2 +-
3 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/admin-tool/profilesdialog.py b/admin-tool/profilesdialog.py
index fc09d9f..eb78681 100755
--- a/admin-tool/profilesdialog.py
+++ b/admin-tool/profilesdialog.py
@@ -225,8 +225,8 @@ class Session (gobject.GObject):
def start (self):
self.user_profile_path = self.__copy_to_user (self.profile_path)
- self.temp_homedir = protosession.setup_shell_and_homedir (self.username)
protosession.clobber_user_processes (self.username)
+ self.temp_homedir = protosession.setup_shell_and_homedir (self.username)
display_number = protosession.find_free_display ()
diff --git a/lib/protosession.py b/lib/protosession.py
index 073a62e..56bfdde 100644
--- a/lib/protosession.py
+++ b/lib/protosession.py
@@ -29,6 +29,7 @@ import binascii
import struct
import subprocess
import tempfile
+import time
import shutil
import gobject
import gtk
@@ -64,9 +65,15 @@ def setup_shell_and_homedir (username):
dprint ("Setting shell for '%s' to '%s'", username, DEFAULT_SHELL)
usermod.set_shell (username, DEFAULT_SHELL)
- temp_homedir = usermod.create_temporary_homedir (pw.pw_uid, pw.pw_gid)
- dprint ("Setting temporary home directory for '%s' to '%s'", username, temp_homedir)
- usermod.set_homedir (username, temp_homedir)
+ # Wait for previous sabayon processes to die before proceeding
+ for i in range (1,30):
+ temp_homedir = usermod.create_temporary_homedir (pw.pw_uid, pw.pw_gid)
+ dprint ("Setting temporary home directory for '%s' to '%s' attempt %d", username, temp_homedir, i)
+ retval = usermod.set_homedir (username, temp_homedir)
+ dprint ("retval=%d", retval)
+ if retval == 0:
+ break
+ time.sleep(1)
return temp_homedir
diff --git a/lib/usermod.py b/lib/usermod.py
index de043bb..4e7e364 100755
--- a/lib/usermod.py
+++ b/lib/usermod.py
@@ -41,7 +41,7 @@ def set_shell (username, shell):
def set_homedir (username, homedir):
argv = USERMOD_ARGV + [ "-d", homedir, username ]
dprint ("Executing %s" % argv)
- subprocess.call (argv)
+ return subprocess.call (argv)
def create_temporary_homedir (uid, gid):
temp_homedir = tempfile.mkdtemp (prefix = "sabayon-temp-home-")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]