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" |
jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 21 | print " install_all - do all of the above" |
| 22 | print " help - print this message and exit\n" |
| 23 | |
| 24 | |
| 25 | def 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) |
jeraldabraham | 5fdeecd | 2014-04-25 15:56:03 -0700 | [diff] [blame] | 31 | validOptions = [ "install_ndncxx", |
jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 32 | "setup_security", |
| 33 | "install_NFD", |
| 34 | "install_ndntraffic", |
Eric Newberry | 86b00b9 | 2015-06-07 15:23:51 -0700 | [diff] [blame] | 35 | "install_ndntools", |
Yanbiao Li | a8a7d27 | 2015-07-20 17:28:45 -0700 | [diff] [blame^] | 36 | "install_repo", |
| 37 | "install_infoedit", |
jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 38 | "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: |
jeraldabraham | 5fdeecd | 2014-04-25 15:56:03 -0700 | [diff] [blame] | 51 | actionList.add("install_ndncxx") |
jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 52 | actionList.add("setup_security") |
| 53 | actionList.add("install_NFD") |
| 54 | actionList.add("install_ndntraffic") |
Eric Newberry | 86b00b9 | 2015-06-07 15:23:51 -0700 | [diff] [blame] | 55 | actionList.add("install_ndntools") |
Yanbiao Li | a8a7d27 | 2015-07-20 17:28:45 -0700 | [diff] [blame^] | 56 | actionList.add("install_repo") |
| 57 | actionList.add("install_infoedit") |
jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 58 | module = __import__("setup_preparation_folder") |
| 59 | module.run() |
| 60 | module = __import__("install_dependencies") |
| 61 | module.run() |
jeraldabraham | 5fdeecd | 2014-04-25 15:56:03 -0700 | [diff] [blame] | 62 | if "install_ndncxx" in actionList: |
| 63 | module = __import__("install_ndncxx") |
jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 64 | 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 Newberry | 86b00b9 | 2015-06-07 15:23:51 -0700 | [diff] [blame] | 74 | if "install_ndntools" in actionList: |
| 75 | module = __import__("install_ndntools") |
jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 76 | module.run() |
Yanbiao Li | a8a7d27 | 2015-07-20 17:28:45 -0700 | [diff] [blame^] | 77 | 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() |
jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 83 | print "" |
| 84 | else: |
| 85 | usage() |
| 86 | else: |
| 87 | usage() |
| 88 | |
| 89 | |
| 90 | if __name__ == "__main__": |
| 91 | main() |