blob: ccf938d0a16ef1189386c37177eb7392f628ccd3 [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"
jeraldabraham5d4d7352014-03-28 02:49:04 -070021 print " install_all - do all of the above"
22 print " help - print this message and exit\n"
23
24
25def main():
26 cmd_subfolder = os.path.realpath(
27 os.path.abspath(os.path.join(os.path.split(
28 inspect.getfile(inspect.currentframe()))[0], "install_helpers")))
29 if cmd_subfolder not in sys.path:
30 sys.path.insert(0, cmd_subfolder)
jeraldabraham5fdeecd2014-04-25 15:56:03 -070031 validOptions = [ "install_ndncxx",
jeraldabraham5d4d7352014-03-28 02:49:04 -070032 "setup_security",
33 "install_NFD",
34 "install_ndntraffic",
Eric Newberry86b00b92015-06-07 15:23:51 -070035 "install_ndntools",
Yanbiao Lia8a7d272015-07-20 17:28:45 -070036 "install_repo",
37 "install_infoedit",
jeraldabraham5d4d7352014-03-28 02:49:04 -070038 "install_all",
39 "help" ]
40
41 if len(sys.argv) > 1:
42 actionList = Set(sys.argv[1:])
43 optionsStatus = 0
44 for option in actionList:
45 if option not in validOptions:
46 print "Invalid option provided - " + option
47 optionsStatus = -1
48 break
49 if optionsStatus == 0 and "help" not in actionList:
50 if "install_all" in actionList:
jeraldabraham5fdeecd2014-04-25 15:56:03 -070051 actionList.add("install_ndncxx")
jeraldabraham5d4d7352014-03-28 02:49:04 -070052 actionList.add("setup_security")
53 actionList.add("install_NFD")
54 actionList.add("install_ndntraffic")
Eric Newberry86b00b92015-06-07 15:23:51 -070055 actionList.add("install_ndntools")
Yanbiao Lia8a7d272015-07-20 17:28:45 -070056 actionList.add("install_repo")
57 actionList.add("install_infoedit")
jeraldabraham5d4d7352014-03-28 02:49:04 -070058 module = __import__("setup_preparation_folder")
59 module.run()
60 module = __import__("install_dependencies")
61 module.run()
jeraldabraham5fdeecd2014-04-25 15:56:03 -070062 if "install_ndncxx" in actionList:
63 module = __import__("install_ndncxx")
jeraldabraham5d4d7352014-03-28 02:49:04 -070064 module.run()
65 if "setup_security" in actionList:
66 module = __import__("setup_security")
67 module.run()
68 if "install_NFD" in actionList:
69 module = __import__("install_NFD")
70 module.run()
71 if "install_ndntraffic" in actionList:
72 module = __import__("install_ndntraffic")
73 module.run()
Eric Newberry86b00b92015-06-07 15:23:51 -070074 if "install_ndntools" in actionList:
75 module = __import__("install_ndntools")
jeraldabraham5d4d7352014-03-28 02:49:04 -070076 module.run()
Yanbiao Lia8a7d272015-07-20 17:28:45 -070077 if "install_repo" in actionList:
78 module = __import__("install_repo")
79 module.run()
80 if "install_infoedit" in actionList:
81 module = __import__("install_infoedit")
82 module.run()
jeraldabraham5d4d7352014-03-28 02:49:04 -070083 print ""
84 else:
85 usage()
86 else:
87 usage()
88
89
90if __name__ == "__main__":
91 main()