Files
debianito-post-install/docs/repos_config.md
T
stornic56 2708d6dcb5 add retroarch, nvidia - java - internet refactor
- NVIDIA CUDA extrepo refactor in `modules/gpu/nvidia.sh`: removed unnecessary `i386_active` lines, updated warning to reference `v590 (unified metapackage)`, simplified installation from 18+10 versioned packages → `nvidia-driver-pinning-590 nvidia-driver firmware-nvidia-gsp`, eliminated `apt-mark hold` since pinning packages now handle it. DKMS verification and `NVIDIA_DRIVER_MODE="cuda-repo"` preserved.
- CUDA repo case fix in `modules/gaming.sh`: replaced silent bypass with detection of `nvidia-driver-libs:i386` v590 installation; if missing, prompts user confirmation before installing via active CUDA repo + pinning.
- Palemoon internet module overhaul (`modules/extras/internet/internet.sh`): removed deprecated `_enable_palemoon_repo()`, created new `install_palemoon()` with AVX2→AVX→SSE2 CPU detection from `/proc/cpuinfo`, proper `extrepo enable` call, and package installation.
- ProtonVPN module rewrite (`modules/extras/internet/internet.sh`): removed broken `_enable_protonvpn_repo()` that failed due to missing suite; created new `install_protonvpn()` using `stable` suite + `proton-vpn-gtk-app` package with proper validation.
- Java/Minecraft rename across `modules/gaming.sh` and `modules/extras/java.sh`: renamed `_install_gaming_java()` → `install_minecraft_java()`, updated menu title from "Java Runtimes for Gaming" to "Java Runtimes for Minecraft", changed whiptail tag from `"java-jre"` to `"java"`.
- RetroArch + 4 classic cores (`modules/gaming/tools.sh` and `.sh`): added RetroArch entry to gaming menu, new case handler in `gaming.sh`, updated installation command to include `libretro-mgba libretro-snes9x libretro-nestopia libretro-gambatte`, enhanced notice with emojis, core enumeration, DFSG warning, and wiki link.
- OnlyOffice server status (`modules/extras/office/office.sh`): added fallback message for slow or down OnlyOffice servers to improve user experience during installation.
- Full syntax validation: all modified files pass `bash -n` without errors; no residual references to old variables (`i386_active`, `590.48.01`) or functions remain.
- Documentation about Debian and the script is added to supplement important information.
- update README.md
2026-06-20 21:54:59 -05:00

274 lines
16 KiB
Markdown

## Option 3: Advanced Repository Configuration
### 1. What Does This Component Do?
The repository configuration module is the foundational engine of Debianito that establishes and maintains a secure, up-to-date package management environment for your Debian system. It performs **idempotent, atomic operations** to configure APT sources with precision while protecting against corruption through automatic rollback mechanisms.
At its core, this component:
- Detects your current repository format (Classic `.list` vs modern DEB822 `.sources`)
- Backs up existing configurations before any modifications
- Enables critical non-free components required for hardware drivers and proprietary software
- Integrates Debian Backports to access newer kernels and firmware packages
- Validates changes through `apt update` with automatic restoration on failure
This is not just about "adding repositories"—it's about **system integrity assurance** that enables all other configuration options (GPU drivers, kernel upgrades, gaming setup) to function correctly.
---
### 2. Supported Injection Formats
The script intelligently adapts to your Debian version and existing repository structure:
#### Classic Format (`/etc/apt/sources.list`)
- **Structure**: Human-readable text with `deb` lines
- **Use Case**: Debian 11 (Bullseye) through Debian 12 (Bookworm) default
- **Characteristics**: Linear, comment-friendly, widely understood by all APT tools
- **Example**:
```bash
deb https://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
```
#### Modern DEB822 Format (`/etc/apt/sources.list.d/debian.sources`)
- **Structure**: Declarative YAML-like format with `Types`, `URIs`, and `Suites` blocks
- **Use Case**: Debian 13 (Trixie) default, future-proofing for newer releases
- **Characteristics**: Machine-parseable, structured, supports complex repository hierarchies
- **Example**:
```yaml
Types: deb
URIs: https://deb.debian.org/debian
Suites: bookworm bookworm-updates
Components: main contrib non-free non-free-firmware
```
#### Migration Logic
The script automatically detects your current format and offers migration options:
- On Debian 13 (Trixie): Prompts to migrate TO DEB822 or stay with Classic
- Format changes are atomic—backup is created before any modification
- Old files are renamed with `.disabled` extension rather than deleted
---
### 3. Logical Decision Tree (Step-by-Step Execution Flow)
The `configure_repos()` function in `repos.sh` executes the following sequence:
```bash
┌─────────────────────────────────────────────────────────────┐
│ INITIAL DETECTION PHASE │
├─────────────────────────────────────────────────────────────┤
│ 1. Detect Debian Codename (DEBIAN_CODENAME)
│ └── If empty → Abort with error │
│ │
│ 2. Detect Current Format │
│ ├── detect_repo_format()"deb822" | "classic" | "none"
│ └── Display: "Current format: [format]"
│ │
│ 3. Detect Backports Status │
│ ├── detect_backports_status() → enabled/disabled │
│ └── Detect Location: embedded vs standalone │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ USER INTERACTION PHASE │
├─────────────────────────────────────────────────────────────┤
│ 4. Repository Format Selection (Trixie only)
│ └── whiptail yesno: Migrate to DEB822? (default NO)
│ │
│ 5. Backports Enablement │
│ └── whiptail confirm: Enable Backports? │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ DECISION MATRIX PHASE │
├─────────────────────────────────────────────────────────────┤
│ 6. Determine Action Type │
│ ├── If format changed → "migrate"
│ ├── If nothing changed → "update" (skip)
│ └── Otherwise → "write"
│ │
│ 7. Idempotency Check │
│ └── content_differs() compares generated vs existing │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ EXECUTION PHASE │
├─────────────────────────────────────────────────────────────┤
│ 8. Backup Current Repositories │
│ └── backup_current_repos() → temp directory │
│ │
│ 9. Write Configuration │
│ ├── _write_deb822() OR _write_classic()
│ ├── Creates appropriate file(s)
│ └── Includes main + backports if enabled │
│ │
│ 10. Update Package Lists │
│ └── sudo apt update │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ POST-EXECUTION PHASE │
├─────────────────────────────────────────────────────────────┤
│ 11. Success Path │
│ ├── REPOS_CONFIGURED=true
│ ├── Cleanup disabled files │
│ └── Optional: Upgrade system if packages available │
│ │
│ 12. Failure Path (apt update failed)
│ └── restore_previous_repos() → rollback to backup │
└─────────────────────────────────────────────────────────────┘
```
**Key Safety Mechanisms:**
- **Atomic Operations**: Backup created before any write operation
- **Idempotency Check**: `content_differs()` prevents unnecessary modifications
- **Rollback on Failure**: If `apt update` fails, original configuration is restored
- **Disabled File Extension**: Old formats renamed with `.disabled` rather than deleted
---
### 4. Software Components Activated
The script enables specific APT component branches that are essential for hardware functionality and software availability:
| Component | Purpose | Critical For | Debian Version Notes |
|-----------|---------|--------------|---------------------|
| **main** | Free, open-source software (Debian official) | All packages | Always enabled |
| **contrib** | Free software that uses non-free components | Proprietary codecs, drivers | Enabled in all versions |
| **non-free** | Non-free firmware and proprietary software | NVIDIA/AMD GPU drivers, Wi-Fi firmware | Required for hardware support |
| **non-free-firmware** | Firmware blobs (Wi-Fi, Bluetooth, etc.) | Wireless adapters, embedded chips | **Critical from Debian 12+** |
#### Why `non-free-firmware` is Vital (Debian 12+)
Starting with Debian Bookworm (12.0), the `non-free-firmware` component was separated into its own repository branch:
```bash
# Before Debian 12 (Bookworm)
deb https://deb.debian.org/debian bookworm main contrib non-free
# After Debian 12 (Bookworm+) - SEPARATE COMPONENTS
deb https://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
```
**Impact of Missing `non-free-firmware`:**
- ❌ Wi-Fi adapters won't work without firmware blobs
- ❌ Bluetooth devices may fail to initialize
- ❌ Some GPU drivers require proprietary microcode
- ❌ Embedded hardware (Raspberry Pi, etc.) becomes unusable
The script ensures all four components are present because:
1. **Hardware Compatibility**: Modern Debian kernels depend on these for out-of-the-box functionality
2. **Security Updates**: `non-free-firmware` receives security patches separately
3. **Future-Proofing**: Newer hardware releases firmware in this component exclusively
---
### 5. Support for Debian Backports
The backports integration is a sophisticated feature that enables access to newer, tested packages without compromising system stability:
#### Detection Logic (`detect_backports_status` & `detect_backports_location`)
```bash
# Checks ALL possible locations for backports configuration
├── /etc/apt/sources.list.d/debian-backports.sources (DEB822 standalone)
├── /etc/apt/sources.list.d/debian-backports.list (Classic standalone)
├── /etc/apt/sources.list.d/debian.sources (Embedded in DEB822)
└── /etc/apt/sources.list (Embedded in Classic)
```
**Return Values:**
- `"standalone-deb822"` → Separate `.sources` file (recommended)
- `"standalone-classic"` → Separate `.list` file
- `"embedded-deb822"` → Inside `debian.sources`
- `"embedded-classic"` → Inside `sources.list`
- `"none"` → Not configured
#### Backports Injection Process
```bash
┌─────────────────────────────────────────────────────────────┐
│ 1. User Selects: Enable Backports? │
│ └── whiptail confirm with explanation │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ 2. Determine Format │
│ ├── If DEB822 → _write_deb822_backports()
│ └── If Classic → _write_classic_backports()
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ 3. Create Backports File │
│ ├── Location: /etc/apt/sources.list.d/ │
│ └── Name: debian-backports.sources or .list │
│ │
│ Content Example (DEB822): │
│ Types: deb │
│ URIs: https://deb.debian.org/debian │
│ Suites: bookworm-backports │
│ Components: main contrib non-free non-free-firmware │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ 4. Cleanup Embedded Backports (Safety Net)
│ └── If backports existed in main file, remove them │
└─────────────────────────────────────────────────────────────┘
```
#### Why Enable Backports?
The script includes a detailed explanation because backports enable critical features:
| Feature | Without Backports | With Backports |
|---------|-------------------|----------------|
| **Linux Kernel** | Stable kernel only (e.g., 5.10) | Newer kernels (e.g., 6.x series) |
| **GPU "Drivers"** | Latest Mesa from stable | Latest Mesa from testing |
| **Wi-Fi Firmware** | Older firmware versions | Newest firmware for modern cards |
| **System Stability** | Maximum stability | Tested-but-newer packages |
#### Backports Warning System
The script includes safeguards:
- Only enabled if user explicitly confirms
- Warns about potential compatibility issues
- Can be disabled anytime via Option 3 again
- Automatically detected in other modules (kernel, GPU)
---
### Technical Implementation Notes
**Idempotency Guarantee:**
```bash
# content_differs() ensures no duplicate writes
if [ "$current" = "$generated" ]; then
return 1 # No changes needed
fi
return 0 # Changes required
```
**Atomic Backup Mechanism:**
```bash
backup_current_repos() {
REPO_BACKUP_DIR=$(mktemp -d)
for f in /etc/apt/sources.list /etc/apt/sources.list.d/*.sources; do
cp "$f" "$REPO_BACKUP_DIR/" 2>/dev/null || true
done
}
# Rollback on failure:
restore_previous_repos() {
sudo cp "$backup_file" "$original_path" # Restore from temp backup
rm -rf "$REPO_BACKUP_DIR" # Clean up after success/failure
}
```
**Component Activation Pattern:**
All four components are written in a single operation to prevent partial configurations:
```bash
Components: main contrib non-free non-free-firmware # Atomic write
# Not written as separate lines to avoid merge conflicts
```
---