Skip to content

Latest commit

 

History

History
410 lines (329 loc) · 16.9 KB

File metadata and controls

410 lines (329 loc) · 16.9 KB

UniGetUI Integration for ReWin

See also: MENU_GUIDE.md for all ReWin menu options (1–8).

Overview

ReWin provides THREE installation methods after system migration:

Method 1: Automated Installation ⭐ (PRIMARY - RECOMMENDED)

  • Menu: Option 5 - Install All Software - Automated
  • Files: migration_bundle.ubundle (primary), PowerShell scripts (fallback)
  • Usage: Fully automated - tries UniGetUI CLI automation, falls back to direct package manager calls
  • Best for: Maximum automation with comprehensive package source support
  • User interaction: Zero - installs everything automatically

Method 2: Interactive UniGetUI (ALTERNATIVE)

  • Menu: Option 6 - Install Software - Manual Selection
  • File: migration_bundle.ubundle
  • Usage: Opens UniGetUI GUI for manual package review and selection
  • Best for: When you want to review/select specific packages before installing
  • User interaction: Manual selection and confirmation in GUI

Method 3: Fallback PowerShell Scripts (FALLBACK)

  • Menu: Option 7 - Install Software - Fallback Scripts
  • Files: install_winget.ps1, install_chocolatey.ps1
  • Usage: Direct Winget/Chocolatey PowerShell execution
  • Best for: When UniGetUI has issues or unavailable
  • User interaction: Zero - runs scripts directly

Why Automated Installation (Option 5) Is Primary

Maximum Automation + Maximum Coverage:

  • UniGetUI automation: Supports 40+ package sources (Winget, Chocolatey, Store, Scoop, pip, npm, etc.)
  • Built-in fallback: Automatically tries multiple methods if one fails
  • Zero interaction: Fully automated installation flow
  • Comprehensive: Best balance of automation and package source coverage

Installation Flow:

  1. Try UniGetUI CLI automation (--import --install-all --no-gui)
  2. If that fails, read bundle JSON and install via Winget/Chocolatey/Store directly
  3. If that fails, run PowerShell scripts (install_winget.ps1, install_chocolatey.ps1)
  4. Provide installation summary with success/failure counts

Use Cases:

  • Option 5: Full system migration with maximum automation (RECOMMENDED)
  • Option 6: Selective migration when you want to review packages first
  • Option 7: Fallback when UniGetUI unavailable or has issues

UniGetUI Integration Details

ReWin now integrates with UniGetUI (https://github.com/marticliment/UniGetUI), a comprehensive package manager UI that supports multiple package sources:

  • Winget (Windows Package Manager)
  • Chocolatey (Community-based package manager)
  • Microsoft Store (Windows App Store)
  • Scoop, Snap, and other sources

New Files Created

0. src/restore/ensure_winget_ready.ps1

  • Ensures winget is ready on fresh Windows (certificate pinning bypass and source/package agreements)
  • Run automatically before Options 2 (when installing Python), 5, and 6; also dot-sourced by install_with_unigetui.ps1

1. src/backup/generate_unigetui_bundle.ps1

  • PowerShell script that generates a .ubundle file (UniGetUI bundle format)
  • Converts selected software from the scan into a format UniGetUI can load
  • Creates portable migration bundles with all package information

2. src/restore/install_with_unigetui.ps1

  • Helper script to install/launch UniGetUI
  • Runs ensure_winget_ready.ps1 first (winget certificate bypass and agreements) so installs work on fresh Windows
  • Checks if UniGetUI is already installed; installs via Winget (--source winget) if needed
  • When launched from ReWin.bat (Options 5 or 6), uses -NonInteractive to install UniGetUI automatically without prompting
  • Launches UniGetUI with the migration bundle file (or runs automated install / fallback scripts)

How It Works

Scanner Export Process

  1. User runs Scanner GUI (Option 1 in ReWin.bat)
  2. Scans system and selects software to migrate
  3. Clicks "Export Package"
  4. New: A migration_bundle.ubundle file is automatically created alongside the package
  5. The bundle contains all selected software with their Winget/Chocolatey IDs

USB Package Structure

USB_Package_2026-02-14_164200/
├── migration_package.json          (metadata)
├── migration_bundle.ubundle        ✨ NEW - UniGetUI bundle
├── install_winget.ps1              (fallback: manual Winget install)
├── install_chocolatey.ps1          (fallback: manual Chocolatey install)
├── AppConfigs/                     (configuration backups)
├── scan_summary.json
└── ... (other files)

Installation Options

Option 5: Automated Installation ⭐ (PRIMARY - RECOMMENDED)

  • Files: migration_bundle.ubundle (primary), install_winget.ps1 + install_chocolatey.ps1 (fallback)
  • How it works:
    1. User runs Option 5 from ReWin.bat
    2. ReWin runs ensure_winget_ready.ps1 (enables winget certificate bypass and accepts agreements on fresh Windows)
    3. Prompts for migration package folder path
    4. Checks for migration_bundle.ubundle
    5. If UniGetUI is not installed, installs it automatically (no prompt)
    6. First attempt: Runs UniGetUI CLI (--import --install-all --no-gui) using --source winget where possible
    7. Second attempt: Reads bundle JSON, installs via Winget/Chocolatey/Store directly
    8. Third attempt: Runs PowerShell scripts as ultimate fallback
    9. Shows installation summary with success/failure counts
    10. Fully automated - zero interaction

Advantages:

  • ✅ Maximum automation (no user clicks needed)
  • ✅ Comprehensive package sources (40+ via UniGetUI)
  • ✅ Automatic fallback if issues occur
  • ✅ Installs everything from your scan
  • ✅ Fast and reliable
  • ✅ Built-in error handling

When to use:

  • ✅ Full system migration (RECOMMENDED)
  • ✅ You trust all scanned software
  • ✅ You want maximum speed and automation
  • ✅ Fresh Windows installation

Option 6: Interactive UniGetUI (ALTERNATIVE)

  • File: migration_bundle.ubundle
  • How it works:
    1. User runs Option 6 from ReWin.bat
    2. ReWin runs ensure_winget_ready.ps1 (winget certificate bypass) then prompts for migration package folder path
    3. Verifies migration_bundle.ubundle exists
    4. Checks if UniGetUI is installed (auto-installs via Winget if not, no prompt when from menu)
    5. Opens UniGetUI GUI with bundle pre-loaded
    6. User reviews packages in GUI
    7. User selects/deselects specific packages
    8. User manually clicks install button
    9. GUI shows installation progress

Advantages:

  • ✅ Visual review of packages before installing
  • ✅ Selective installation (cherry-pick packages)
  • ✅ See package descriptions and versions
  • ✅ Modern GUI interface with progress tracking
  • ✅ Search and filter packages
  • ✅ Access to 40+ package sources

When to use:

  • ✅ You want to review before installing
  • ✅ You don't want everything reinstalled
  • ✅ You prefer GUI over automation
  • ✅ You're migrating to different setup (not identical)

Option 7: Fallback PowerShell Scripts (FALLBACK)

  • Files: install_winget.ps1, install_chocolatey.ps1
  • How it works:
    1. User runs Option 7 from ReWin.bat
    2. Prompts for migration package folder path
    3. Verifies PowerShell scripts exist
    4. Runs install_winget.ps1 (Winget packages)
    5. Runs install_chocolatey.ps1 (Chocolatey packages)
    6. Direct package manager commands
    7. Fully automated - zero interaction

Advantages:

  • ✅ No UniGetUI dependency
  • ✅ Direct Winget/Choco commands
  • ✅ Reviewable/editable PowerShell scripts
  • ✅ Works in restricted environments
  • ✅ Maximum control over installation

Limitations:

  • ⚠️ Only Winget and Chocolatey (no other sources)
  • ⚠️ No GUI progress tracking
  • ⚠️ Manual script editing for changes

When to use:

  • ✅ UniGetUI won't install or has issues
  • ✅ Corporate environment blocks UniGetUI
  • ✅ You prefer direct PowerShell approach
  • ✅ You want to review/edit install scripts

Benefits of Three-Method Approach

Automated Installation (Option 5) ⭐

Maximum Automation: Zero user interaction required
Best Coverage: UniGetUI supports 40+ package sources
Built-in Fallback: Automatically tries multiple methods
Comprehensive: Installs everything from your scan
Speed: Fastest method - full automation
Reliability: Error handling with fallback paths

Interactive UniGetUI (Option 6)

Visual Review: See what you're installing before proceeding
Selective Installation: Cherry-pick specific packages
Package Discovery: Find alternatives across multiple sources
Modern UI: Professional interface with progress tracking
Multi-Source: Access 40+ package repositories
Description & Versioning: See package details before installing

Fallback Scripts (Option 7)

No Dependencies: Works without UniGetUI
Direct Commands: Pure Winget/Chocolatey execution
Reviewable: PowerShell scripts can be edited
Restricted Environments: Works where UniGetUI blocked
Maximum Control: Full visibility into installation process

All Three Methods Together

Flexibility: Choose automation level per situation
Redundancy: If one method fails, try another
Coverage: Comprehensive package support
User Choice: Automation vs. control trade-off

Understanding the Installation Methods

What We Actually Generate

During the scan/export phase, ReWin creates:

  1. migration_bundle.ubundle - JSON bundle in UniGetUI-native format (export_version, packages, Name, Version, Source, ManagerName). Opens correctly in UniGetUI GUI and CLI.
  2. install_winget.ps1 - PowerShell script (UniGetUI-style: cmd.exe /C winget.exe install ... --exact --silent --force) with success/failure counts and exit $failure_count.
  3. install_chocolatey.ps1 - PowerShell script with all Chocolatey packages.

All three files represent the same scanned software, just in different formats.

The New Approach

Option 5 provides the best of both worlds:

  • Tries UniGetUI automation first (40+ package sources)
  • Falls back to direct package manager calls (if UniGetUI CLI fails)
  • Ultimate fallback to PowerShell scripts (if bundle reading fails)
  • Result: Maximum automation + maximum coverage + reliability

The Right Priority

For automated migration: Option 5 - Automated Installation ⭐
For selective migration: Option 6 - Interactive UniGetUI
For fallback/troubleshooting: Option 7 - PowerShell Scripts

This approach maximizes automation while providing comprehensive package source support via UniGetUI's integration with 40+ package managers.

Command-Line Usage

Option 5: Automated Installation (Default)

# Full automation - tries UniGetUI, falls back to scripts
.\src\restore\install_with_unigetui.ps1 -BundlePath "C:\Package\migration_bundle.ubundle"

Option 6: Interactive UniGetUI

# Opens GUI for manual selection
.\src\restore\install_with_unigetui.ps1 -BundlePath "C:\Package\migration_bundle.ubundle" -Interactive

Option 7: Fallback Scripts Only

# Skips UniGetUI, uses PowerShell scripts directly
.\src\restore\install_with_unigetui.ps1 -BundlePath "C:\Package\migration_bundle.ubundle" -UseFallback

Generate Bundle (Internal)

# Called automatically during scanner export
.\src\backup\generate_unigetui_bundle.ps1 -Software $softwareArray -OutputPath $outputDir

Direct UniGetUI Launch (Advanced)

# Launch UniGetUI directly with bundle
UniGetUI "C:\Package\migration_bundle.ubundle"

# Automated import and install (no GUI)
unigetui --import "C:\Package\migration_bundle.ubundle" --install-all --no-gui

Technical Details

Bundle Format (UniGetUI-compatible)

ReWin generates .ubundle files in the same format as UniGetUI exports, so bundles open correctly in the UniGetUI GUI and CLI.

{
  "export_version": 3,
  "packages": [
    {
      "Id": "Microsoft.VisualStudioCode",
      "Name": "Visual Studio Code",
      "Version": "1.85.0",
      "Source": "winget",
      "ManagerName": "Winget"
    },
    {
      "Id": "7zip.7zip",
      "Name": "7-Zip",
      "Version": "24.07",
      "Source": "winget",
      "ManagerName": "Winget"
    }
  ],
  "incompatible_packages_info": "Incompatible packages cannot be installed from UniGetUI...",
  "incompatible_packages": []
}
  • export_version: Set to 3 (UniGetUI bundle version).
  • packages (lowercase): Array of package entries.
  • Each package: Id, Name, Version, Source (e.g. winget, msstore), ManagerName (e.g. Winget, MsStore).
  • incompatible_packages: Empty array; ReWin only includes installable packages.

The install script (install_with_unigetui.ps1) accepts both this format and the legacy format (Packages uppercase, Manager instead of ManagerName) for backward compatibility.

Fallback install scripts (UniGetUI-style)

install_winget.ps1 generated by the Scanner uses the same command style as UniGetUI-exported scripts:

  • Each package is installed via: cmd.exe /C winget.exe install --id "Package.Id" --exact --source winget --accept-source-agreements --disable-interactivity --silent --accept-package-agreements --force
  • Success/failure is counted per command; the script exits with exit $failure_count.

Package Manager Detection

  • Winget: Primary choice for modern Windows
  • Chocolatey: Fallback if Winget ID not available
  • Microsoft Store: For UWP apps
  • Manual: Software without package IDs (not included in bundle)

Troubleshooting

Option 5 (Automated) Fails Completely

Symptoms: All three methods (UniGetUI CLI, direct bundle read, scripts) fail

Solutions:

  1. Check internet connection (required for downloads)
  2. Verify migration package folder contains required files
  3. Try Option 7 (Fallback Scripts) directly
  4. Check logs in package folder for specific errors
  5. Run as Administrator (required for package managers)

UniGetUI CLI Automation Not Working

Symptoms: First attempt fails, falls back to direct installation

This is normal behavior - Option 5 will automatically proceed with fallback methods. No action needed unless all methods fail.

Bundle File Not Found

Symptoms: Error: migration_bundle.ubundle not found

Solutions:

  • Ensure the USB package was exported using the Scanner GUI (Option 1)
  • Check "Export Migration Package" was clicked after scanning
  • Verify you're pointing to the correct package folder
  • Use Option 7 if only PowerShell scripts are available

UniGetUI Won't Install

Symptoms: Script fails to auto-install UniGetUI

Solutions:

  • Option 5 will automatically fall back to direct installation (no UniGetUI needed)
  • On fresh Windows, winget may need certificate bypass: run as Administrator: winget settings --enable BypassCertificatePinningForMicrosoftStore (ReWin runs this via ensure_winget_ready.ps1 when you use Options 5 or 6)
  • If you specifically want UniGetUI, install manually:
  • Use Option 7 to bypass UniGetUI entirely

Packages Fail to Install

Symptoms: Some packages show as failed in summary

Solutions:

  • Check internet connection
  • Verify package sources are accessible (Winget, Chocolatey)
  • Some packages may no longer be available - check failed list
  • Try Option 6 (Interactive) to see package details and search alternatives
  • Manually install failed packages from vendor websites

Prefer PowerShell Scripts Only

Symptoms: You don't want UniGetUI at all

Solution:

  • Use Option 7 (Fallback Scripts) - bypasses UniGetUI completely
  • Or run scripts manually from package folder:
    cd "C:\Path\To\Package"
    .\install_winget.ps1
    .\install_chocolatey.ps1

Corporate Environment Blocks UniGetUI

Symptoms: Security policy prevents UniGetUI installation

Solution:

  • Use Option 7 (Fallback Scripts) - works without UniGetUI
  • Pure Winget/Chocolatey commands that most environments allow
  • If some packages still can't be found, a summary list will be provided with unfound packages for manual installation

Future Enhancements

  • Auto-detect and recommend package sources for each software
  • Create bundles for non-Winget/Chocolatey packages (manual list)
  • Integration with restore configuration restoration
  • Support for pre-configured UniGetUI settings in package

🙏 Credits

UniGetUI - This integration would not be possible without UniGetUI

UniGetUI provides the critical bridge between ReWin's migration bundle and multiple package managers, enabling seamless installation across diverse software ecosystems.