MCPcopy Create free account
hub / github.com/dedsec1121fk/DedSec / make_backup

Function make_backup

Scripts/Developer Base/Mobile Developer Setup.py:386–420  ·  view source on GitHub ↗

Backup Termux settings (NOT packages). Produces a tar.gz containing known config files that this tool may change.

()

Source from the content-addressed store, hash-verified

384) -> subprocess.CompletedProcess:
385 command_text = quote_cmd(args)
386 log_line(f"$ {command_text}")
387 kwargs = {
388 "cwd": str(cwd) if cwd else None,
389 "env": env,
390 "text": True,
391 }
392 if capture:
393 kwargs.update({"stdout": subprocess.PIPE, "stderr": subprocess.PIPE})
394 result = subprocess.run(args, **kwargs)
395 if capture:
396 if result.stdout:
397 log_line(result.stdout)
398 if result.stderr:
399 log_line(result.stderr)
400 if check and result.returncode != 0:
401 raise RuntimeError(f"Command failed ({result.returncode}): {command_text}")
402 return result
403
404
405def run_shell(command: str, *, check: bool = False, capture: bool = False) -> subprocess.CompletedProcess:
406 return run_cmd(["bash", "-lc", command], check=check, capture=capture)
407
408
409def ask_yes_no(prompt: str, default: bool = True) -> bool:
410 if ASSUME_YES:
411 return True
412 if NON_INTERACTIVE:
413 return default
414 suffix = " [Y/n] " if default else " [y/N] "
415 while True:
416 answer = input(c(prompt + suffix, C.INFO)).strip().lower()
417 if not answer:
418 return default
419 if answer in {"y", "yes"}:
420 return True
421 if answer in {"n", "no"}:
422 return False
423 print(c("Please answer y or n.", C.WARN))

Callers 2

install_setupFunction · 0.70
backup_onlyFunction · 0.70

Calls 9

printFunction · 0.85
ensure_dirsFunction · 0.70
now_stampFunction · 0.70
sha256_fileFunction · 0.70
io_bytesFunction · 0.70
load_stateFunction · 0.70
save_stateFunction · 0.70
cFunction · 0.70
addMethod · 0.45

Tested by

no test coverage detected