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

Function install_custom_package

Scripts/Developer Base/Mobile Desktop.py:1189–1219  ·  view source on GitHub ↗

Install an arbitrary package name inside a distro (best-effort). Returns tracking id or None.

(cfg: Dict, distro: str, pkg: str)

Source from the content-addressed store, hash-verified

1187 return pkg
1188
1189def install_custom_package(cfg: Dict, distro: str, pkg: str) -> Optional[str]:
1190 """Install an arbitrary package name inside a distro (best-effort). Returns tracking id or None."""
1191 pkg = _validate_pkg_name(pkg)
1192 if not pkg:
1193 print(tr(cfg, "invalid"))
1194 return None
1195
1196 family = detect_family(distro)
1197 if family == "debian":
1198 cmd = f"apt-get update -y && apt-get install -y {pkg}"
1199 elif family == "arch":
1200 cmd = f"pacman -Syu --noconfirm || true; pacman -S --noconfirm {pkg}"
1201 elif family == "alpine":
1202 cmd = f"apk update && apk add {pkg}"
1203 elif family == "fedora":
1204 cmd = f"dnf -y upgrade || true; dnf -y install {pkg}"
1205 elif family == "suse":
1206 cmd = f"zypper --non-interactive refresh || true; zypper --non-interactive install {pkg}"
1207 elif family == "void":
1208 cmd = f"xbps-install -Suy || true; xbps-install -y {pkg}"
1209 else:
1210 print(tr(cfg, "programs_not_supported"))
1211 return None
1212
1213 print(f"{tr(cfg,'programs_installing')} {pkg}")
1214 run(proot_login_cmd(distro, cmd), check=False)
1215
1216 pid = f"pkg:{pkg}"
1217 mark_program_installed(cfg, distro, pid, True)
1218 print(tr(cfg, "programs_done"))
1219 return pid
1220
1221def remove_custom_package(cfg: Dict, distro: str, pkg: str) -> None:
1222 pkg = _validate_pkg_name(pkg)

Callers 1

action_programs_installFunction · 0.70

Calls 7

printFunction · 0.85
_validate_pkg_nameFunction · 0.70
trFunction · 0.70
detect_familyFunction · 0.70
runFunction · 0.70
proot_login_cmdFunction · 0.70
mark_program_installedFunction · 0.70

Tested by

no test coverage detected