blob: 51abd9e0d1639dbefc3db5015d62180efef4e63a [file] [log] [blame]
#!/usr/bin/python2
import os
import sys
import inspect
from sets import Set
def usage():
print "\nUSAGE:"
print " ./install_apps.py [OPTIONS]\n"
print " Install NDN applications"
print " By default, the latest version of each package will be downloaded from the NDN GitHub"
print " repositories (https://github.com/named-data). To obtain the packages locally or from"
print " a specific branch or Gerrit change, use the repos.conf file (see repos.conf.sample for"
print " more information)."
print "\nOPTIONS:"
print " install_ndncxx - install ndn-cxx (named-data/ndn-cxx)"
print " setup_security - create an identity using ndnsec (/tmp/nfd_integration_tests)"
print " install_NFD - install NFD (named-data/NFD)"
print " install_ndntraffic - install ndn-traffic-generator (named-data/ndn-traffic-generator)"
print " install_ndntools - install ndn-tools (named-data/ndn-tools)"
print " install_repong - install repo-ng (named-data/repo-ng)"
print " install_infoedit - install infoedit"
print " install_tools - install test tools"
print " install_all - do all of the above"
print " help - print this message and exit\n"
def main():
cmd_subfolder = os.path.realpath(
os.path.abspath(os.path.join(os.path.split(
inspect.getfile(inspect.currentframe()))[0], "install_helpers")))
if cmd_subfolder not in sys.path:
sys.path.insert(0, cmd_subfolder)
validOptions = [ "install_ndncxx",
"setup_security",
"install_NFD",
"install_ndntraffic",
"install_ndntools",
"install_repong",
"install_infoedit",
"install_tools",
"install_all",
"help" ]
if len(sys.argv) > 1:
actionList = Set(sys.argv[1:])
optionsStatus = 0
for option in actionList:
if option not in validOptions:
print "Invalid option provided - " + option
optionsStatus = -1
break
if optionsStatus == 0 and "help" not in actionList:
if "install_all" in actionList:
actionList.add("install_ndncxx")
actionList.add("setup_security")
actionList.add("install_NFD")
actionList.add("install_ndntraffic")
actionList.add("install_ndntools")
actionList.add("install_repong")
actionList.add("install_infoedit")
actionList.add("install_tools")
os.system("./install_helpers/setup_preparation_folder.sh")
os.system("./install_helpers/install_dependencies.sh")
if "install_ndncxx" in actionList:
os.system("./install_helpers/install_ndncxx.sh")
if "setup_security" in actionList:
os.system("./install_helpers/setup_security.sh")
if "install_NFD" in actionList:
os.system("./install_helpers/install_NFD.sh")
if "install_ndntraffic" in actionList:
os.system("./install_helpers/install_ndntraffic.sh")
if "install_ndntools" in actionList:
os.system("./install_helpers/install_ndntools.sh")
if "install_repong" in actionList:
os.system("./install_helpers/install_repong.sh")
if "install_infoedit" in actionList:
os.system("./install_helpers/install_infoedit.sh")
if "install_tools" in actionList:
module = __import__("install_tools")
module.run()
print ""
else:
usage()
else:
usage()
if __name__ == "__main__":
main()