diff --git a/mytonctrl.py b/mytonctrl.py index 4bf1dde1..257a29cc 100755 --- a/mytonctrl.py +++ b/mytonctrl.py @@ -202,10 +202,29 @@ def Update(args): def Upgrade(args): repo = "ton" author, repo, branch = check_git(args, repo, "upgrade") - + + # bugfix if the files are in the wrong place + liteClient = ton.GetSettings("liteClient") + configPath = liteClient.get("configPath") + pubkeyPath = liteClient.get("liteServer").get("pubkeyPath") + if "ton-lite-client-test1" in configPath: + liteClient["configPath"] = configPath.replace("lite-client/ton-lite-client-test1.config.json", "global.config.json") + if "/usr/bin/ton" in pubkeyPath: + liteClient["liteServer"]["pubkeyPath"] = "/var/ton-work/keys/liteserver.pub" + ton.SetSettings("liteClient", liteClient) + validatorConsole = ton.GetSettings("validatorConsole") + privKeyPath = validatorConsole.get("privKeyPath") + pubKeyPath = validatorConsole.get("pubKeyPath") + if "/usr/bin/ton" in privKeyPath: + validatorConsole["privKeyPath"] = "/var/ton-work/keys/client" + if "/usr/bin/ton" in pubKeyPath: + validatorConsole["pubKeyPath"] = "/var/ton-work/keys/server.pub" + ton.SetSettings("validatorConsole", validatorConsole) + # Run script runArgs = ["bash", "/usr/src/mytonctrl/scripts/upgrade.sh", "-a", author, "-r", repo, "-b", branch] exitCode = run_as_root(runArgs) + exitCode += run_as_root(["python3", "/usr/src/mytonctrl/scripts/upgrade.py"]) if exitCode == 0: text = "Upgrade - {green}OK{endc}" else: diff --git a/mytoninstaller.py b/mytoninstaller.py index 93d05e3a..b47bfc85 100644 --- a/mytoninstaller.py +++ b/mytoninstaller.py @@ -1049,5 +1049,5 @@ def b642dict(b64): General() else: console.Run() - local.Exit() + local.exit() #end if diff --git a/scripts/upgrade.py b/scripts/upgrade.py index 758151fb..9971694a 100644 --- a/scripts/upgrade.py +++ b/scripts/upgrade.py @@ -8,6 +8,7 @@ from mypylib.mypylib import * +# validator.service file = open("/etc/systemd/system/validator.service", 'rt') text = file.read() file.close() @@ -17,10 +18,8 @@ line = lines[i] if "ExecStart" not in line: continue - if " --threads " in line or " -t " in line: - continue - cpus = psutil.cpu_count() - 1 - lines[i] += " --threads {cpus}".format(cpus=cpus) + if "ton-global.config.json" in line: + lines[i] += line.replace("validator-engine/ton-global.config.json", "global.config.json") #end for text = "\n".join(lines) diff --git a/scripts/upgrade.sh b/scripts/upgrade.sh index 670f8707..03ac0b44 100644 --- a/scripts/upgrade.sh +++ b/scripts/upgrade.sh @@ -31,6 +31,19 @@ ENDC='\033[0m' # Установить дополнительные зависимости apt-get install -y libsecp256k1-dev libsodium-dev ninja-build +# bugfix if the files are in the wrong place +wget "https://ton-blockchain.github.io/global.config.json" -O global.config.json +if [ -f "/var/ton-work/keys/liteserver.pub" ]; then + echo "Ok" +else + echo "bugfix" + mkdir /var/ton-work/keys + cp /usr/bin/ton/validator-engine-console/client /var/ton-work/keys/client + cp /usr/bin/ton/validator-engine-console/client.pub /var/ton-work/keys/client.pub + cp /usr/bin/ton/validator-engine-console/server.pub /var/ton-work/keys/server.pub + cp /usr/bin/ton/validator-engine-console/liteserver.pub /var/ton-work/keys/liteserver.pub +fi + # Go to work dir cd ${srcdir} rm -rf ${srcdir}/${repo}