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" |
Eric Newberry | fe0d014 | 2017-11-29 13:22:48 -0700 | [diff] [blame^] | 11 | print " By default, the latest version of each package will be downloaded from the NDN GitHub" |
| 12 | print " repositories (https://github.com/named-data). To obtain the packages locally or from" |
| 13 | print " a specific branch or Gerrit change, use the repos.conf file (see repos.conf.sample for" |
| 14 | print " more information)." |
jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 15 | print "\nOPTIONS:" |
jeraldabraham | 5fdeecd | 2014-04-25 15:56:03 -0700 | [diff] [blame] | 16 | print " install_ndncxx - install ndn-cxx (named-data/ndn-cxx)" |
Eric Newberry | fe0d014 | 2017-11-29 13:22:48 -0700 | [diff] [blame^] | 17 | print " setup_security - create an identity using ndnsec (/tmp/nfd_integration_tests)" |
jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 18 | print " install_NFD - install NFD (named-data/NFD)" |
| 19 | print " install_ndntraffic - install ndn-traffic-generator (named-data/ndn-traffic-generator)" |
Eric Newberry | 86b00b9 | 2015-06-07 15:23:51 -0700 | [diff] [blame] | 20 | print " install_ndntools - install ndn-tools (named-data/ndn-tools)" |
Eric Newberry | fe0d014 | 2017-11-29 13:22:48 -0700 | [diff] [blame^] | 21 | print " install_repong - install repo-ng (named-data/repo-ng)" |
Yanbiao Li | a8a7d27 | 2015-07-20 17:28:45 -0700 | [diff] [blame] | 22 | print " install_infoedit - install infoedit" |
Eric Newberry | fe0d014 | 2017-11-29 13:22:48 -0700 | [diff] [blame^] | 23 | print " install_tools - install test tools" |
jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 24 | print " install_all - do all of the above" |
| 25 | print " help - print this message and exit\n" |
| 26 | |
| 27 | |
| 28 | def main(): |
| 29 | cmd_subfolder = os.path.realpath( |
| 30 | os.path.abspath(os.path.join(os.path.split( |
| 31 | inspect.getfile(inspect.currentframe()))[0], "install_helpers"))) |
| 32 | if cmd_subfolder not in sys.path: |
| 33 | sys.path.insert(0, cmd_subfolder) |
jeraldabraham | 5fdeecd | 2014-04-25 15:56:03 -0700 | [diff] [blame] | 34 | validOptions = [ "install_ndncxx", |
jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 35 | "setup_security", |
| 36 | "install_NFD", |
| 37 | "install_ndntraffic", |
Eric Newberry | 86b00b9 | 2015-06-07 15:23:51 -0700 | [diff] [blame] | 38 | "install_ndntools", |
Eric Newberry | fe0d014 | 2017-11-29 13:22:48 -0700 | [diff] [blame^] | 39 | "install_repong", |
Yanbiao Li | a8a7d27 | 2015-07-20 17:28:45 -0700 | [diff] [blame] | 40 | "install_infoedit", |
Hila Ben Abraham | e8c22e9 | 2016-10-20 14:30:32 -0500 | [diff] [blame] | 41 | "install_tools", |
jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 42 | "install_all", |
| 43 | "help" ] |
| 44 | |
| 45 | if len(sys.argv) > 1: |
| 46 | actionList = Set(sys.argv[1:]) |
| 47 | optionsStatus = 0 |
| 48 | for option in actionList: |
| 49 | if option not in validOptions: |
| 50 | print "Invalid option provided - " + option |
| 51 | optionsStatus = -1 |
| 52 | break |
| 53 | if optionsStatus == 0 and "help" not in actionList: |
| 54 | if "install_all" in actionList: |
jeraldabraham | 5fdeecd | 2014-04-25 15:56:03 -0700 | [diff] [blame] | 55 | actionList.add("install_ndncxx") |
jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 56 | actionList.add("setup_security") |
| 57 | actionList.add("install_NFD") |
| 58 | actionList.add("install_ndntraffic") |
Eric Newberry | 86b00b9 | 2015-06-07 15:23:51 -0700 | [diff] [blame] | 59 | actionList.add("install_ndntools") |
Eric Newberry | fe0d014 | 2017-11-29 13:22:48 -0700 | [diff] [blame^] | 60 | actionList.add("install_repong") |
Yanbiao Li | a8a7d27 | 2015-07-20 17:28:45 -0700 | [diff] [blame] | 61 | actionList.add("install_infoedit") |
Hila Ben Abraham | e8c22e9 | 2016-10-20 14:30:32 -0500 | [diff] [blame] | 62 | actionList.add("install_tools") |
Eric Newberry | fe0d014 | 2017-11-29 13:22:48 -0700 | [diff] [blame^] | 63 | os.system("./install_helpers/setup_preparation_folder.sh") |
| 64 | os.system("./install_helpers/install_dependencies.sh") |
jeraldabraham | 5fdeecd | 2014-04-25 15:56:03 -0700 | [diff] [blame] | 65 | if "install_ndncxx" in actionList: |
Eric Newberry | fe0d014 | 2017-11-29 13:22:48 -0700 | [diff] [blame^] | 66 | os.system("./install_helpers/install_ndncxx.sh") |
jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 67 | if "setup_security" in actionList: |
Eric Newberry | fe0d014 | 2017-11-29 13:22:48 -0700 | [diff] [blame^] | 68 | os.system("./install_helpers/setup_security.sh") |
jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 69 | if "install_NFD" in actionList: |
Eric Newberry | fe0d014 | 2017-11-29 13:22:48 -0700 | [diff] [blame^] | 70 | os.system("./install_helpers/install_NFD.sh") |
jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 71 | if "install_ndntraffic" in actionList: |
Eric Newberry | fe0d014 | 2017-11-29 13:22:48 -0700 | [diff] [blame^] | 72 | os.system("./install_helpers/install_ndntraffic.sh") |
Eric Newberry | 86b00b9 | 2015-06-07 15:23:51 -0700 | [diff] [blame] | 73 | if "install_ndntools" in actionList: |
Eric Newberry | fe0d014 | 2017-11-29 13:22:48 -0700 | [diff] [blame^] | 74 | os.system("./install_helpers/install_ndntools.sh") |
| 75 | if "install_repong" in actionList: |
| 76 | os.system("./install_helpers/install_repong.sh") |
Yanbiao Li | a8a7d27 | 2015-07-20 17:28:45 -0700 | [diff] [blame] | 77 | if "install_infoedit" in actionList: |
Eric Newberry | fe0d014 | 2017-11-29 13:22:48 -0700 | [diff] [blame^] | 78 | os.system("./install_helpers/install_infoedit.sh") |
Hila Ben Abraham | e8c22e9 | 2016-10-20 14:30:32 -0500 | [diff] [blame] | 79 | if "install_tools" in actionList: |
| 80 | module = __import__("install_tools") |
| 81 | module.run() |
jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 82 | print "" |
| 83 | else: |
| 84 | usage() |
| 85 | else: |
| 86 | usage() |
| 87 | |
| 88 | |
| 89 | if __name__ == "__main__": |
| 90 | main() |