while True: stepContinue =input("make sure you will uninstall the redis. Entner (y/n) to continue: ") if stepContinue == 'y': break elif stepContinue == 'n': warn("the uninstall has been stoped") exit(0) #return 0:normal 1:error installMode =input("default install mode or customize install mode? Enter (d/c) to continue: ") global INSTALL_VERSION_PORT if installMode == 'c': INSTALL_VERSION_PORT['VERSION_NUM'] =input("please enter the version number(format like X.X.X):") INSTALL_VERSION_PORT['PORT_NUM'] =input("please enter the port :") notice("the log file will write under /home .\nyou must give current user write permission:\n") CMD_CHMOD_HOMEDIR_W ="sudo chmod o+w /home" process =subprocess.Popen(CMD_CHMOD_HOMEDIR_W, shell=True, universal_newlines=True, stdout=subprocess.PIPE) process.wait() #pre-process paths global PROCESSED_PATHS PROCESSED_PATHS = preProcessPaths() logtoFile('install redis %s \n' % time.strftime(' at %c'),MODE_WRITE) if environmentCheck(): #install notice("the install script is running. please wait several minutes") install() notice("the install script has run. Everything has log at path: %s" % PRE_PROCESSING_PATHS['LOGFILE_PATH'])
elif stepContinue == 'n': warn("the uninstall has been stoped") exit(0) #return 0:normal 1:error global INSTALL_VERSION_PORT while True: #do .. while installMode =input("default install mode or customize install mode when installed redis? Enter (d/c) to continue: ") if installMode == 'c': INSTALL_VERSION_PORT['VERSION_NUM'] =input("please enter the version number(format like X.X.X):") INSTALL_VERSION_PORT['PORT_NUM'] =input("please enter the port :") break elif installMode == 'd': break #pre-process paths global PROCESSED_PATHS PROCESSED_PATHS = preProcessPaths() logtoFile('redis has been uninstalled %s \n' % time.strftime(' at %c'),MODE_WRITE) if environmentCheck(): notice("the uninstall script is running. please wait several minutes") uninstall() notice("the uninstall script has run. Everything has log at path: %s" % PRE_PROCESSING_PATHS['LOGFILE_PATH']) else: warn("the environment has some problem. the uninstall script can not run.")