| 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 filename = os.path.join(sys.argv[3], 'chrome.json') |
| 18 os.chmod(filename, 0755) | 18 os.chmod(filename, 0755) |
| 19 elif sys.argv[1] == 'setup_dir': | 19 elif sys.argv[1] == 'setup_dir': |
| 20 os.system('mkdir -p %s' % sys.argv[2]) | 20 os.system('mkdir -p %s' % sys.argv[2]) |
| 21 os.system('chmod -R 755 /etc/opt/chrome/') |
| 21 elif sys.argv[1] == 'remove_dir': | 22 elif sys.argv[1] == 'remove_dir': |
| 22 os.system('rm -rf %s' % sys.argv[2]) | 23 os.system('rm -rf %s' % sys.argv[2]) |
| 23 else: | 24 else: |
| 24 print >>sys.stderr, 'Invalid syntax. Possible values are [copy], \ | 25 print >>sys.stderr, 'Invalid syntax. Possible values are [copy], \ |
| 25 [setup_dir], [remove_dir]' | 26 [setup_dir], [remove_dir]' |
| 26 | 27 |
| 27 | 28 |
| 28 if __name__ == '__main__': | 29 if __name__ == '__main__': |
| 29 main() | 30 main() |
| OLD | NEW |