diff --git a/setupDevRepos.py b/setupDevRepos.py index 649407074f8f5ce676bc429ac096a5761b12ecba..d598df87d54632e7890bd4401a99e3390ce2226f 100644 --- a/setupDevRepos.py +++ b/setupDevRepos.py @@ -12,21 +12,27 @@ import sys -def setupLibrary(path): - ''' sets up the library path variable ''' - git_repository_url = "https://github.com/sleuthkit/" +def makeRepos(path): + ''' creates the needed repositories ''' + + # Clone zlib git_zlib_repository_url="https://github.com/madler/" zlib_path = os.path.normpath(os.path.join(path["libewf_64bit"],"zlib")) if not os.path.exists(zlib_path): gitClone(git_zlib_repository_url,"zlib",path["libewf_64bit"]) + + # Clone the others + git_repository_url = "https://github.com/sleuthkit/" for library,base_library_path in path.items(): library_path = os.path.normpath(os.path.join(base_library_path , library)) if not os.path.exists(library_path): gitClone(git_repository_url, library, base_library_path) + def gitClone(URL, repo, path): # This method will clone the library if it does not exist cmd = ["git", "clone", URL + repo + ".git" ] + print("Cloning " + repo + " into " + path) ret = subprocess.call(cmd, stdout=sys.stdout, cwd=path) if ret != 0: sys.exit(1) @@ -37,7 +43,9 @@ def main(): libewf_home = os.getenv("LIBEWF_HOME") libvhdi_home = os.getenv("LIBVHDI_HOME") libvmdk_home = os.getenv("LIBVMDK_HOME") + base_Library_path = {} + if(libewf_home != None): base_Library_path["libewf_64bit"] = ntpath.dirname(libewf_home) else: @@ -49,13 +57,14 @@ def main(): else: print('Please set the env variable LIBVHDI_HOME') sys.exit(1) + if(libvmdk_home != None): base_Library_path["libvmdk_64bit"] = ntpath.dirname(ntpath.dirname(libvmdk_home)) else: print('Please set the env variable LIBVMDK_HOME') sys.exit(1) - setupLibrary(base_Library_path); + makeRepos(base_Library_path); if __name__ == '__main__': main()