|
45 | 45 | from mytonctrl.console_cmd import add_command, check_usage_one_arg, check_usage_args_min_max_len |
46 | 46 | from mytonctrl.migrate import run_migrations |
47 | 47 | from mytonctrl.utils import GetItemFromList, timestamp2utcdatetime, fix_git_config, is_hex, GetColorInt, \ |
48 | | - pop_user_from_args, pop_arg_from_args |
| 48 | + pop_user_from_args, pop_arg_from_args, get_clang_major_version, get_os_version |
49 | 49 | from mytoninstaller.archive_blocks import download_blocks |
50 | 50 | from mytoninstaller.utils import get_ton_storage_port |
51 | 51 |
|
@@ -403,37 +403,6 @@ def upgrade_btc_teleport(local, ton, reinstall=False, branch: str = 'master', us |
403 | 403 | local.try_function(module.init, args=[reinstall, branch, user]) |
404 | 404 |
|
405 | 405 |
|
406 | | -def get_clang_major_version(): |
407 | | - try: |
408 | | - process = subprocess.run(["clang", "--version"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, |
409 | | - text=True, timeout=3) |
410 | | - if process.returncode != 0: |
411 | | - return None |
412 | | - |
413 | | - output = process.stdout |
414 | | - |
415 | | - lines = output.strip().split('\n') |
416 | | - if not lines: |
417 | | - return None |
418 | | - |
419 | | - first_line = lines[0] |
420 | | - if "clang version" not in first_line: |
421 | | - return None |
422 | | - |
423 | | - version_part = first_line.split("clang version")[1].strip() |
424 | | - major_version = version_part.split('.')[0] |
425 | | - |
426 | | - major_version = ''.join(c for c in major_version if c.isdigit()) |
427 | | - |
428 | | - if not major_version: |
429 | | - return None |
430 | | - |
431 | | - return int(major_version) |
432 | | - except Exception as e: |
433 | | - print(f"Error checking clang version: {type(e)}: {e}") |
434 | | - return None |
435 | | - |
436 | | - |
437 | 406 | def rollback_to_mtc1(local, ton, args): |
438 | 407 | color_print("{red}Warning: this is dangerous, please make sure you've backed up mytoncore's db.{endc}") |
439 | 408 | a = input("Do you want to continue? [Y/n]\n") |
@@ -558,16 +527,22 @@ def check_adnl(local, ton): |
558 | 527 | print_warning(local, error) |
559 | 528 | #end define |
560 | 529 |
|
561 | | -def warnings(local, ton): |
| 530 | +def check_ubuntu_version(local: MyPyClass): |
| 531 | + distro, ver = get_os_version() |
| 532 | + if distro == 'ubuntu': |
| 533 | + if ver not in ['22.04', '24.04']: |
| 534 | + warning = local.translate("ubuntu_version_warning").format(ver) |
| 535 | + print_warning(local, warning) |
| 536 | + |
| 537 | +def warnings(local: MyPyClass, ton: MyTonCore): |
562 | 538 | local.try_function(check_disk_usage, args=[local, ton]) |
563 | 539 | local.try_function(check_sync, args=[local, ton]) |
564 | 540 | local.try_function(check_adnl, args=[local, ton]) |
565 | 541 | local.try_function(check_validator_balance, args=[local, ton]) |
566 | 542 | local.try_function(check_vps, args=[local, ton]) |
567 | 543 | local.try_function(check_tg_channel, args=[local, ton]) |
568 | 544 | local.try_function(check_slashed, args=[local, ton]) |
569 | | -#end define |
570 | | - |
| 545 | + local.try_function(check_ubuntu_version, args=[local]) |
571 | 546 |
|
572 | 547 | def CheckTonUpdate(local): |
573 | 548 | git_path = "/usr/src/ton" |
|
0 commit comments