Chromium Code Reviews| 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 = sys.argv[3] + '/chrome.json' | |
|
Nirnimesh
2011/07/19 19:27:41
use os.path.join()
aocampo
2011/07/19 20:20:58
Done.
| |
| 18 os.chmod(filename, 0755) | |
|
Nirnimesh
2011/07/19 19:27:41
Have you verified on the bot that this is enough?
aocampo
2011/07/19 20:20:58
Yes.
| |
| 17 elif sys.argv[1] == 'setup_dir': | 19 elif sys.argv[1] == 'setup_dir': |
| 18 os.system('mkdir -p %s' % sys.argv[2]) | 20 os.system('mkdir -p %s' % sys.argv[2]) |
| 19 elif sys.argv[1] == 'remove_dir': | 21 elif sys.argv[1] == 'remove_dir': |
| 20 os.system('rm -rf %s' % sys.argv[2]) | 22 os.system('rm -rf %s' % sys.argv[2]) |
| 21 else: | 23 else: |
| 22 print >>sys.stderr, 'Invalid syntax. Possible values are [copy], \ | 24 print >>sys.stderr, 'Invalid syntax. Possible values are [copy], \ |
| 23 [setup_dir], [remove_dir]' | 25 [setup_dir], [remove_dir]' |
| 24 | 26 |
| 25 | 27 |
| 26 if __name__ == '__main__': | 28 if __name__ == '__main__': |
| 27 main() | 29 main() |
| OLD | NEW |