Commit 45ea0333 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Fixed permissions script. [skip ci]

parent d8c2b83b
Pipeline #44839 skipped
......@@ -6,20 +6,29 @@ import stat
if __name__ == '__main__':
paths = sys.argv[1:]
def fix_permissions(path):
has_problems = False
for item in os.listdir(path):
filepath = os.path.join(path, item)
if os.path.islink(filepath):
continue
stats = os.stat(filepath)
has_problems |= not bool(stats.st_mode & stat.S_IROTH)
if stats.st_mode & stat.S_IFDIR:
has_problems |= not bool(stats.st_mode & stat.S_IXOTH)
if has_problems:
print('fixing problems for %s' % path)
os.system('find %s -type d -exec chmod +x {} \\;' % path)
os.system('find %s -exec chmod +r {} \\;' % path)
print('fixing problems for %s' % path)
os.system('find %s -type d -exec chmod +x {} \\;' % path)
os.system('find %s -exec chmod +r {} \\;' % path)
if len(sys.argv) == 2:
path = sys.argv[1]
paths = [os.path.join(path, item) for item in os.listdir(path)]
elif len(sys.argv) == 1:
print('no path given')
else:
paths = sys.argv[1:]
with mp.Pool(5) as p:
p.map(fix_permissions, paths)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment