mirror of
https://github.com/stornic56/debianito-post-install.git
synced 2026-09-14 06:02:35 +00:00
Docs Update
- ZRAM Scaling (docs/QUICKSTART.md): Updated Step 9 with the current fixed-4096MB formula: `≤8 GB → 50%`, `>8 GB → 4096 MB fixed`. Replaced obsolete `ram_gb > 16 ? 25% : 50%` and `/4` vs `/2` logic with the new behavior (`ram_gb <= 8 ? 50% : 4096 MB`). Examples: 4GB → 2048 MB, 8GB → 4096 MB, 16GB → 4096 MB, 32GB → 4096 MB.
- GPU Configuration (docs/gpu.md): Added AMD GCN Migration subsection with duplicate guard (`content_differs-style` check) and sed fix logic. Added Secure Boot warning for NVIDIA DKMS (`mokutil --sb-state` detection). Documented `|| return 1` protection for `/etc/modprobe.d/nvidia-wayland.conf` writing. Renumbered duplicate sections 7 → 8 → 9 to avoid duplicate headings.
- Firmware Installation (docs/firmware.md): Updated Broadcom section with `_run_cmd` wrappers (`|| true`) for `apt install broadcom-sta-dkms` and `modprobe wl`. Added SSH network warning (`WARNING: SSH is not recommended on a router`) before `modprobe -r`. Updated Initramfs step with `_run_cmd` wrapper (`|| true`).
- Repo Configuration (docs/repos_config.md): Removed `REPOS_CONFIGURED=true` from the POST-EXECUTION PHASE diagram and Safety Mechanisms. Added `_write_branch_sources` with its `_restore_backup` rollback and "Branch Migration Rollback" safety note to the diagram.
- System Info & Pre-flight (docs/system_info.md): Added pre-flight init (auto-install whiptail + lsb-release). Added LSPCI_OUTPUT cache with `command -v lspci` guard. Added `_ensure_apt_updated` deduplication helper. Added `STATE_REFRESHED=true` flag mechanism across all menu branches.
- User Home Ownership (docs/user_priv_feed.md): Updated Option 3 (Repair Home Ownership) to use `getent passwd "${SUDO_USER:-$USER}"` instead of the insecure `eval echo "~$USER"` pattern. Added documentation note explaining the security rationale.
- QuickStart ZRAM (docs/QUICKSTART.md): Updated Step 9 ZRAM scaling to "50% of RAM (≤8 GB) or 4096 MB fixed (>8 GB)".
This commit is contained in:
+25
-6
@@ -1,10 +1,11 @@
|
||||
## Option 3: Advanced Repository Configuration
|
||||
# Option 4: 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
|
||||
@@ -20,19 +21,23 @@ This is not just about "adding repositories"—it's about **system integrity ass
|
||||
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
|
||||
@@ -41,7 +46,9 @@ 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
|
||||
@@ -52,7 +59,6 @@ The script automatically detects your current format and offers migration option
|
||||
|
||||
The `configure_repos()` function in `repos.sh` executes the following sequence:
|
||||
|
||||
|
||||
```bash
|
||||
┌─────────────────────────────────────────────────────────────┐
|
||||
│ INITIAL DETECTION PHASE │
|
||||
@@ -111,6 +117,11 @@ The `configure_repos()` function in `repos.sh` executes the following sequence:
|
||||
│ ├── Creates appropriate file(s) │
|
||||
│ └── Includes main + backports if enabled │
|
||||
│ │
|
||||
│ 8b. Branch Migration (if applicable) │
|
||||
│ ├── _write_branch_sources() → writes new branch sources │
|
||||
│ ├── If failure → _restore_backup() || true │
|
||||
│ └── return 1 │
|
||||
│ │
|
||||
│ 9. Update Package Lists │
|
||||
│ └── sudo apt update │
|
||||
└─────────────────────────────────────────────────────────────┘
|
||||
@@ -119,7 +130,6 @@ The `configure_repos()` function in `repos.sh` executes the following sequence:
|
||||
│ POST-EXECUTION PHASE │
|
||||
├─────────────────────────────────────────────────────────────┤
|
||||
│ 10. Success Path │
|
||||
│ ├── REPOS_CONFIGURED=true │
|
||||
│ ├── Cleanup disabled files │
|
||||
│ └── Optional: Upgrade system if packages available │
|
||||
│ │
|
||||
@@ -130,9 +140,11 @@ The `configure_repos()` function in `repos.sh` executes the following sequence:
|
||||
```
|
||||
|
||||
**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
|
||||
- **Rollback on Failure**: If `apt update` fails, original configuration is restored via `restore_previous_repos()`
|
||||
- **Branch Migration Rollback**: `_write_branch_sources()` failure triggers `_restore_backup() || true`
|
||||
- **Disabled File Extension**: Old formats renamed with `.disabled` rather than deleted
|
||||
|
||||
---
|
||||
@@ -142,7 +154,7 @@ The `configure_repos()` function in `repos.sh` executes the following sequence:
|
||||
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 |
|
||||
@@ -161,12 +173,14 @@ deb https://deb.debian.org/debian bookworm main contrib non-free non-free-firmwa
|
||||
```
|
||||
|
||||
**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
|
||||
@@ -188,6 +202,7 @@ The backports integration is a sophisticated feature that enables access to newe
|
||||
```
|
||||
|
||||
**Return Values:**
|
||||
|
||||
- `"standalone-deb822"` → Separate `.sources` file (recommended)
|
||||
- `"standalone-classic"` → Separate `.list` file
|
||||
- `"embedded-deb822"` → Inside `debian.sources`
|
||||
@@ -231,7 +246,7 @@ The backports integration is a sophisticated feature that enables access to newe
|
||||
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 |
|
||||
@@ -240,6 +255,7 @@ The script includes a detailed explanation because backports enable critical fea
|
||||
#### 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
|
||||
@@ -250,6 +266,7 @@ The script includes safeguards:
|
||||
### Technical Implementation Notes
|
||||
|
||||
**Idempotency Guarantee:**
|
||||
|
||||
```bash
|
||||
# content_differs() ensures no duplicate writes
|
||||
if [ "$current" = "$generated" ]; then
|
||||
@@ -259,6 +276,7 @@ return 0 # Changes required
|
||||
```
|
||||
|
||||
**Atomic Backup Mechanism:**
|
||||
|
||||
```bash
|
||||
backup_current_repos() {
|
||||
REPO_BACKUP_DIR=$(mktemp -d)
|
||||
@@ -276,6 +294,7 @@ restore_previous_repos() {
|
||||
|
||||
**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
|
||||
|
||||
Reference in New Issue
Block a user