dual-gpu hardening & wireless robustness

- Protected apt repository writes across modules/repos.sh by adding `|| return 1` to `_write_deb822()` and `_write_classic()`, ensuring script continuation on failure instead of aborting under set -e.
- Added idempotent backup restoration in restore_previous_repos() with `sudo cp ... || true` and `sudo rm ... || true` to prevent fatal errors during repository recovery operations.
- Implemented rollback mechanism in migrate_to_branch() by wrapping _write_branch_sources() in a conditional check, restoring backup on failure and returning error code 1.
- Hardened firmware installation flow in modules/firmware.sh with `|| true` guards on all apt commands (broadcom-sta-dkms, network firmware packages, backports/stable paths), preventing set -e aborts during package management.
- Secured modprobe operations by adding `|| true` to wl module loading and blacklist file writes, ensuring wireless driver installation proceeds even if kernel module operations fail.
- Added GPU tools installation protection in _helpers.sh with `|| true` guard on vainfo command execution after nvtop installation completes successfully.
- Fixed NVIDIA Wayland configuration in modules/gpu/nvidia.sh by adding `|| return 1` to nvidia-wayland.conf tee operation, preventing silent failures when writing modprobe configuration files.
- Implemented network warning notification before Broadcom wireless module removal to alert users of potential SSH disconnection during WiFi driver transitions.
- Added broadcom blacklist file protection with `|| true` guard on modprobe.d/blacklist-broadcom.conf writes to prevent script termination on filesystem errors.
- Standardized error handling patterns across all firmware and GPU modules, replacing direct command execution with conditional wrappers that maintain script continuity under failure conditions.
This commit is contained in:
stornic56
2026-09-12 15:15:01 -05:00
committed by GitHub
parent 8c922ee424
commit 1fc395c188
5 changed files with 42 additions and 34 deletions
+4 -4
View File
@@ -27,10 +27,10 @@ restore_previous_repos() {
local rel="${f#/etc/apt/}"
local backup_file="$REPO_BACKUP_DIR/$rel"
if [ -f "$backup_file" ]; then
sudo cp "$backup_file" "$f"
sudo cp "$backup_file" "$f" || true
found=true
elif [ -f "$f" ]; then
sudo rm -f "$f"
sudo rm -f "$f" || true
found=true
fi
done
@@ -103,7 +103,7 @@ _write_deb822() {
if content_differs "$main_file" "$main_content"; then
if _confirm "Deb822 Sources" "Write main deb822 configuration to ${main_file}?"; then
sudo mkdir -p /etc/apt/sources.list.d
echo -e "$main_content" | sudo tee "$main_file" >/dev/null
echo -e "$main_content" | sudo tee "$main_file" >/dev/null || return 1
echo "Wrote ${main_file}"
else
echo "Main repository configuration skipped."
@@ -199,7 +199,7 @@ _write_classic() {
if content_differs "$main_file" "$main_content"; then
if _confirm "Classic Sources" "Write main classic configuration to ${main_file}?"; then
echo -e "$main_content" | sudo tee "$main_file" >/dev/null
echo -e "$main_content" | sudo tee "$main_file" >/dev/null || return 1
echo "Wrote ${main_file}"
else
echo "Main repository configuration skipped."