#!/bin/bash set -euo pipefail # ============================================================================== # LibreWolf Browser Installation # ============================================================================== # Privacy-focused Firefox fork with enhanced security defaults # - No telemetry # - uBlock Origin pre-installed # - Enhanced tracking protection # - Privacy-respecting search defaults # ============================================================================== # Colors readonly GREEN='\033[0;32m' readonly YELLOW='\033[1;33m' readonly BLUE='\033[0;34m' readonly RED='\033[0;31m' readonly NC='\033[0m' log() { echo -e "${GREEN}[INFO]${NC} $*"; } warn() { echo -e "${YELLOW}[WARN]${NC} $*"; } error() { echo -e "${RED}[ERROR]${NC} $*"; } section() { echo -e "${BLUE}=== $* ===${NC}"; } section "LibreWolf Browser Installation" echo "" # Check if already installed if command -v librewolf &>/dev/null; then log "LibreWolf already installed: $(librewolf --version 2>/dev/null | head -1 || echo 'version check failed')" read -p "Reinstall/upgrade? [y/N] " -n 1 -r echo if [[ ! $REPLY =~ ^[Yy]$ ]]; then log "Skipping installation" exit 0 fi fi # Detect distro if [ -f /etc/os-release ]; then . /etc/os-release DISTRO="${ID:-unknown}" DISTRO_VERSION="${VERSION_CODENAME:-${VERSION_ID:-unknown}}" else error "Cannot detect distribution" exit 1 fi log "Detected: $DISTRO $DISTRO_VERSION" case "$DISTRO" in debian|ubuntu|linuxmint|pop) section "Installing via LibreWolf APT Repository" # Install dependencies log "Installing dependencies..." sudo apt update sudo apt install -y curl gnupg lsb-release apt-transport-https ca-certificates # Add LibreWolf repo log "Adding LibreWolf repository..." # Get the distro codename (LibreWolf uses Debian/Ubuntu codenames) if [[ "$DISTRO" == "debian" ]]; then REPO_CODENAME="$DISTRO_VERSION" elif [[ "$DISTRO" == "ubuntu" || "$DISTRO" == "linuxmint" || "$DISTRO" == "pop" ]]; then # For Ubuntu derivatives, try to get the Ubuntu base codename REPO_CODENAME="$DISTRO_VERSION" else REPO_CODENAME="bookworm" # Fallback to Debian stable fi # Download and add the signing key curl -fsSL https://deb.librewolf.net/keyring.gpg | sudo gpg --dearmor -o /usr/share/keyrings/librewolf.gpg # Add the repository echo "deb [arch=amd64 signed-by=/usr/share/keyrings/librewolf.gpg] https://deb.librewolf.net $REPO_CODENAME main" | \ sudo tee /etc/apt/sources.list.d/librewolf.list > /dev/null # Update and install log "Installing LibreWolf..." sudo apt update sudo apt install -y librewolf ;; fedora|rhel|centos) section "Installing via LibreWolf RPM Repository" # Add LibreWolf repo log "Adding LibreWolf repository..." sudo dnf config-manager --add-repo https://rpm.librewolf.net/librewolf-repo.repo # Install log "Installing LibreWolf..." sudo dnf install -y librewolf ;; arch|manjaro|endeavouros) section "Installing via AUR" if command -v yay &>/dev/null; then log "Installing via yay..." yay -S --noconfirm librewolf-bin elif command -v paru &>/dev/null; then log "Installing via paru..." paru -S --noconfirm librewolf-bin else warn "No AUR helper found (yay/paru)" log "Installing librewolf-bin manually..." cd /tmp git clone https://aur.archlinux.org/librewolf-bin.git cd librewolf-bin makepkg -si --noconfirm cd .. rm -rf librewolf-bin fi ;; *) error "Unsupported distribution: $DISTRO" log "Please install manually from: https://librewolf.net/installation/" exit 1 ;; esac # Verify installation echo "" if command -v librewolf &>/dev/null; then section "Installation Complete!" log "LibreWolf installed successfully" log "Version: $(librewolf --version 2>/dev/null | head -1 || echo 'check manually')" echo "" log "Launch with: librewolf" log "Documentation: https://librewolf.net/" else error "Installation may have failed - librewolf command not found" exit 1 fi echo "" section "Privacy Features Enabled by Default" echo "" cat << 'EOF' - Telemetry completely disabled - uBlock Origin pre-installed - Enhanced Tracking Protection (Strict) - First-party isolation enabled - Fingerprinting protection enabled - HTTPS-Only Mode enabled - WebRTC leak prevention - Privacy-respecting search (DuckDuckGo default) EOF echo ""