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."""
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])
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])
30 'Invalid syntax. Possible values are [copy], [setup_dir], '
31 '[perm_dir], [remove_dir]')
36 if __name__
== '__main__':