-
Notifications
You must be signed in to change notification settings - Fork 0
The Recovery Protocol
The restore command is the most critical piece of engineering in the Melina project. It is designed to fix a broken pacman database and rebuild corrupted system files without creating an infinite loop of destruction.
The Threat: The Hook Paradox
If a user boots into the fallback {Melina} entry because their primary files are corrupted (zero bytes), running pacman -S linux to fix the system poses a massive risk.
When pacman starts the reinstall, it will trigger the ALPM hook. The Bash Engine would then blindly copy the currently corrupted primary files over our pristine -safe backups, destroying the only working copy of the kernel.
To prevent self-sabotage, the sudo melina restore command executes the following precise sequence:
-
Disarm the Shield: The Ruby CLI forcefully deletes /etc/pacman.d/hooks/00-melina-shield.hook. This makes pacman blind to our backup engine.
-
ALPM Database Query: It scans the system for installed core packages (linux, systemd, mkinitcpio, microcodes) ensuring it only attempts to reinstall software that actually belongs to that specific hardware architecture.
-
Delegated Reconstruction: It executes pacman -S . With the shield disarmed, pacman freely downloads and extracts fresh, uncorrupted binaries to the ESP.
-
Rearm the Shield: Once pacman finishes successfully, the Ruby CLI regenerates the .hook file.
-
Update Fallback: Finally, it triggers melina-shield manually to create a brand new backup of the freshly repaired system.