From: rread Date: Mon, 7 Oct 2002 17:02:52 +0000 (+0000) Subject: * ensure the PATH in the environment includes the elements in DEFAULT_PATH X-Git-Tag: v1_7_100~4580 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=83efb5b82132ae50c4a802f87f4bed460a4953a0;p=fs%2Flustre-release.git * ensure the PATH in the environment includes the elements in DEFAULT_PATH --- diff --git a/lustre/utils/lconf b/lustre/utils/lconf index 8e86cff..6d27904 100755 --- a/lustre/utils/lconf +++ b/lustre/utils/lconf @@ -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):