Improve Coriolis root directory search in coriolisEnv.py.

* Change: In bootstrap/coriolisEnv.py, when all tries to locate the
    installation root in predefined locations, try the directory the
    script is installed in.
      This allows for a user to use an installation made in another
    user's account.
This commit is contained in:
Jean-Paul Chaput 2021-10-09 22:39:06 +02:00
parent 4a256f36b5
commit b9a1395b4b
1 changed files with 12 additions and 5 deletions

View File

@ -244,15 +244,22 @@ if __name__ == "__main__":
shellMessage = "Using SoC network-wide Coriolis 2 (/soc/coriolis2)"
else:
if not rootDir:
rootDir = os.getenv("HOME") + "/coriolis-2.x"
coriolisTop = "%s/%s/%s/install" % ( rootDir, osType, buildDir )
sysconfDir = coriolisTop + "/etc/coriolis2"
shellMessage = "Using user-selected Coriolis 2 (%s)" % rootDir
scriptRoot = '/'.join( scriptDir.split('/')[:-2] )
if not os.path.exists(scriptRoot):
rootDir = os.getenv("HOME") + "/coriolis-2.x"
coriolisTop = "%s/%s/%s/install" % ( rootDir, osType, buildDir )
sysconfDir = coriolisTop + "/etc/coriolis2"
shellMessage = "Using user-selected Coriolis 2 (%s)" % rootDir
else:
rootDir = scriptRoot
coriolisTop = rootDir
sysconfDir = coriolisTop + "/etc/coriolis2"
shellMessage = "Using script location Coriolis 2 (%s)" % rootDir
if osType.startswith("Cygwin"):
strippedPath = "%s/lib:%s" % ( coriolisTop, libDir, strippedPath )
if not os.path.exists(coriolisTop):
print( 'echo "[ERROR] coriolisEnv.py, top directory <%s> do not exists."'.format( coriolisTop ))
print( 'echo "[ERROR] coriolisEnv.py, top directory "{}" do not exists."'.format( coriolisTop ))
sys.exit( 1 )
for lib in [ 'lib64', 'lib' ]:
libDir = lib