blob: 523a1a74dfb25c4a6f8d0d2bdf1de3f5e74a508b [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 " Latest source codes will be downloaded from their GitHub"
print " named-data repositories (https://github.com/named-data)"
print "\nOPTIONS:"
print " install_ndncxx - install ndn-cxx (named-data/ndn-cxx)"
print " setup_security - create an identity using ndnsec (/tmp/nfd_integration)"
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_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_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")
module = __import__("setup_preparation_folder")
module.run()
module = __import__("install_dependencies")
module.run()
if "install_ndncxx" in actionList:
module = __import__("install_ndncxx")
module.run()
if "setup_security" in actionList:
module = __import__("setup_security")
module.run()
if "install_NFD" in actionList:
module = __import__("install_NFD")
module.run()
if "install_ndntraffic" in actionList:
module = __import__("install_ndntraffic")
module.run()
if "install_ndntools" in actionList:
module = __import__("install_ndntools")
module.run()
print ""
else:
usage()
else:
usage()
if __name__ == "__main__":
main()