mirror of
https://github.com/stornic56/debianito-post-install.git
synced 2026-10-31 13:08:06 +00:00
Recovered 70 prior commits from Gitea mirror and resolved divergent history using --allow-unrelated-histories. Integrated 16 recent local commits via patch. Applied targeted technical fixes: added explicit bash shell declaration in shellcheck YAML configuration (commit 693caff) and targeted SC2120 disables in modules/utils.sh (commit 3614b56). All verifications passed: shellcheck compliance, bash syntax check (bash -n), and BATS test suite passing cleanly. Symmetrically synchronized repository state across GitHub and Gitea.
This commit is contained in:
+7
-7
@@ -2,11 +2,11 @@
|
||||
|
||||
### 1. What does this component do?
|
||||
|
||||
This component serves as a comprehensive rescue toolkit designed to diagnose and fix boot-related issues on Debian systems, specifically targeting GRUB configuration, UEFI Secure Boot integrity, and initrd image validity. It provides three primary operations: configuring the GRUB boot menu behavior (including timeout adjustments and visibility settings), repairing UEFI Secure Boot by reinstalling signed bootloader packages after kernel or driver changes, and regenerating initramfs images to resolve missing driver errors. All modifications are protected by automatic backup creation before system files are altered, with built-in rollback mechanisms that restore the original state if any operation fails during execution.
|
||||
This component diagnoses and fixes boot-related problems on Debian: GRUB configuration, UEFI Secure Boot integrity and initrd image validity. It performs three operations: configuring the GRUB boot menu (timeout and visibility settings), repairing UEFI Secure Boot by reinstalling signed bootloader packages after kernel or driver changes, and regenerating initramfs images to fix missing driver errors. Every modification starts with a timestamped backup, and a failed operation rolls back to the original state.
|
||||
|
||||
### 2. Logical Execution Flow
|
||||
|
||||
**Block 1 — GRUB Boot Menu Settings**
|
||||
**Block 1: GRUB Boot Menu Settings**
|
||||
|
||||
- **Menu Options:** Users select from four presets or a custom option to control boot behavior:
|
||||
1. Hide GRUB menu entirely (Fastest boot, requires holding ESC during power-on).
|
||||
@@ -17,7 +17,7 @@ This component serves as a comprehensive rescue toolkit designed to diagnose and
|
||||
- **Backup & Safety:** Before applying changes, the script creates a timestamped backup of `/etc/default/grub`. It writes an override configuration file at `/etc/default/grub.d/99_script_override.cfg` to ensure settings persist across updates.
|
||||
- **Execution & Rollback:** The system runs `update-grub` to apply changes. If this command fails, the script automatically restores the timestamped backup and removes the override file to prevent boot issues.
|
||||
|
||||
**Block 2 — UEFI Secure Boot Repair**
|
||||
**Block 2: UEFI Secure Boot Repair**
|
||||
|
||||
- **Pre-checks:** Before proceeding, the script verifies two conditions:
|
||||
1. The system is running in UEFI mode (checks for existence of `/sys/firmware/efi`).
|
||||
@@ -28,15 +28,15 @@ This component serves as a comprehensive rescue toolkit designed to diagnose and
|
||||
2. Reinstalls GRUB to the EFI partition using `grub-install` with the appropriate target and directory detection (preferring `/boot/efi` over `/boot`).
|
||||
3. Regenerates the GRUB configuration via `update-grub`.
|
||||
|
||||
**Block 3 — Initramfs Regeneration**
|
||||
**Block 3: Initramfs Regeneration**
|
||||
|
||||
- **Confirmation:** The script prompts for user confirmation before proceeding to avoid unintended rebuilds.
|
||||
- **Execution:** Upon approval, it runs `update-initramfs -u -k all || true` to regenerate initrd images for all installed kernels.
|
||||
- **Purpose:** This fixes boot issues caused by missing drivers or corrupted initrd images that prevent the system from loading properly.
|
||||
|
||||
### 3. Intelligent Automation
|
||||
### 3. Safeguards and Automation
|
||||
|
||||
- **EFI Directory Detection:** The script intelligently detects the EFI partition, checking `/boot/efi` first and falling back to `/boot` if necessary.
|
||||
- **EFI Directory Detection:** The script detects the EFI partition, checking `/boot/efi` first and falling back to `/boot` if necessary.
|
||||
- **Secure Boot State Verification:** Instead of assuming Secure Boot is active, it uses `mokutil --sb-state` to verify the actual state before attempting repairs on non-UEFI or disabled systems.
|
||||
- **GRUB Backup Strategy:** A timestamped backup file (e.g., `/etc/default/grub.backup.YYYYMMDD_HHMMSS`) is created prior to any modification, ensuring a safe point for rollback.
|
||||
- **Rollback Mechanism:** If `update-grub` fails during the GRUB settings or Secure Boot repair process, the script automatically restores the backup and cleans up temporary override files.
|
||||
@@ -44,7 +44,7 @@ This component serves as a comprehensive rescue toolkit designed to diagnose and
|
||||
- **Input Validation:** Custom timeout inputs are validated using regex matching for integers (e.g., `^-?[0-9]+$`), allowing negative numbers like -1 while rejecting invalid text.
|
||||
- **Variable Handling Logic:** The `_set_grub_var()` function handles three distinct cases: updating an existing variable, uncommenting a commented variable, or appending a new variable if it does not exist in the configuration file.
|
||||
|
||||
### 4. Paquetes y Recursos Gestionados
|
||||
### 4. Managed Packages and Resources
|
||||
|
||||
**Boot Packages Reinstalled (Secure Boot Repair):**
|
||||
|
||||
|
||||
Reference in New Issue
Block a user