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

Function install_setup

Scripts/Developer Base/Mobile Developer Setup.py:624–663  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

622 try:
623 with os.fdopen(fd, "wb") as f:
624 f.write(data)
625 f.flush()
626 os.fsync(f.fileno())
627 temp.replace(target)
628 mode = item.get("mode")
629 if isinstance(mode, int):
630 os.chmod(target, mode)
631 finally:
632 temp.unlink(missing_ok=True)
633 SUMMARY.success(f"Restored {target}")
634
635 reload_termux_settings()
636
637def choose_backup_interactive() -> Optional[Path]:
638 backups = list_backups()
639 if not backups:
640 print(c(f"No backups found in {BACKUPS_DIR}", C.WARN))
641 return None
642 if NON_INTERACTIVE:
643 return backups[0]
644
645 print(c("\nAvailable backups:", C.INFO))
646 for idx, backup in enumerate(backups, 1):
647 print(f" {idx}) {backup.name}")
648 while True:
649 answer = input(c("Pick a backup number (0 to cancel): ", C.INFO)).strip()
650 if answer == "0":
651 return None
652 if answer.isdigit() and 1 <= int(answer) <= len(backups):
653 return backups[int(answer) - 1]
654 print(c("Invalid choice.", C.WARN))
655
656
657# -----------------------------------------------------------------------------
658# Termux package management
659# -----------------------------------------------------------------------------
660
661
662def dpkg_installed(package: str) -> bool:
663 if not shutil.which("dpkg-query"):
664 return False
665 result = run_cmd(
666 ["dpkg-query", "-W", "-f=${Status}", package],

Callers 1

menuFunction · 0.70

Calls 15

printFunction · 0.85
is_termuxFunction · 0.70
cFunction · 0.70
ensure_dirsFunction · 0.70
headerFunction · 0.70
make_backupFunction · 0.70
load_stateFunction · 0.70
save_stateFunction · 0.70
write_tools_filesFunction · 0.70
pkg_update_upgradeFunction · 0.70
pkg_installFunction · 0.70
npm_installFunction · 0.70

Tested by

no test coverage detected