1414 run_as_root ,
1515 color_print ,
1616 ip2int ,
17- Dict
17+ Dict , int2ip
1818)
1919from mytoninstaller .utils import StartValidator , StartMytoncore , start_service , stop_service , get_ed25519_pubkey
2020from mytoninstaller .config import SetConfig , GetConfig , get_own_ip , backup_config
@@ -201,6 +201,8 @@ def FirstMytoncoreSettings(local):
201201#end define
202202
203203def EnableValidatorConsole (local ):
204+ if local .buffer .only_mtc :
205+ return
204206 local .add_log ("start EnableValidatorConsole function" , "debug" )
205207
206208 # Create variables
@@ -920,12 +922,25 @@ def EnableMode(local):
920922 subprocess .run (args )
921923
922924
925+ def set_external_ip (local , ip ):
926+ mconfig_path = local .buffer .mconfig_path
927+
928+ mconfig = GetConfig (path = mconfig_path )
929+
930+ mconfig .liteClient .liteServer .ip = ip
931+ mconfig .validatorConsole .addr = f'{ ip } :{ mconfig .validatorConsole .addr .split (":" )[1 ]} '
932+
933+ # write mconfig
934+ local .add_log ("write mconfig" , "debug" )
935+ SetConfig (path = mconfig_path , data = mconfig )
936+
937+
923938def ConfigureFromBackup (local ):
939+ if not local .buffer .backup :
940+ return
924941 from mytoncore import MyTonCore
925942 from mypylib .mypylib import MyPyClass # todo move to file header
926943 from modules .backups import BackupModule
927- if not local .buffer .backup :
928- return
929944 mconfig_path = local .buffer .mconfig_path
930945 mconfig_dir = get_dir_from_path (mconfig_path )
931946 local .add_log ("start ConfigureFromBackup function" , "info" )
@@ -935,3 +950,17 @@ def ConfigureFromBackup(local):
935950 ton .local .buffer .my_work_dir = mconfig_dir
936951 module = BackupModule (ton , local )
937952 module .restore_backup ([backup_file , '-y' ])
953+
954+ if local .buffer .only_mtc :
955+ local .add_log ("Installing only mtc" , "info" )
956+ vconfig_path = local .buffer .vconfig_path
957+ vconfig = GetConfig (path = vconfig_path )
958+ try :
959+ node_ip = int2ip (vconfig ['addrs' ][0 ]['ip' ])
960+ except :
961+ local .add_log ("Can't get ip from validator" , "error" )
962+ return
963+ user = local .buffer .user
964+ args = ["chown" , '-R' , user + ':' + user , local .buffer .keys_dir ]
965+ subprocess .run (args )
966+ set_external_ip (local , node_ip )
0 commit comments