OLD | NEW |
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 # Helper script to copy policy files into | 5 # Helper script to copy policy files into |
6 # the correct managed policy location in the machine | 6 # the correct managed policy location in the machine |
7 | 7 |
8 import os | 8 import os |
9 import sys | 9 import sys |
10 import shutil | 10 import shutil |
11 | 11 |
12 | 12 |
13 def main(): | 13 def main(): |
14 assert os.geteuid() == 0, 'Need superuser privileges' | 14 assert os.geteuid() == 0, 'Need superuser privileges' |
15 if sys.argv[1] == 'copy': | 15 if sys.argv[1] == 'copy': |
16 shutil.copy(sys.argv[2], sys.argv[3]) | 16 shutil.copy(sys.argv[2], sys.argv[3]) |
17 filename = os.path.join(sys.argv[3], 'chrome.json') | 17 dirList = os.listdir(sys.argv[3]) |
18 os.chmod(filename, 0755) | 18 for fname in dirList: |
| 19 filename = os.path.join(sys.argv[3], fname) |
| 20 os.chmod(filename, 0755) |
19 elif sys.argv[1] == 'setup_dir': | 21 elif sys.argv[1] == 'setup_dir': |
20 os.system('mkdir -p %s' % sys.argv[2]) | 22 os.system('mkdir -p %s' % sys.argv[2]) |
21 os.system('chmod -R 755 /etc/opt/chrome/') | 23 os.system('chmod -R 755 /etc/opt/chrome/') |
22 elif sys.argv[1] == 'remove_dir': | 24 elif sys.argv[1] == 'remove_dir': |
23 os.system('rm -rf %s' % sys.argv[2]) | 25 os.system('rm -rf %s' % sys.argv[2]) |
24 else: | 26 else: |
25 print >>sys.stderr, 'Invalid syntax. Possible values are [copy], \ | 27 print >>sys.stderr, 'Invalid syntax. Possible values are [copy], \ |
26 [setup_dir], [remove_dir]' | 28 [setup_dir], [remove_dir]' |
27 | 29 |
28 | 30 |
29 if __name__ == '__main__': | 31 if __name__ == '__main__': |
30 main() | 32 main() |
OLD | NEW |