Files
debianito-post-install/modules/extras/internet/internet.sh
T
stornic56 89233b0750 Desktop environment support & QA expansion
- `.github/workflows/ci.yml` added as a new workflow: job `lint-and-test` on `runs-on: ubuntu-latest` with `container: debian:trixie`, checking out via `actions/checkout@v4`, installing `bats` and `shellcheck`, running `shellcheck --severity=error debianito.sh modules/**/*.sh` (with `shopt -s globstar`) and `bats tests/`.

- `debianito.sh` CLI parser: `AUTO_YES=0`, `ALLOW_DESTRUCTIVE=0` declared after `MODULES_DIR` and before `_boot_mark`; `_usage()` prints `Usage: debianito.sh [OPTIONS]` with `--yes`, `--allow-destructive` and `--help`; the `while [ $# -gt 0 ]` / `case` loop consumes `--yes` and `--allow-destructive`, prints `Unknown option: $1 (run with --help for usage)` to stderr and `exit 2` for unknown flags, and `--help|-h` runs `_usage` then `exit 0`.

- `modules/utils.sh`: new global `_SELECTION_CONFIRMED=0` and `_confirm_install_list()` (utils.sh:756-785), which renders items capped at 15 with `... and N more`, computes `height` capped at 24, calls `_confirm "$title" "$list" "$height" 65`, arms `_SELECTION_CONFIRMED=${#items[@]}` on yes, and returns 1 for an empty list or on decline. `_install_pkg()` (utils.sh:789-804) decrements the countdown instead of prompting, and only prompts via `elif ! _confirm "Install: ${pkg}" "Install ${pkg}\nVersion: ${ver}?"; then return 0`.

- Bulk retrofit in `modules/extras/**/*.sh` (18 sites): `_confirm_install_list "Título" "${array[@]}" || return` placed right after the `whiptail` selection is parsed, the install loop left intact, and `_SELECTION_CONFIRMED=0` after the loop. Files: office/office.sh:101, system/software_centers.sh:29, system/system.sh:133, communication/communication.sh:68, design/design.sh:42, download/download.sh:48+55, terminals/terminals.sh:31, security/security.sh:30, players/players.sh:20, themes/fonts/fonts.sh:32, dev/dev.sh:44, programming/programming.sh:57, themes/desktop-themes/desktop-themes.sh:30, fetch/fetch.sh:41, themes/icons/icons.sh:47, themes/cursors/cursors.sh:28, internet/internet.sh:197, java.

- `modules/bullseye/extras.sh` (13 sites) plus `modules/bullseye/legacy.sh` (1 site, `install_gaming_bullseye`, guarded with `if [ ${#_install_pkgs[@]} -gt 0 ]` so a i386-only selection does not blank the summary) plus `modules/desktop_display.sh` (1 site, XFCE Custom — a no-loop `_run_cmd` batch with the reset immediately after it). Special cases: download.sh and bullseye/download each have two checklists merged into one combined summary; legacy.sh gaming skips the reset when the list is empty; XFCE Custom resets before `_xfce_polkit_rules` so the counter cannot leak.

- `modules/desktops/desktop_gnome.sh` (new): `gnome_menu()` runs a `_radiolist` with "1" "GNOME (Full Desktop)", "2" "GNOME Core (Minimal Install)", "3" "Back", then `_install_gnome_full()` and `_install_gnome_core()`. Each arms `_confirm_install_list "GNOME Full Desktop" gnome gdm3 || return` (core: `gnome-core gdm3`), keeps an already-configured display manager via `_existing_display_manager` by setting `target_dm="$keep_dm"`, writes the preseed `echo "${target_dm} shared/default-x-display-manager select ${target_dm}" | sudo debconf-set-selections`, installs `sudo apt install -y gnome gdm3` / `gnome-core gdm3`, enables `gdm3` only when `target_dm = "gdm3"`, resets `_SELECTION_CONFIRMED=0` and calls `_offer_pipewire_after_desktop`.

- `modules/desktops/desktop_kde.sh` (new): `kde_menu()` runs a `_radiolist` with "1" "KDE Plasma (Full Desktop)", "2" "KDE Plasma Desktop (Minimal)", "3" "Back"; `_install_kde_full()` and `_install_kde_minimal()` arm `_confirm_install_list "KDE Plasma Full" kde-standard sddm || return` (minimal: `kde-plasma-desktop sddm`), preseed `sddm shared/default-x-display-manager select sddm`, install `sudo apt install -y kde-standard sddm` / `kde-plasma-desktop sddm`, enable `sddm` only when it is the target DM, reset the counter and offer PipeWire.

- `modules/desktop_display.sh` `desktop_environment_menu()`: `env_items+=("3" "GNOME")`, `env_items+=("4" "KDE Plasma")`, `env_items+=("5" "Back")`; the case adds `3)` loading `gnome` via `_load_module gnome || continue` and calling `gnome_menu`, and `4)` loading `kde` via `_load_module kde || continue` and calling `kde_menu`; the dead TODO comment was removed.

- PipeWire retrofit in `modules/desktop_display.sh` (6 sites): `_install_lxde_full`, `_install_lxde_core`, `_install_xfce_full`, `_install_xfce_minimal`, `_install_xfce_wayland` and `_install_xfce_custom` each call `_offer_pipewire_after_desktop` after their install block.

- `_offer_pipewire_after_desktop()` and `_existing_display_manager()` added at the end of `modules/desktop_display.sh`: `_offer_pipewire_after_desktop` checks `pipewire-audio` (`pipewire` when `DEBIAN_VERSION = 11`), returns 0 via `is_installed`, otherwise `_confirm "PipeWire Audio" "No PipeWire audio server is installed.\n\nInstall the PipeWire audio stack (recommended)?"` calls `_install_pipewire_standard` and returns 0. `_existing_display_manager` reads `${DM_FILE:-/etc/X11/default-display-manager}`, reads the basename as the DM, and otherwise scans `gdm3 lightdm sddm greetd gdm` with `systemctl is-enabled`, printing nothing when none is found.

- `_ensure_apt_updated` added before the GNOME/KDE `apt install` transactions (4 sites, deduplicated per session); `gnome gdm3` and `kde-standard sddm` are installed alongside even when another display manager is kept as the default.

- Extraction to `modules/desktops/`: `desktop_lxde.sh` (38 lines) and `desktop_xfce.sh` (119 lines) created with the `lxde_menu` / `_install_lxde_full` / `_install_lxde_core` and `xfce_menu` / `_install_xfce_full` / `_install_xfce_minimal` / `_install_xfce_wayland` / `_install_xfce_custom` / `_xfce_polkit_rules` blocks moved verbatim; both carry `# License GPL v3` in their headers.

- `modules/desktop_display.sh` reduced from 542 to 394 lines (−154): lines 55-208 removed, the dispatch (desktop_display.sh:39-46) replaced with `_load_module xfce || continue` / `lxde_menu`, and the file left with `manage_desktop_display`, `desktop_environment_menu`, `display_manager_menu`, `lightdm_config_menu`, `configure_greetd`, `configure_gdm3`, `configure_sddm`, the two shared helpers.

- `modules/utils.sh` `_load_module` map: `xfce)` → `${MODULES_DIR}/desktops/desktop_xfce.sh`, `lxde)` → `${MODULES_DIR}/desktops/desktop_lxde.sh`, `gnome)` → `${MODULES_DIR}/desktops/desktop_gnome.sh`, `kde)` → `${MODULES_DIR}/desktops/desktop_kde.sh`; deps for `xfce`, `lxde`, `gnome` and `kde` are `(desktop_display audio)` and `desktop_display` is `(repos audio)`.

- `modules/desktops/desktop_xfce.sh` `_xfce_polkit_rules()` writes `/etc/polkit-1/rules.d/85-suspend.rules` and `89-backlight.rules` via `sudo tee`, adds the `backlight` group with `groupadd --system` fallback, adds the real login user from `/etc/passwd` to `backlight` and restarts `polkit.service`.

- ES→EN user-facing strings: 14 strings across 4 files — `desktop_display.sh` `lxdе_menu` ("LXDE (Full Desktop)", "LXDE Core (Minimal Install)"), `gpu/nvidia.sh` Kepler legacy-driver notice ("Kepler GPU detected (GKxxx)… Install the legacy driver for Kepler?"), `bullseye/legacy.sh` ("Install NVIDIA driver?", "Skipping NVIDIA driver.", "Installing NVIDIA driver ${gpu_gen}...") and `bullseye/extras.sh` ("firmware-linux-nonfree provides drivers for… Install?").

- ES→EN internal comments: ~35 comments across 9 files — section headers in `_install_nvidia_standard`, `gpu/_helpers.sh` (lines 5, 113), `gpu/nvidia.sh` (lines 8-12, 19-22, 68-70, 167-172, 196, 239-253, 262-263, 275, 291, 336-338, 376), `gpu.sh` (lines 15-17), `bullseye/repos.sh` (line 2), `firmware.sh` (line 235, "--- Load verification ---"), `utils.sh` (lines 129, 132, 153 — timezone Paso 1/2/4) and `utils.sh:546,548`.

- set -e abort fix: `debianito.sh:149` now reads `_system_preferences_menu || true`, consistent with the other dispatch chains (14 of the 15 chains already had the guard); a declined pre-apply summary now leaves the TUI alive instead of terminating the script.

- `docs/desktops_display.md`: 4 hunks — intro now lists GNOME/GNOME Core/KDE Plasma/KDE Plasma Desktop/XFCE/XFCE Wayland/XFCE Custom/LXDE, a new "Modular layout" paragraph describing `modules/desktops/` and lazy loading, Block 1 rewritten into four environments, five new bullets (pre-apply summary, existing-DM preservation, PipeWire offer, stale-lists guard) and a Desktop Environment Packages table.

- `docs/quickstart.md` line 284: Desktop Environment entry expanded to pick from XFCE (full / minimal / Wayland `labwc` on Trixie / custom checklist), LXDE (full / core), GNOME (full / core) or KDE Plasma (full / minimal).

- `_existing_display_manager` now takes the config path via `local dm_file="${DM_FILE:-/etc/X11/default-display-manager}"` so the offline test suite never reads the real system file.

- `tests/test_helper.bash`: added `_mock_systemctl()` for `is-enabled` (units in `MOCK_SYSTEMCTL_ENABLED` report `enabled`, everything else `disabled`), `MOCK_SYSTEMCTL_ENABLED=""`, `WHIPTAIL_CALLS`/`MOCK_WHIPTAIL_OUTPUT`/`MOCK_WHIPTAIL_RC`, `MOCK_DPKG_INSTALLED` and the `systemctl` entry in the mock list and in `mock_reset()`.

- `tests/desktops.bats` created with 16 tests: `_existing_display_manager` (file read, file-preferred over an enabled unit, enabled-unit fallback, candidate order, missing file, nothing configured), `_offer_pipewire_after_desktop` (5 tests: skip-installed, accept-installs, decline-returns-0, Bullseye package name, wrong package name on 11), `_load_module` (4 tests for xfce/lxde/gnome/kde) and an unknown-module case; 17→33 tests total.

- `.github/workflows/ci.yml` shellcheck severity raised from `--severity=error` to `--severity=warning`.

- `debianito.sh`: `RED`, `GREEN`, `YELLOW`, `CYAN` and `NC` plus `AUTO_YES`, `ALLOW_DESTRUCTIVE` and `DEBIAN_CODENAME` are now `export`ed as cross-file globals.

- `modules/utils.sh`: `HAS_NVIDIA`, `DESKTOP_ENV`, `AUDIO_SERVER`, `DEBIAN_VERSION` and the other cross-file globals are `export`ed.

- `modules/extras/system/software_centers.sh` gained a `#!/usr/bin/env bash` shebang.

- `shellcheck` triage (v0.11.0, baseline `--severity=warning` 25 findings → 0): removed two dead-code lines (`headless` in `extras/dev/dev.sh`, orphan `dev_id` in `firmware.sh`); `SC2206` in `extras/dev/essential.sh` fixed by expanding `$comp_pkgs` to `"${comp_pkgs[@]}"`; `SC2010`/`SC2046` (3 sites) replaced `ls … | grep` with `compgen -G "…"`; `SC2155` (2 sites, `gpu.sh` and `rescue.sh`) split command substitutions into separate lines; `SC2166` in `repos.sh` replaced `-o` with `{ … || … }`; `SC2221`/`SC2222` (2 sites, `sysinfo.sh` and `utils.sh`) collapsed the `wl*|wlp*|wlo*|wlan*` alternation to `wl*`; `SC1090` in `extras.sh` gained a justification comment on the disable directive.

- Final verification: `bash -n` on all 15 modified `.sh` files and `set -euo pipefail` at `debianito.sh:3` both intact; `bats tests/` reports 33 ok / 0 failed; invariants `offers 11`, `confirm_install_list 39` and `_SELECTION_CONFIRMED=0 40` hold.
2026-10-05 23:17:38 -05:00

390 lines
13 KiB
Bash

#!/usr/bin/env bash
# internet.sh — Browsers, email, VPN
# extrepo-powered: mozilla, floorp, palemoon, librewolf, tailscale, mullvad, protonvpn
# firefox-esr from Debian repos (with locale auto-detect)
# ── Helpers extrepo ──
_ensure_extrepo() {
if ! command -v extrepo &>/dev/null; then
_run_cmd "extrepo" "sudo apt install -y extrepo" "Installing extrepo..."
fi
}
_enable_mozilla_repo() {
if [ ! -f /etc/apt/sources.list.d/extrepo_mozilla.sources ]; then
_ensure_extrepo
_run_cmd "Mozilla" "sudo extrepo enable mozilla" "Enabling Mozilla repository..."
fi
if [ ! -f /etc/apt/preferences.d/mozilla ]; then
sudo tee /etc/apt/preferences.d/mozilla >/dev/null <<'EOF'
Package: *
Pin: origin packages.mozilla.org
Pin-Priority: 1000
EOF
fi
_ensure_apt_updated
}
_enable_floorp_repo() {
if [ ! -f /etc/apt/sources.list.d/extrepo_floorp.sources ]; then
_ensure_extrepo
_run_cmd "Floorp" "sudo extrepo enable floorp" "Enabling Floorp repository..."
fi
_ensure_apt_updated
}
install_palemoon() {
if [ "$DEBIAN_VERSION" -lt 12 ] 2>/dev/null; then
_msg "Pale Moon" "Pale Moon is only available on\nDebian 12 (Bookworm) and 13 (Trixie).\n\nSkipping installation." 10 60
return 1
fi
local cpu_flags cpu_label REPO_PALEMOON
cpu_flags=$(grep -m1 '^flags' /proc/cpuinfo 2>/dev/null)
if echo "$cpu_flags" | grep -q 'avx2'; then
REPO_PALEMOON="palemoon_avx2_gtk3"
cpu_label="AVX2"
elif echo "$cpu_flags" | grep -q 'avx'; then
REPO_PALEMOON="palemoon_avx_gtk3"
cpu_label="AVX"
else
REPO_PALEMOON="palemoon_sse2_gtk3"
cpu_label="SSE2"
fi
_msg "Pale Moon" "CPU detected: ${cpu_label} support.\n\nEnabling optimized repository:\n ${REPO_PALEMOON}" 10 60
if ls /etc/apt/sources.list.d/extrepo_palemoon_*.sources &>/dev/null; then
echo "Pale Moon repository already enabled."
else
_ensure_extrepo
_run_cmd "Pale Moon" "sudo extrepo enable ${REPO_PALEMOON}" "Enabling ${REPO_PALEMOON}..."
_ensure_apt_updated
fi
if ! is_installed "palemoon"; then
_run_cmd "Pale Moon" "sudo apt install -y palemoon" "Installing Pale Moon..."
echo -e "${GREEN}Pale Moon installed.${NC}"
else
echo "Pale Moon already installed."
fi
}
_enable_librewolf_repo() {
if [ ! -f /etc/apt/sources.list.d/extrepo_librewolf.sources ]; then
_ensure_extrepo
_run_cmd "LibreWolf" "sudo extrepo enable librewolf" "Enabling LibreWolf repository..."
fi
_ensure_apt_updated
}
_enable_tailscale_repo() {
if [ ! -f /etc/apt/sources.list.d/extrepo_tailscale.sources ]; then
_ensure_extrepo
_run_cmd "Tailscale" "sudo extrepo enable tailscale" "Enabling Tailscale repository..."
fi
_ensure_apt_updated
}
_enable_mullvad_repo() {
if [ ! -f /etc/apt/sources.list.d/extrepo_mullvad.sources ]; then
_ensure_extrepo
_run_cmd "Mullvad" "sudo extrepo enable mullvad" "Enabling Mullvad repository..."
fi
_ensure_apt_updated
}
install_protonvpn() {
if [ ! -f /etc/apt/sources.list.d/extrepo_protonvpn.sources ]; then
_ensure_extrepo
_run_cmd "ProtonVPN" "sudo extrepo enable protonvpn stable" "Enabling ProtonVPN repository (stable suite)..."
_ensure_apt_updated
else
echo "ProtonVPN repository already enabled."
fi
if ! is_installed "proton-vpn-gtk-app"; then
_msg "ProtonVPN" "Installing Proton VPN GTK client\nfrom the official Proton repository." 10 60
_run_cmd "ProtonVPN" "sudo apt install -y proton-vpn-gtk-app" "Installing Proton VPN GTK app..."
echo -e "${GREEN}ProtonVPN installed.${NC}"
else
echo "Proton VPN GTK app already installed."
fi
}
# ── Categories ──
_cat_internet() {
local headless=false
_is_headless && headless=true
local -a items=()
if ! $headless; then
local chromium_state
chromium_state=$(_state "chromium")
local dillo_state
dillo_state=$(_state "dillo")
local epiphany_state
epiphany_state=$(_state "epiphany-browser")
local falkon_state
falkon_state=$(_state "falkon")
local firefox_state="OFF"
if command -v firefox &>/dev/null && ! is_installed "firefox-esr"; then
firefox_state="ON"
fi
local firefox_esr_state
firefox_esr_state=$(_state "firefox-esr")
local floorp_state
floorp_state=$(_state "floorp")
local konqueror_state
konqueror_state=$(_state "konqueror")
local librewolf_state
librewolf_state=$(_state "librewolf")
local palemoon_state
palemoon_state=$(_state "palemoon")
local privacybrowser_state
privacybrowser_state=$(_state "privacybrowser")
local qutebrowser_state
qutebrowser_state=$(_state "qutebrowser")
local thunderbird_state
thunderbird_state=$(_state "thunderbird")
local torbrowser_state
torbrowser_state=$(_state "torbrowser-launcher")
local mullvadbrowser_state
mullvadbrowser_state=$(_state "mullvad-browser")
local protonvpn_state
protonvpn_state=$(_state "protonvpn")
items+=(
"chromium" "Chromium web browser" "$chromium_state"
"dillo" "Lightweight graphical browser" "$dillo_state"
"epiphany-browser" "GNOME web browser" "$epiphany_state"
"falkon" "KDE web browser (QtWebEngine)" "$falkon_state"
"firefox" "Firefox from Mozilla (replaces ESR)" "$firefox_state"
"firefox-esr" "Firefox ESR (official Debian + locale auto)" "$firefox_esr_state"
"floorp" "Firefox-based browser (extrepo)" "$floorp_state"
"konqueror" "KDE file manager / web browser" "$konqueror_state"
"librewolf" "Privacy-focused Firefox fork (extrepo)" "$librewolf_state"
"palemoon" "Classic Firefox-derived browser (extrepo)" "$palemoon_state"
"privacybrowser" "Privacy-focused web browser" "$privacybrowser_state"
"qutebrowser" "Keyboard-driven browser (Qt)" "$qutebrowser_state"
"thunderbird" "Email client" "$thunderbird_state"
"torbrowser-launcher" "Tor Browser launcher" "$torbrowser_state"
"mullvad-browser" "Mullvad privacy browser" "$mullvadbrowser_state"
"protonvpn" "ProtonVPN client" "$protonvpn_state"
)
fi
local elinks_state
elinks_state=$(_state "elinks")
local riseupvpn_state
riseupvpn_state=$(_state "riseup-vpn")
local w3m_state
w3m_state=$(_state "w3m")
local tailscale_state
tailscale_state=$(_state "tailscale")
local mullvad_state
mullvad_state=$(_state "mullvad-vpn")
items+=(
"elinks" "Text-mode web browser" "$elinks_state"
"riseup-vpn" "Riseup VPN client" "$riseupvpn_state"
"w3m" "Text-mode browser + deps (w3m-img)" "$w3m_state"
"tailscale" "Zero-config VPN & mesh networking" "$tailscale_state"
"mullvad-vpn" "Mullvad VPN client (WireGuard)" "$mullvad_state"
)
local item_count=${#items[@]}
local lista_alto=$((item_count > TUI_ALTO_LISTA ? TUI_ALTO_LISTA : item_count))
local choices
choices=$(
_checklist "Internet" "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $lista_alto \
"${items[@]}"
)
clear
[ -z "$choices" ] && return
local cleaned
cleaned=$(echo "$choices" | tr -d '"')
local has_firefox=false
local has_firefox_esr=false
local fchoice=""
# BH-004: Convert to array to avoid word splitting and injection.
local -a _pkgs=()
while IFS= read -r _pkg; do
[ -n "$_pkg" ] && _pkgs+=("$_pkg")
done < <(echo "$cleaned" | tr ' ' '\n')
for _p in "${_pkgs[@]}"; do
[ "$_p" = "firefox" ] && has_firefox=true
[ "$_p" = "firefox-esr" ] && has_firefox_esr=true
done
if $has_firefox && $has_firefox_esr; then
fchoice=$(_menu "Firefox" "You selected both Firefox (Mozilla) and Firefox ESR.\nWhat do you want to do?" 12 60 3 \
"mozilla" "Remove Firefox ESR — keep Firefox" \
"esr" "Remove Firefox — keep Firefox ESR" \
"both" "Keep both variants")
[ -z "$fchoice" ] && return
case "$fchoice" in
mozilla) cleaned=$(printf '%s\n' "${_pkgs[@]}" | grep -vx "firefox-esr" | tr '\n' ' ') ;;
esr) cleaned=$(printf '%s\n' "${_pkgs[@]}" | grep -vx "firefox" | tr '\n' ' ') ;;
esac
fi
# BH-004: Convert to array to avoid word splitting and injection.
local -a _pkgs=()
while IFS= read -r _pkg; do
[ -n "$_pkg" ] && _pkgs+=("$_pkg")
done < <(echo "$cleaned" | tr ' ' '\n')
# Pre-apply summary: confirm the selection once,
# before any apt transaction starts.
_confirm_install_list "Internet" "${_pkgs[@]}" || return
for pkg in "${_pkgs[@]}"; do
case $pkg in
firefox)
install_firefox_mozilla "$fchoice"
;;
firefox-esr)
install_firefox_esr "$fchoice"
;;
floorp)
_enable_floorp_repo
_run_install floorp
echo -e "${GREEN}Floorp installed.${NC}"
;;
librewolf)
_enable_librewolf_repo
_run_install librewolf
echo -e "${GREEN}LibreWolf installed.${NC}"
;;
palemoon)
install_palemoon
;;
tailscale)
_enable_tailscale_repo
_run_install tailscale
echo -e "${GREEN}Tailscale installed.${NC}"
;;
mullvad-vpn)
_enable_mullvad_repo
_run_install mullvad-vpn
echo -e "${GREEN}Mullvad VPN installed.${NC}"
;;
mullvad-browser)
_enable_mullvad_repo
_run_install mullvad-browser
echo -e "${GREEN}Mullvad Browser installed.${NC}"
;;
protonvpn)
install_protonvpn
;;
riseup-vpn)
install_backports_or_stable riseup-vpn
;;
w3m)
local need=()
! is_installed "w3m" && need+=("w3m")
! is_installed "w3m-img" && need+=("w3m-img")
! is_installed "ca-certificates" && need+=("ca-certificates")
! is_installed "xsel" && need+=("xsel")
if [ ${#need[@]} -gt 0 ]; then
_run_install_batch "${need[@]}"
else
echo "w3m already installed."
fi
;;
*)
if ! is_installed "$pkg"; then
_run_install "$pkg"
else
echo "$pkg already installed."
fi
;;
esac
done
# Release the per-package prompt suppression.
_SELECTION_CONFIRMED=0
echo -e "${GREEN}Internet tools installed.${NC}"
}
install_firefox_mozilla() {
local fchoice="${1:-}"
if [ "$DEBIAN_VERSION" -lt 12 ] 2>/dev/null; then
_msg "Firefox" "Mozilla Firefox is only available on\nDebian 12 (Bookworm) and 13 (Trixie).\n\nSkipping installation." 10 60
return 1
fi
if command -v firefox &>/dev/null && ! is_installed "firefox-esr"; then
echo "Firefox (Mozilla) is already installed."
return
fi
if is_installed "firefox-esr"; then
case "$fchoice" in
both)
echo -e "${CYAN}[INFO] Keeping Firefox ESR (both selected).${NC}"
;;
mozilla)
echo "Removing Firefox ESR (as selected)..."
sudo apt remove -y firefox-esr
;;
*)
if _confirm "Firefox ESR" "Firefox ESR is installed.\nRemove it before installing Mozilla Firefox?"; then
echo "Removing Firefox ESR..."
sudo apt remove -y firefox-esr
else
echo "Keeping Firefox ESR."
return
fi
;;
esac
fi
_enable_mozilla_repo
_run_cmd "Firefox" "sudo apt install -y firefox" "Installing Firefox (Mozilla)..."
echo -e "${GREEN}Firefox (Mozilla) installed.${NC}"
}
install_firefox_esr() {
local fchoice="${1:-}"
if is_installed "firefox-esr"; then
echo "Firefox ESR is already installed."
return
fi
if command -v firefox &>/dev/null; then
case "$fchoice" in
both)
echo -e "${CYAN}[INFO] Keeping Mozilla Firefox (both selected).${NC}"
;;
esr)
echo "Removing Mozilla Firefox (as selected)..."
sudo apt remove -y firefox
;;
*)
if _confirm "Firefox" "Mozilla Firefox is installed.\nRemove it before installing Firefox ESR?"; then
echo "Removing Mozilla Firefox..."
sudo apt remove -y firefox
else
echo "Keeping Mozilla Firefox."
return
fi
;;
esac
fi
_run_cmd "Firefox ESR" "sudo apt install -y firefox-esr" "Installing Firefox ESR..."
local lang_pkg
lang_pkg=$(_detect_lang_pkg "firefox-esr-l10n")
if [ -n "$lang_pkg" ]; then
_run_cmd "Firefox ESR Locale" "sudo apt install -y ${lang_pkg}" \
"Installing locale: ${lang_pkg}..."
else
echo "No matching locale package found for your language."
fi
echo -e "${GREEN}Firefox ESR installed.${NC}"
}