This commit is contained in:
Nick Winter 2014-01-03 13:49:42 -08:00
commit 180d825c5d
2 changed files with 8 additions and 2 deletions

View file

@ -68,14 +68,20 @@ def which(cmd, mode=os.F_OK | os.X_OK, path=None):
#TODO: Upgrade this so it works on windows
#These scripts will be placed in coco/bin
current_directory = os.path.dirname(os.path.realpath(sys.argv[0]))
if which("mongod") and "v2.5.4" in subprocess.check_output("mongod --version",shell=True):
mongo_executable = "mongod"
else:
mongo_executable = None
print("Mongod 2.5.4 wasn't found. Searching in bin directory...")
mongo_directory = current_directory + os.sep + u"mongo"
mongo_executable = os.environ.get("COCO_MONGOD_PATH",mongo_directory + os.sep + u"mongod")
if not mongo_executable:
mongo_executable = os.environ.get("COCO_MONGOD_PATH",mongo_directory + os.sep + u"mongod")
if not os.path.exists(mongo_executable):
raise FileNotFoundError("Mongo executable not found.")
print("Using mongo executable: " + str(mongo_executable))
mongo_db_path = os.path.abspath(os.path.join(current_directory,os.pardir)) + os.sep + u"mongo"
if not os.path.exists(mongo_db_path):
os.mkdir(mongo_db_path)

View file

@ -60,7 +60,7 @@ class SetupFactory(object):
self.config.directory.remove_directories()
print("Changing permissions of files...")
#TODO: Make this more robust and portable(doesn't pose security risk though)
subprocess.call("chmod -R 0777 " + self.config.directory.root_dir + os.sep + "coco" + os.sep + "bin",shell=True)
subprocess.call("chmod -R 755 " + self.config.directory.root_dir + os.sep + "coco" + os.sep + "bin",shell=True)
print("Done! If you want to start the server, head into /coco/bin and run ")
print("1. sudo python startDatabase.py")