mirror of
https://github.com/stornic56/debianito-post-install.git
synced 2026-09-14 06:02:35 +00:00
Repos: Empty Sources, Deb822 & Security Fixes
- Enhanced repository detection logic in `modules/repos/repo_detect.sh`. Implemented `has_active_deb_sources()` for content-aware scanning across `sources.list`, `*.list`, and `*.sources` files. Empty or comment-only files are now correctly identified as "none" to trigger bootstrapping. - Enforced Debian 13 (Trixie) specific logic in `detect_repo_format()`. Deb822 format is only applied when `debian.sources` is active; Bookworm and Bullseye systems default strictly to classic sources.list regardless of file presence. - Added state guard against mixed configuration formats (deb822 + classic active simultaneously) with a warning prompt before writing, preventing duplicate entries in `/etc/apt/sources.list`. - Rewrote `_repos_enable_components()` in `modules/repos.sh` to remove early returns when components are already enabled. The script now verifies and ensures security and updates sections exist/were written correctly if missing or different. - Created new `bootstrap_repositories()` function for systems with no active sources. Includes user dialogue for format selection (Trixie) or auto-classic (older versions), backup/restore safety, and cleanup of empty sources.list files post-bootstrap. - Fixed false success reporting in `modules/firmware.sh` and `gaming.sh`. Added pre-checks to ensure APT sources exist before attempting `sed -i` modifications; if sources are missing, the script now triggers a full repository bootstrap instead of silently failing. - Implemented post-write verification in firmware/gaming modules to confirm components were actually added before reporting success to the user. - Generalized backports detection in `modules/utils.sh` (`is_backports_enabled()`) to scan all `*.list` and `*.sources` files rather than relying on fixed canonical filenames. - Corrected test harness variable expansion order and trimmed whitespace from component parsing logic during development verification.
This commit is contained in:
+25
-6
@@ -27,7 +27,18 @@ ensure_contrib_repo() {
|
||||
return 0
|
||||
fi
|
||||
|
||||
if _confirm "contrib Repository" "Component 'contrib' is required for Steam.\n\nAdd 'contrib' to your APT repositories?"; then
|
||||
if ! _confirm "contrib Repository" "Component 'contrib' is required for Steam.\n\nAdd 'contrib' to your APT repositories?"; then
|
||||
echo -e "${YELLOW}contrib repository not enabled. Steam installation may fail.${NC}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# No active sources at all → bootstrap a complete configuration
|
||||
if ! has_active_deb_sources; then
|
||||
backup_current_repos
|
||||
if ! bootstrap_repositories "main contrib"; then
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
if [ -f /etc/apt/sources.list ]; then
|
||||
sudo sed -i '/^deb / { /contrib/! s/main/main contrib/ }' /etc/apt/sources.list
|
||||
fi
|
||||
@@ -37,13 +48,21 @@ ensure_contrib_repo() {
|
||||
sudo sed -i '/^Components:/ { /contrib/! s/$/ contrib/ }' "$f"
|
||||
done
|
||||
fi
|
||||
sudo apt update
|
||||
echo -e "${GREEN}contrib repository enabled.${NC}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo -e "${YELLOW}contrib repository not enabled. Steam installation may fail.${NC}"
|
||||
return 1
|
||||
# Verify the component was actually added before reporting success
|
||||
local contrib_ok=false
|
||||
[ -f /etc/apt/sources.list ] && grep -Eq '^[^#]*\bcontrib\b' /etc/apt/sources.list 2>/dev/null && contrib_ok=true
|
||||
[ -d /etc/apt/sources.list.d ] && grep -qr 'Components:.*\bcontrib\b' /etc/apt/sources.list.d/*.sources 2>/dev/null && contrib_ok=true
|
||||
[ -d /etc/apt/sources.list.d ] && grep -qrE '^[^#]*\bcontrib\b' /etc/apt/sources.list.d/*.list 2>/dev/null && contrib_ok=true
|
||||
if ! $contrib_ok; then
|
||||
echo -e "${RED}Failed to enable contrib repository. Check your APT sources.${NC}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
sudo apt update
|
||||
echo -e "${GREEN}contrib repository enabled.${NC}"
|
||||
return 0
|
||||
}
|
||||
|
||||
install_gaming() {
|
||||
|
||||
Reference in New Issue
Block a user