# Step 3: Install files install_files(source_dir)
log_system_info()
def install_files(source_dir): """Copy tool files to installation directory.""" install_path = DEFAULT_INSTALL_PATH install_path.mkdir(parents=True, exist_ok=True) for item in source_dir.iterdir(): dest = install_path / item.name if item.is_file(): shutil.copy2(item, dest) elif item.is_dir(): shutil.copytree(item, dest, dirs_exist_ok=True) log.info(f"Files installed to {install_path}") umtv2-umtpro-ultimateunisoc-v0.1-installer
# Elevate privileges if not admin if not is_admin(): log.warning("Installer requires admin privileges.") run_as_admin() dest) elif item.is_dir(): shutil.copytree(item
# Step 6: Add to PATH if not args.no_path: add_to_path(DEFAULT_INSTALL_PATH) b""): sha256.update(chunk) return sha256.hexdigest()
def install_drivers(): """Launch Unisoc driver installer if available.""" driver_installer = DEFAULT_INSTALL_PATH / "drivers" / "unisoc_driver.exe" if driver_installer.exists(): log.info("Installing Unisoc drivers...") subprocess.run([str(driver_installer), "/silent"], check=False) else: log.warning(f"Driver installer not found. Download from {DRIVER_URL}")
def compute_sha256(file_path): """Compute SHA256 hash of a file.""" sha256 = hashlib.sha256() with open(file_path, "rb") as f: for chunk in iter(lambda: f.read(4096), b""): sha256.update(chunk) return sha256.hexdigest()