Skip to content

Commit

Permalink
simplifyed gen_playgournds script, now single for all binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
ixanezis committed Feb 21, 2012
1 parent b7bc008 commit 9d18294
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
14 changes: 2 additions & 12 deletions gen_playgrounds/gen_playgrounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,11 @@
executable = executable.strip()
if executable == '': continue
shutil.copy(executable, sandbox_path)
# check_call(["cp", executable, sandbox_path])

playground_with_subdir = os.path.join(path, '**') # all subdirectories and files
profile = open('profile').read().format(playground_with_subdir, playground_with_subdir)

for entry in os.listdir(sandbox_path):
output = open(os.path.join(APPARMOR_PROFILES, os.path.join(sandbox_path, entry).replace('/', '.')[1:]), 'w')
#for now, using a single profile for all binary types
print (profile, file=output, end='')

for entry in os.listdir(path):
if os.path.isdir(os.path.join(path, entry)):
cpp_binary = os.path.join(path, entry, 'a.out') #TODO: What is a default cpp binary file ?
output = open(os.path.join(APPARMOR_PROFILES, cpp_binary.replace('/', '.')[1:]), 'w')
print(profile, file = output)
output = open(os.path.join(APPARMOR_PROFILES, playground_with_subdir.replace('/','.')[1:]), 'w')
print(profile, file = output)

check_call([APPARMOR_INIT, 'restart'])
check_call(["chmod", '777', '-R', path])
Expand Down
3 changes: 2 additions & 1 deletion unittests.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ def test_checker_floats(self):


if __name__ == "__main__":
unittest.main()
unittest.main()

0 comments on commit 9d18294

Please sign in to comment.