From: Jochen Sprickerhof <git@jochen.sprickerhof.de>
Date: Sat, 6 Jun 2015 15:29:55 +0200
Subject: Use profile.d in /usr in _setup_util.py

---
 cmake/templates/_setup_util.py.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/cmake/templates/_setup_util.py.in b/cmake/templates/_setup_util.py.in
index e73934b..8a80aa3 100755
--- a/cmake/templates/_setup_util.py.in
+++ b/cmake/templates/_setup_util.py.in
@@ -217,6 +217,7 @@ def find_env_hooks(environ, cmake_prefix_path):
     specific_env_hook_ext = environ['CATKIN_SHELL'] if not IS_WINDOWS and 'CATKIN_SHELL' in environ and environ['CATKIN_SHELL'] else None
     # remove non-workspace paths
     workspaces = [path for path in cmake_prefix_path.split(os.pathsep) if path and os.path.isfile(os.path.join(path, CATKIN_MARKER_FILE))]
+    workspaces.append('/')
     for workspace in reversed(workspaces):
         env_hook_dir = os.path.join(workspace, 'etc', 'catkin', 'profile.d')
         if os.path.isdir(env_hook_dir):
@@ -247,7 +248,7 @@ def find_env_hooks(environ, cmake_prefix_path):
     lines.append(assignment('_CATKIN_ENVIRONMENT_HOOKS_COUNT', count))
     for i in range(count):
         lines.append(assignment('_CATKIN_ENVIRONMENT_HOOKS_%d' % i, env_hooks[i]))
-        lines.append(assignment('_CATKIN_ENVIRONMENT_HOOKS_%d_WORKSPACE' % i, env_hooks_workspace[i]))
+        lines.append(assignment('_CATKIN_ENVIRONMENT_HOOKS_%d_WORKSPACE' % i, (env_hooks_workspace[i] if env_hooks_workspace[i] != '/' else '')))
     return lines
 
 
