opuntiaOS - an operating system targeting x86 and ARMv7
at master 33 lines 778 B view raw
1import os 2 3ignore = [ 4 '.DS_Store' 5] 6 7apps_dir = 'home' 8apps_dir_full = os.getcwd() + '/' + apps_dir 9apps_dir_len = len(apps_dir) 10installer = './utils/app_installer.exec' 11print(apps_dir) 12 13folders = [] 14files = [] 15 16# r = root, d = directories, f = files 17for r, d, f in os.walk(apps_dir): 18 for folder in d: 19 folders.append((r[apps_dir_len:]+'/', folder)) 20 for file in f: 21 files.append((r[apps_dir_len:]+'/', file)) 22 23for path, fname in folders: 24 cmd = "{0} mkdir {1} {2}".format(installer, path, fname) 25 print(cmd) 26 os.system(cmd) 27 28for path, fname in files: 29 print (apps_dir+'/'+fname) 30 cmd = "{0} writefile {1} {2} {3}".format(installer, path, fname, apps_dir+'/'+fname) 31 if not (fname in ignore): 32 print(cmd) 33 os.system(cmd)