mirror of
https://github.com/stornic56/debianito-post-install.git
synced 2026-07-16 13:59:50 +00:00
d8878b67e1
- LightDM Overhaul: Rewrote `install_lightdm()` logic to verify both lightdm and lightdm-gtk-gtk-greeter-settings. Now installs the trio in a single command if missing, skipping only when fully present. Added "Enable autologin" option modifying `/etc/lightdm/lightdm.conf` with robust `sed` patterns for `SUDO_USER`. Fixed missing `debconf-set-selections` to ensure LightDM is set as default during installation. - GDM3 Implementation: Created a new sub-menu in `modules/desktop_display.sh` allowing independent installation of GDM3, User List toggle (hide/show), Autologin configuration via `/etc/gdm3/daemon.conf`, and conditional "Force Enable Wayland on NVIDIA" for Debian 12/13 using udev symlinks. - SDDM Integration: Added SDDM as option 3 in the Display Manager menu. Implemented automatic session detection (Wayland > X11) to populate `/etc/sddm.conf.d/autologin.conf` without user input, defaulting to plasmawayland, lxqt-wayland, or generic fallbacks. - greetd support: Added conditional support for Debian 12 and 13 only. Implemented sub-menu with base install, recommended `tuigreet` (with backports handling for Bookworm), and other manual setup options (`gtkgreet`, `nwg-hello`, `wlgreet`) exclusive to Trixie. - ZRAM UX Improvements: Updated descriptions in `modules/zram.sh` to explicitly mention I/O reduction and responsiveness benefits for low-RAM systems (e.g., 4GB). Cleaned up compression algorithm labels (`lz4`, `zstd`) to remove redundancy in menu values. - General Code Quality: Standardized all user-facing messages to English across modules. Ensured independent package installation checks prevent script abortion if one DM fails, while maintaining strict error handling for system configurations. - update docs and readme
285 lines
16 KiB
Markdown
285 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: trixie trixie-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 Menu Loop (while true) │
|
|
│ └── _menu: Select action from multiple options │
|
|
│ │
|
|
│ Options Available: │
|
|
│ ├── Debian 13+ (Trixie): │
|
|
│ │ ├── 1. Enable Contrib & Non-Free Components │
|
|
│ │ ├── 2. Migrate traditional sources.list to DEB822 │
|
|
│ │ ├── 3. Setup/Update Backports repositories │
|
|
│ │ ├── 4. [ADVANCED] Upgrade system branch (Testing/SID)│
|
|
│ │ └── 5. Back to main menu │
|
|
│ │
|
|
│ └── Other Versions: │
|
|
│ ├── 1-3 same as above │
|
|
│ └── No option 4 (branch upgrade not available) │
|
|
└─────────────────────────────────────────────────────────────┘
|
|
↓
|
|
┌─────────────────────────────────────────────────────────────┐
|
|
│ DECISION MATRIX PHASE │
|
|
├─────────────────────────────────────────────────────────────┤
|
|
│ 5. Determine Action Type (per menu selection) │
|
|
│ ├── If format changed → "migrate" │
|
|
│ ├── If nothing changed → "skip" (idempotent) │
|
|
│ └── Otherwise → "write" │
|
|
│ │
|
|
│ 6. Idempotency Check │
|
|
│ └── content_differs() compares generated vs existing │
|
|
└─────────────────────────────────────────────────────────────┘
|
|
↓
|
|
┌─────────────────────────────────────────────────────────────┐
|
|
│ EXECUTION PHASE │
|
|
├─────────────────────────────────────────────────────────────┤
|
|
│ 7. Backup Current Repositories │
|
|
│ └── backup_current_repos() → temp directory │
|
|
│ │
|
|
│ 8. Write Configuration │
|
|
│ ├── _write_deb822() OR _write_classic() │
|
|
│ ├── Creates appropriate file(s) │
|
|
│ └── Includes main + backports if enabled │
|
|
│ │
|
|
│ 9. Update Package Lists │
|
|
│ └── sudo apt update │
|
|
└─────────────────────────────────────────────────────────────┘
|
|
↓
|
|
┌─────────────────────────────────────────────────────────────┐
|
|
│ POST-EXECUTION PHASE │
|
|
├─────────────────────────────────────────────────────────────┤
|
|
│ 10. Success Path │
|
|
│ ├── REPOS_CONFIGURED=true │
|
|
│ ├── Cleanup disabled files │
|
|
│ └── Optional: Upgrade system if packages available │
|
|
│ │
|
|
│ 11. 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 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 bullseye 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., 6.1-6.12) | Newer kernels (e.g., 6.x/7.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
|
|
```
|
|
|
|
---
|