jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 1 | #!/usr/bin/python2 |
| 2 | import os |
| 3 | import sys |
| 4 | import inspect |
| 5 | from sets import Set |
| 6 | |
| 7 | def 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:" |
jeraldabraham | 5fdeecd | 2014-04-25 15:56:03 -0700 | [diff] [blame] | 14 | print " install_ndncxx - install ndn-cxx (named-data/ndn-cxx)" |
jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 15 | 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 Newberry | 86b00b9 | 2015-06-07 15:23:51 -0700 | [diff] [blame] | 18 | print " install_ndntools - install ndn-tools (named-data/ndn-tools)" |
Yanbiao Li | a8a7d27 | 2015-07-20 17:28:45 -0700 | [diff] [blame] | 19 | print " install_repo - install repo-ng (named-data/repo-ng)" |
| 20 | print " install_infoedit - install infoedit" |
Hila Ben Abraham | e8c22e9 | 2016-10-20 14:30:32 -0500 | [diff] [blame] | 21 | print " install_tools - install tests tools" |
jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 22 | print " install_all - do all of the above" |
| 23 | print " help - print this message and exit\n" |
| 24 | |
| 25 | |
| 26 | def 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) |
jeraldabraham | 5fdeecd | 2014-04-25 15:56:03 -0700 | [diff] [blame] | 32 | validOptions = [ "install_ndncxx", |
jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 33 | "setup_security", |
| 34 | "install_NFD", |
| 35 | "install_ndntraffic", |
Eric Newberry | 86b00b9 | 2015-06-07 15:23:51 -0700 | [diff] [blame] | 36 | "install_ndntools", |
Yanbiao Li | a8a7d27 | 2015-07-20 17:28:45 -0700 | [diff] [blame] | 37 | "install_repo", |
| 38 | "install_infoedit", |
Hila Ben Abraham | e8c22e9 | 2016-10-20 14:30:32 -0500 | [diff] [blame] | 39 | "install_tools", |
jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 40 | "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: |
jeraldabraham | 5fdeecd | 2014-04-25 15:56:03 -0700 | [diff] [blame] | 53 | actionList.add("install_ndncxx") |
jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 54 | actionList.add("setup_security") |
| 55 | actionList.add("install_NFD") |
| 56 | actionList.add("install_ndntraffic") |
Eric Newberry | 86b00b9 | 2015-06-07 15:23:51 -0700 | [diff] [blame] | 57 | actionList.add("install_ndntools") |
Yanbiao Li | a8a7d27 | 2015-07-20 17:28:45 -0700 | [diff] [blame] | 58 | actionList.add("install_repo") |
| 59 | actionList.add("install_infoedit") |
Hila Ben Abraham | e8c22e9 | 2016-10-20 14:30:32 -0500 | [diff] [blame] | 60 | actionList.add("install_tools") |
jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 61 | module = __import__("setup_preparation_folder") |
| 62 | module.run() |
| 63 | module = __import__("install_dependencies") |
| 64 | module.run() |
jeraldabraham | 5fdeecd | 2014-04-25 15:56:03 -0700 | [diff] [blame] | 65 | if "install_ndncxx" in actionList: |
| 66 | module = __import__("install_ndncxx") |
jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 67 | 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 Newberry | 86b00b9 | 2015-06-07 15:23:51 -0700 | [diff] [blame] | 77 | if "install_ndntools" in actionList: |
| 78 | module = __import__("install_ndntools") |
jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 79 | module.run() |
Yanbiao Li | a8a7d27 | 2015-07-20 17:28:45 -0700 | [diff] [blame] | 80 | 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 Abraham | e8c22e9 | 2016-10-20 14:30:32 -0500 | [diff] [blame] | 86 | if "install_tools" in actionList: |
| 87 | module = __import__("install_tools") |
| 88 | module.run() |
jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 89 | print "" |
| 90 | else: |
| 91 | usage() |
| 92 | else: |
| 93 | usage() |
| 94 | |
| 95 | |
| 96 | if __name__ == "__main__": |
| 97 | main() |