Whamcloud - gitweb
* ensure the PATH in the environment includes the elements in DEFAULT_PATH
authorrread <rread>
Mon, 7 Oct 2002 17:02:52 +0000 (17:02 +0000)
committerrread <rread>
Mon, 7 Oct 2002 17:02:52 +0000 (17:02 +0000)
lustre/utils/lconf

index 8e86cff..6d27904 100755 (executable)
@@ -1547,6 +1547,21 @@ def sys_make_devices():
     if not os.access('/dev/obd', os.R_OK):
         run('mknod /dev/obd c 10 241')
 
+
+# Add dir to the global PATH, if not already there.
+def add_to_path(new_dir):
+    syspath = string.split(os.environ['PATH'], ':')
+    if new_dir in syspath:
+        return
+    os.environ['PATH'] = os.environ['PATH'] + ':' + new_dir
+    
+
+DEFAULT_PATH = ('/sbin', '/usr/sbin', '/bin', '/usr/bin')
+# ensure basic elements are in the system path
+def sanitise_path():
+    for dir in DEFAULT_PATH:
+        add_to_path(dir)
+
 # Initialize or shutdown lustre according to a configuration file
 #   * prepare the system for lustre
 #   * configure devices with lctl
@@ -1556,6 +1571,8 @@ def main():
     global TCP_ACCEPTOR, lctl, MAXTCPBUF
     host = socket.gethostname()
 
+    sanitise_path()
+
     args = parse_cmdline(sys.argv[1:])
     if len(args) > 0:
         if not os.access(args[0], os.R_OK | os.W_OK):