Implement nacl_irt_memory for non-sfi mode.
[chromium-blink-merge.git] / chrome / test / pyautolib / policy_posix_util.py
blob420131b3714cc2783372342c1295986dfc9811ba
1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
6 """Helper script to copy policy files into the correct location the machine."""
8 import os
9 import shutil
10 import sys
13 def main():
14 assert os.geteuid() == 0, 'Need superuser privileges'
15 if sys.argv[1] == 'copy':
16 assert os.path.isdir(sys.argv[3])
17 shutil.copy(sys.argv[2], sys.argv[3])
18 dirList = os.listdir(sys.argv[3])
19 for fname in dirList:
20 filename = os.path.join(sys.argv[3], fname)
21 os.chmod(filename, 0755)
22 elif sys.argv[1] == 'setup_dir':
23 os.makedirs(sys.argv[2])
24 elif sys.argv[1] == 'perm_dir':
25 os.system('chmod -R 755 "%s/../.."' % sys.argv[2])
26 elif sys.argv[1] == 'remove_dir':
27 os.system('rm -rf "%s"' % sys.argv[2])
28 else:
29 print >>sys.stderr, (
30 'Invalid syntax. Possible values are [copy], [setup_dir], '
31 '[perm_dir], [remove_dir]')
32 return 1
33 return 0
36 if __name__ == '__main__':
37 sys.exit(main())