#!/bin/bash

################################################################################
# install-firefox-official.sh -- Revision: 1.0 by Manuel Rosa (manuelsilvarosa@gmail.com)
# (GNU/General Public License version 3.0)
# This script installs Firefox on Debian using the official repository.
################################################################################

# Script functions
function add_mozilla_repository() {
  echo "deb http://mirrors.mozilla.org/firefox/ppa/stable focal main" | sudo tee /etc/apt/sources.list.d/firefox-ppa.list
}

function import_mozilla_gpg_key() {
  sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9577B98D
}

function update_apt_cache() {
  sudo apt-get update
}

function install_firefox() {
  sudo apt-get install firefox
}

function main() {
  add_mozilla_repository
  import_mozilla_gpg_key
  update_apt_cache
  install_firefox
}

# Script execution
main

echo "Firefox has been installed successfully."
