Index: scripts/files_check.py =================================================================== diff -u -r3508eb862db3d45a89ef17bd63f385c80fb52775 -r8f45330e0b1af61e029bece73c9f23669ada56c1 --- scripts/files_check.py (.../files_check.py) (revision 3508eb862db3d45a89ef17bd63f385c80fb52775) +++ scripts/files_check.py (.../files_check.py) (revision 8f45330e0b1af61e029bece73c9f23669ada56c1) @@ -61,23 +61,41 @@ json.dump(lookup, f, ensure_ascii=False, indent=4) -def get_scripts(base_dir: str) -> List[str]: +def get_files_in_dir(base_dir: str, file_types: str = "*.sh", recursive: bool = False) -> List[str]: """ Gets a list of full paths for each script placed on the device :param base_dir: the parent directory where the scripts reside + :param file_types: the types of files we want to look at + :param recursive: if True, recurse, otherwise only look in base_dir :return: a list of all the scripts """ - return glob.glob(os.path.join(base_dir, "*.sh"), recursive=False) + return glob.glob(os.path.join(base_dir, file_types), recursive=recursive) +def get_files_recursive(base_dir: str) -> List[str]: + """ + Recursively gets a list of full paths for each file in the provided base directory + + :return: the list of all the files + """ + return [os.path.join(dp, f) for dp, dn, fn in os.walk(os.path.expanduser(base_dir)) for f in fn] + + + if __name__ == '__main__': hostname = socket.gethostname() if hostname == "DEN-UI": files = [ "/home/denali/Projects/tmp/build/denali-Qt_5_12_5_iMX8-Release/denali", ] - files += get_scripts("/home/denali/Projects/application/scripts") - generate_checksums(files, "checksums.conf") + files += get_files_in_dir("/home/denali/Projects/application/scripts") + generate_checksums(files, "checksums_desktop.conf") elif hostname == "b2qt-nitrogen8mm": - pass \ No newline at end of file + files = [] + files += get_files_in_dir("/home/root/") + files += get_files_in_dir("/home/root/scripts/") + files += get_files_recursive("/bin/") + files += get_files_recursive("/sbin/") + files += get_files_recursive("/lib/") + generate_checksums(files, "checksums_target.conf")