Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions modules/backups.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ def run_restore_backup(args):
return run_as_root(["bash", restore_script_path] + args)

def restore_backup(self, args):
if len(args) == 0 or len(args) > 2:
color_print("{red}Bad args. Usage:{endc} restore_backup <filename> [-y]")
if len(args) == 0 or len(args) > 3:
color_print("{red}Bad args. Usage:{endc} restore_backup <filename> [-y] [--skip-create-backup]")
return
if '-y' not in args:
res = input(
Expand All @@ -67,11 +67,14 @@ def restore_backup(self, args):
return
else:
args.pop(args.index('-y'))
print('Before proceeding, mtc will create a backup of current configuration.')
try:
self.create_backup([])
except:
color_print("{red}Could not create backup{endc}")
if '--skip-create-backup' in args:
args.pop(args.index('--skip-create-backup'))
else:
print('Before proceeding, mtc will create a backup of current configuration.')
try:
self.create_backup([])
except:
color_print("{red}Could not create backup{endc}")

ip = str(ip2int(get_own_ip()))
command_args = ["-m", self.ton.local.buffer.my_work_dir, "-n", args[0], "-i", ip]
Expand Down