Merge branch 'master' into selenium
[slapos.git] / software / zencart / configure.py
1 import sys
2 import os
3 import fileinput
4
5 def setup(args):
6 base_url, htdocs, renamed, mysql_user, mysql_password, mysql_database, mysql_host = args
7
8 rename = renamed.split(", ")
9 admin_dir = rename[0].split("=>")[1].strip()
10 admin_include_file = os.path.join(htdocs, admin_dir + "/includes/configure.php")
11 searchPattern = "/admin"
12 replacePattern = "/" + admin_dir
13 os.chmod(admin_include_file, 0744)
14 for line in fileinput.input(admin_include_file, inplace=1):
15 if searchPattern in line:
16 line = line.replace(searchPattern, replacePattern)
17 sys.stdout.write(line)
18 os.chmod(admin_include_file, 0444)
19
20 if __name__ == '__main__':
21 setup(sys.argv[1:])