4 usage: %(progname)s robot robot_type web_user 7 import os, sys, string, time, getopt
12 if os.path.exists(fn):
return 14 open(fn,
"w").write(default)
17 config_dir =
"/etc/ros/" 19 log_dir =
"/var/log/ros/" 21 user = pwd.getpwnam(web_user)
22 for path
in (config_dir, var_dir, log_dir):
23 if not os.path.exists(path):
25 os.chown(path, user.pw_uid, user.pw_gid)
27 make_file(os.path.join(config_dir,
"user"), web_user)
28 make_file(os.path.join(config_dir,
"master"),
"http://localhost:11311/")
29 make_file(os.path.join(config_dir,
"robot"), robot)
30 make_file(os.path.join(config_dir,
"robot_type"), robot_type)
32 subprocess.call([
"install",
"setup.bash", os.path.join(config_dir,
"setup.bash")])
33 subprocess.call([
"install",
"apache.cfg", os.path.join(config_dir,
"ros_webui_apache.cfg")])
35 subprocess.call([
"install",
"webui.init",
"/usr/bin/webui"])
41 print __doc__ % vars()
43 def main(argv, stdout, environ):
45 optlist, args = getopt.getopt(argv[1:],
"", [
"help",
"test",
"debug"])
53 for (field, val)
in optlist:
57 elif field ==
"--debug":
59 elif field ==
"--test":
70 install(robot, robot_type, web_user)
73 if __name__ ==
"__main__":
74 main(sys.argv, sys.stdout, os.environ)
def main(argv, stdout, environ)
def make_file(fn, default)
def install(robot, robot_type, web_user)