error codes

This commit is contained in:
shim_
2018-11-03 15:12:53 +01:00
parent 1b919a5c10
commit 56dfa71a62
2 changed files with 28 additions and 8 deletions

View File

@@ -57,11 +57,11 @@ def perform_upgrade_command(version,mysql=False,yes=True):
target = map(lambda x: int(x), version.split("."))
print len(current) == 1 and current[0] == 0
if len(current) == 1 and current[0] == 0: #Not installed
print("Running installer, please don't change any default values regarding ports.")
print("Running installer.")
installer = os.path.join(seaf_home,"seafile-server-%s" % version,"setup-seafile%s.sh" % ("-mysql" if mysql else ""))
while not call(["sh","-c",installer],stdout=sys.stdout, stdin=sys.stdin):
pass
return 0
if not call(["seafile-server","setup"],stdout=sys.stdout, stdin=sys.stdin):
sys.exit(1)
sys.exit(126)
script_re = "^upgrade_(\d+).(\d+)_(\d+).(\d+)\.sh$"
run = []
last = None
@@ -114,15 +114,15 @@ def main_command(version="latest",page="https://www.seafile.com/en/download/"):
install = dict(avail.items())[version]
if version_int(current_version()) == version_int(version):
print("%s(%s) is already installed" % (version,version_int(version)))
return 1
sys.exit(126)
if version in installed_versions():
return perform_upgrade_command(version)
if install:
print("Installing: %s" % version)
return install_command(install)
sys.exit(install_command(install))
else:
print("Couldn't determine download for %s" % version)
return 1
sys.exit(1)
if __name__ == '__main__':
import scriptine