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 <sascha@silbe.org>
This commit is contained in:
Sascha Silbe 2010-01-11 16:51:15 +00:00
parent 709d44d602
commit 1d8b1b98cb

View File

@ -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',