blob: 1af7a8b3880e1ae8a282a8a65c0115c416d8b3de [file] [log] [blame]
jeraldabraham5d4d7352014-03-28 02:49:04 -07001#!/usr/bin/python2
2import os
3import sys
4import inspect
5from sets import Set
6
7def usage():
8 print "\nUSAGE:"
9 print " ./install_apps.py [OPTIONS]\n"
10 print " Install NDN applications"
11 print " Latest source codes will be downloaded from their GitHub"
12 print " named-data repositories (https://github.com/named-data)"
13 print "\nOPTIONS:"
jeraldabraham5fdeecd2014-04-25 15:56:03 -070014 print " install_ndncxx - install ndn-cxx (named-data/ndn-cxx)"
jeraldabraham5d4d7352014-03-28 02:49:04 -070015 print " setup_security - create an identity using ndnsec (/tmp/nfd_integration)"
16 print " install_NFD - install NFD (named-data/NFD)"
17 print " install_ndntraffic - install ndn-traffic-generator (named-data/ndn-traffic-generator)"
18 print " install_ndntlvping - install ndn-tlv-ping (named-data/ndn-tlv-ping)"
19 print " install_all - do all of the above"
20 print " help - print this message and exit\n"
21
22
23def main():
24 cmd_subfolder = os.path.realpath(
25 os.path.abspath(os.path.join(os.path.split(
26 inspect.getfile(inspect.currentframe()))[0], "install_helpers")))
27 if cmd_subfolder not in sys.path:
28 sys.path.insert(0, cmd_subfolder)
jeraldabraham5fdeecd2014-04-25 15:56:03 -070029 validOptions = [ "install_ndncxx",
jeraldabraham5d4d7352014-03-28 02:49:04 -070030 "setup_security",
31 "install_NFD",
32 "install_ndntraffic",
33 "install_ndntlvping",
34 "install_all",
35 "help" ]
36
37 if len(sys.argv) > 1:
38 actionList = Set(sys.argv[1:])
39 optionsStatus = 0
40 for option in actionList:
41 if option not in validOptions:
42 print "Invalid option provided - " + option
43 optionsStatus = -1
44 break
45 if optionsStatus == 0 and "help" not in actionList:
46 if "install_all" in actionList:
jeraldabraham5fdeecd2014-04-25 15:56:03 -070047 actionList.add("install_ndncxx")
jeraldabraham5d4d7352014-03-28 02:49:04 -070048 actionList.add("setup_security")
49 actionList.add("install_NFD")
50 actionList.add("install_ndntraffic")
51 actionList.add("install_ndntlvping")
52 module = __import__("setup_preparation_folder")
53 module.run()
54 module = __import__("install_dependencies")
55 module.run()
jeraldabraham5fdeecd2014-04-25 15:56:03 -070056 if "install_ndncxx" in actionList:
57 module = __import__("install_ndncxx")
jeraldabraham5d4d7352014-03-28 02:49:04 -070058 module.run()
59 if "setup_security" in actionList:
60 module = __import__("setup_security")
61 module.run()
62 if "install_NFD" in actionList:
63 module = __import__("install_NFD")
64 module.run()
65 if "install_ndntraffic" in actionList:
66 module = __import__("install_ndntraffic")
67 module.run()
68 if "install_ndntlvping" in actionList:
69 module = __import__("install_ndntlvping")
70 module.run()
71 print ""
72 else:
73 usage()
74 else:
75 usage()
76
77
78if __name__ == "__main__":
79 main()