blob: b267357986b3985ac83cd5bb494a867544c1a6cb [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)"
Eric Newberry86b00b92015-06-07 15:23:51 -070018 print " install_ndntools - install ndn-tools (named-data/ndn-tools)"
Yanbiao Lia8a7d272015-07-20 17:28:45 -070019 print " install_repo - install repo-ng (named-data/repo-ng)"
20 print " install_infoedit - install infoedit"
Hila Ben Abrahame8c22e92016-10-20 14:30:32 -050021 print " install_tools - install tests tools"
jeraldabraham5d4d7352014-03-28 02:49:04 -070022 print " install_all - do all of the above"
23 print " help - print this message and exit\n"
24
25
26def main():
27 cmd_subfolder = os.path.realpath(
28 os.path.abspath(os.path.join(os.path.split(
29 inspect.getfile(inspect.currentframe()))[0], "install_helpers")))
30 if cmd_subfolder not in sys.path:
31 sys.path.insert(0, cmd_subfolder)
jeraldabraham5fdeecd2014-04-25 15:56:03 -070032 validOptions = [ "install_ndncxx",
jeraldabraham5d4d7352014-03-28 02:49:04 -070033 "setup_security",
34 "install_NFD",
35 "install_ndntraffic",
Eric Newberry86b00b92015-06-07 15:23:51 -070036 "install_ndntools",
Yanbiao Lia8a7d272015-07-20 17:28:45 -070037 "install_repo",
38 "install_infoedit",
Hila Ben Abrahame8c22e92016-10-20 14:30:32 -050039 "install_tools",
jeraldabraham5d4d7352014-03-28 02:49:04 -070040 "install_all",
41 "help" ]
42
43 if len(sys.argv) > 1:
44 actionList = Set(sys.argv[1:])
45 optionsStatus = 0
46 for option in actionList:
47 if option not in validOptions:
48 print "Invalid option provided - " + option
49 optionsStatus = -1
50 break
51 if optionsStatus == 0 and "help" not in actionList:
52 if "install_all" in actionList:
jeraldabraham5fdeecd2014-04-25 15:56:03 -070053 actionList.add("install_ndncxx")
jeraldabraham5d4d7352014-03-28 02:49:04 -070054 actionList.add("setup_security")
55 actionList.add("install_NFD")
56 actionList.add("install_ndntraffic")
Eric Newberry86b00b92015-06-07 15:23:51 -070057 actionList.add("install_ndntools")
Yanbiao Lia8a7d272015-07-20 17:28:45 -070058 actionList.add("install_repo")
59 actionList.add("install_infoedit")
Hila Ben Abrahame8c22e92016-10-20 14:30:32 -050060 actionList.add("install_tools")
jeraldabraham5d4d7352014-03-28 02:49:04 -070061 module = __import__("setup_preparation_folder")
62 module.run()
63 module = __import__("install_dependencies")
64 module.run()
jeraldabraham5fdeecd2014-04-25 15:56:03 -070065 if "install_ndncxx" in actionList:
66 module = __import__("install_ndncxx")
jeraldabraham5d4d7352014-03-28 02:49:04 -070067 module.run()
68 if "setup_security" in actionList:
69 module = __import__("setup_security")
70 module.run()
71 if "install_NFD" in actionList:
72 module = __import__("install_NFD")
73 module.run()
74 if "install_ndntraffic" in actionList:
75 module = __import__("install_ndntraffic")
76 module.run()
Eric Newberry86b00b92015-06-07 15:23:51 -070077 if "install_ndntools" in actionList:
78 module = __import__("install_ndntools")
jeraldabraham5d4d7352014-03-28 02:49:04 -070079 module.run()
Yanbiao Lia8a7d272015-07-20 17:28:45 -070080 if "install_repo" in actionList:
81 module = __import__("install_repo")
82 module.run()
83 if "install_infoedit" in actionList:
84 module = __import__("install_infoedit")
85 module.run()
Hila Ben Abrahame8c22e92016-10-20 14:30:32 -050086 if "install_tools" in actionList:
87 module = __import__("install_tools")
88 module.run()
jeraldabraham5d4d7352014-03-28 02:49:04 -070089 print ""
90 else:
91 usage()
92 else:
93 usage()
94
95
96if __name__ == "__main__":
97 main()