From 1d8b1b98cb7da09caa9bdf2c1c8dd70e475d245e Mon Sep 17 00:00:00 2001 From: Sascha Silbe Date: Mon, 11 Jan 2010 16:51:15 +0000 Subject: [PATCH] don't use rainbow if it has been uninstalled, but the config file remains (#1317) Some distros retain config files after removing packages, so /etc/olpc-security might exist even if rainbow is not installed. Signed-off-by: Sascha Silbe --- src/sugar/activity/activityfactory.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/sugar/activity/activityfactory.py b/src/sugar/activity/activityfactory.py index ee0fd921..30fd14b7 100644 --- a/src/sugar/activity/activityfactory.py +++ b/src/sugar/activity/activityfactory.py @@ -244,8 +244,12 @@ class ActivityCreationHandler(gobject.GObject): self._handle.object_id, self._handle.uri) + dev_null = file('/dev/null', 'w') environment_dir = None - if os.path.exists('/etc/olpc-security'): + rainbow_found = subprocess.call(['which', 'rainbow-run'], + stdout=dev_null, stderr=dev_null) == 0 + use_rainbow = rainbow_found and os.path.exists('/etc/olpc-security') + if use_rainbow: environment_dir = tempfile.mkdtemp() command = ['/usr/bin/sudo', '-E', '--', '/usr/bin/rainbow-run',