update firefox install hook
This commit is contained in:
parent
4f3b8ac730
commit
750a16da2f
130
iso_configs/hooks/normal/debld_32/install-firefox-latest.hook.chroot
Executable file → Normal file
130
iso_configs/hooks/normal/debld_32/install-firefox-latest.hook.chroot
Executable file → Normal file
|
@ -1,92 +1,62 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Script for use as a hook in Debian Live-Build
|
# Script to be used as a hook in Debian Live-Build
|
||||||
# to install Firefox with all available language packs
|
# to install Firefox from the official Mozilla repository along with all available language packs
|
||||||
# Supports both 32-bit and 64-bit architectures
|
|
||||||
|
|
||||||
# Function to download and install Firefox
|
# Function to set up the Mozilla repository and GPG key
|
||||||
install_firefox() {
|
setup_repository_and_key() {
|
||||||
local architecture="$1"
|
echo "Setting up Mozilla repository and GPG key for Firefox..."
|
||||||
local default_locale="en-US"
|
|
||||||
|
|
||||||
# Determine the appropriate URL and file paths based on architecture
|
# Create directory to store the APT repository keyring if it doesn't exist
|
||||||
if [ "$architecture" == "32bit" ]; then
|
install -d -m 0755 /etc/apt/keyrings
|
||||||
arch_url="linux"
|
|
||||||
lang_pack_arch="linux-i686"
|
# Import the Mozilla APT repository authentication key
|
||||||
|
wget -q https://packages.mozilla.org/apt/repo-signing-key.gpg -O- | tee /etc/apt/keyrings/packages.mozilla.org.asc > /dev/null
|
||||||
|
|
||||||
|
# Verify the GPG key fingerprint
|
||||||
|
expected_fingerprint="35BAA0B33E9EB396F59CA838C0BA5CE6DC6315A3"
|
||||||
|
actual_fingerprint=$(gpg -n -q --import --import-options import-show /etc/apt/keyrings/packages.mozilla.org.asc | awk '/pub/{getline; gsub(/^ +| +$/,""); print $0}')
|
||||||
|
|
||||||
|
if [ "$actual_fingerprint" == "$expected_fingerprint" ]; then
|
||||||
|
echo "The GPG key fingerprint matches: $actual_fingerprint."
|
||||||
else
|
else
|
||||||
arch_url="linux64"
|
echo "Verification failed: the GPG key fingerprint ($actual_fingerprint) does not match the expected one ($expected_fingerprint)."
|
||||||
lang_pack_arch="linux-x86_64"
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# URL to download the latest Firefox
|
# Add the Mozilla APT repository to the sources list
|
||||||
firefox_url="https://download.mozilla.org/?product=firefox-latest&os=${arch_url}&lang=${default_locale}"
|
echo "deb [signed-by=/etc/apt/keyrings/packages.mozilla.org.asc] https://packages.mozilla.org/apt mozilla main" > /etc/apt/sources.list.d/mozilla.list
|
||||||
|
|
||||||
# Get the latest version number
|
# Configure APT to prioritize packages from the Mozilla repository
|
||||||
firefox_version=$(curl -sL ${firefox_url} | grep -o 'firefox-[0-9.]*.tar.bz2' | sed 's/firefox-//g' | sed 's/.tar.bz2//g')
|
echo '
|
||||||
|
Package: *
|
||||||
|
Pin: origin packages.mozilla.org
|
||||||
|
Pin-Priority: 1000
|
||||||
|
' > /etc/apt/preferences.d/mozilla
|
||||||
|
|
||||||
# Construct the filename for download
|
# Update the package list
|
||||||
firefox_filename="firefox-${firefox_version}.tar.bz2"
|
apt-get update
|
||||||
|
|
||||||
# Download the latest version of Firefox
|
|
||||||
wget -O /tmp/${firefox_filename} ${firefox_url}
|
|
||||||
|
|
||||||
# Extract and install Firefox to /opt/firefox
|
|
||||||
tar -C /opt -xvf /tmp/${firefox_filename}
|
|
||||||
|
|
||||||
# Create a symbolic link for Firefox in /usr/bin
|
|
||||||
ln -sf /opt/firefox/firefox /usr/bin/firefox
|
|
||||||
|
|
||||||
# Set permissions to allow automatic updates
|
|
||||||
chmod -R 775 /opt/firefox
|
|
||||||
chown -R root:users /opt/firefox
|
|
||||||
|
|
||||||
# Create a .desktop entry for Firefox
|
|
||||||
echo "[Desktop Entry]
|
|
||||||
Name=Firefox
|
|
||||||
Comment=Web Browser
|
|
||||||
GenericName=Web Browser
|
|
||||||
Exec=/usr/bin/firefox
|
|
||||||
Icon=firefox
|
|
||||||
Terminal=false
|
|
||||||
Type=Application
|
|
||||||
Categories=Network;WebBrowser;
|
|
||||||
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;
|
|
||||||
StartupNotify=true" > /usr/share/applications/firefox.desktop
|
|
||||||
|
|
||||||
# Download and install all available language packs
|
|
||||||
lang_pack_base_url="https://archive.mozilla.org/pub/firefox/releases/${firefox_version}/${lang_pack_arch}/xpi"
|
|
||||||
tmp_dir="/tmp/firefox-languages"
|
|
||||||
|
|
||||||
# Create a temporary directory for language packs
|
|
||||||
mkdir -p ${tmp_dir}
|
|
||||||
|
|
||||||
# List of all language codes available for Firefox
|
|
||||||
lang_codes=$(curl -sL ${lang_pack_base_url}/ | grep -oP 'href="\K[^"]+?\.xpi' | sed 's/\.xpi//')
|
|
||||||
|
|
||||||
# Loop through each language code and download the language pack
|
|
||||||
for lang_code in ${lang_codes}; do
|
|
||||||
wget -O ${tmp_dir}/${lang_code}.xpi ${lang_pack_base_url}/${lang_code}.xpi
|
|
||||||
done
|
|
||||||
|
|
||||||
# Create the directory for language packs in the Firefox installation
|
|
||||||
lang_pack_dir="/opt/firefox/browser/extensions"
|
|
||||||
|
|
||||||
# Move all language packs to the Firefox extensions directory
|
|
||||||
mkdir -p ${lang_pack_dir}
|
|
||||||
mv ${tmp_dir}/*.xpi ${lang_pack_dir}
|
|
||||||
|
|
||||||
# Clean up the temporary directory
|
|
||||||
rm -rf ${tmp_dir}
|
|
||||||
|
|
||||||
echo "Firefox latest ${architecture} installed successfully with all language packs and is ready for auto-updates."
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Detect system architecture and install the appropriate version
|
# Function to install Firefox and available language packs
|
||||||
if [ "$(uname -m)" == "x86_64" ]; then
|
install_firefox() {
|
||||||
echo "Installing Firefox for 64-bit architecture"
|
echo "Installing Firefox and its language packs..."
|
||||||
install_firefox "64bit"
|
|
||||||
else
|
# Install Firefox
|
||||||
echo "Installing Firefox for 32-bit architecture"
|
apt-get install -y firefox
|
||||||
install_firefox "32bit"
|
|
||||||
fi
|
# Install all available Firefox language packs
|
||||||
|
apt-get install -y $(apt-cache search firefox-l10n | awk '{print $1}')
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main execution of the script
|
||||||
|
main() {
|
||||||
|
setup_repository_and_key
|
||||||
|
install_firefox
|
||||||
|
|
||||||
|
echo "Firefox installation completed."
|
||||||
|
}
|
||||||
|
|
||||||
|
# Execute the main function
|
||||||
|
main
|
||||||
|
|
||||||
|
|
130
iso_configs/hooks/normal/debld_64/install-firefox-latest.hook.chroot
Executable file → Normal file
130
iso_configs/hooks/normal/debld_64/install-firefox-latest.hook.chroot
Executable file → Normal file
|
@ -1,92 +1,62 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Script for use as a hook in Debian Live-Build
|
# Script to be used as a hook in Debian Live-Build
|
||||||
# to install Firefox with all available language packs
|
# to install Firefox from the official Mozilla repository along with all available language packs
|
||||||
# Supports both 32-bit and 64-bit architectures
|
|
||||||
|
|
||||||
# Function to download and install Firefox
|
# Function to set up the Mozilla repository and GPG key
|
||||||
install_firefox() {
|
setup_repository_and_key() {
|
||||||
local architecture="$1"
|
echo "Setting up Mozilla repository and GPG key for Firefox..."
|
||||||
local default_locale="en-US"
|
|
||||||
|
|
||||||
# Determine the appropriate URL and file paths based on architecture
|
# Create directory to store the APT repository keyring if it doesn't exist
|
||||||
if [ "$architecture" == "32bit" ]; then
|
install -d -m 0755 /etc/apt/keyrings
|
||||||
arch_url="linux"
|
|
||||||
lang_pack_arch="linux-i686"
|
# Import the Mozilla APT repository authentication key
|
||||||
|
wget -q https://packages.mozilla.org/apt/repo-signing-key.gpg -O- | tee /etc/apt/keyrings/packages.mozilla.org.asc > /dev/null
|
||||||
|
|
||||||
|
# Verify the GPG key fingerprint
|
||||||
|
expected_fingerprint="35BAA0B33E9EB396F59CA838C0BA5CE6DC6315A3"
|
||||||
|
actual_fingerprint=$(gpg -n -q --import --import-options import-show /etc/apt/keyrings/packages.mozilla.org.asc | awk '/pub/{getline; gsub(/^ +| +$/,""); print $0}')
|
||||||
|
|
||||||
|
if [ "$actual_fingerprint" == "$expected_fingerprint" ]; then
|
||||||
|
echo "The GPG key fingerprint matches: $actual_fingerprint."
|
||||||
else
|
else
|
||||||
arch_url="linux64"
|
echo "Verification failed: the GPG key fingerprint ($actual_fingerprint) does not match the expected one ($expected_fingerprint)."
|
||||||
lang_pack_arch="linux-x86_64"
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# URL to download the latest Firefox
|
# Add the Mozilla APT repository to the sources list
|
||||||
firefox_url="https://download.mozilla.org/?product=firefox-latest&os=${arch_url}&lang=${default_locale}"
|
echo "deb [signed-by=/etc/apt/keyrings/packages.mozilla.org.asc] https://packages.mozilla.org/apt mozilla main" > /etc/apt/sources.list.d/mozilla.list
|
||||||
|
|
||||||
# Get the latest version number
|
# Configure APT to prioritize packages from the Mozilla repository
|
||||||
firefox_version=$(curl -sL ${firefox_url} | grep -o 'firefox-[0-9.]*.tar.bz2' | sed 's/firefox-//g' | sed 's/.tar.bz2//g')
|
echo '
|
||||||
|
Package: *
|
||||||
|
Pin: origin packages.mozilla.org
|
||||||
|
Pin-Priority: 1000
|
||||||
|
' > /etc/apt/preferences.d/mozilla
|
||||||
|
|
||||||
# Construct the filename for download
|
# Update the package list
|
||||||
firefox_filename="firefox-${firefox_version}.tar.bz2"
|
apt-get update
|
||||||
|
|
||||||
# Download the latest version of Firefox
|
|
||||||
wget -O /tmp/${firefox_filename} ${firefox_url}
|
|
||||||
|
|
||||||
# Extract and install Firefox to /opt/firefox
|
|
||||||
tar -C /opt -xvf /tmp/${firefox_filename}
|
|
||||||
|
|
||||||
# Create a symbolic link for Firefox in /usr/bin
|
|
||||||
ln -sf /opt/firefox/firefox /usr/bin/firefox
|
|
||||||
|
|
||||||
# Set permissions to allow automatic updates
|
|
||||||
chmod -R 775 /opt/firefox
|
|
||||||
chown -R root:users /opt/firefox
|
|
||||||
|
|
||||||
# Create a .desktop entry for Firefox
|
|
||||||
echo "[Desktop Entry]
|
|
||||||
Name=Firefox
|
|
||||||
Comment=Web Browser
|
|
||||||
GenericName=Web Browser
|
|
||||||
Exec=/usr/bin/firefox
|
|
||||||
Icon=firefox
|
|
||||||
Terminal=false
|
|
||||||
Type=Application
|
|
||||||
Categories=Network;WebBrowser;
|
|
||||||
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;
|
|
||||||
StartupNotify=true" > /usr/share/applications/firefox.desktop
|
|
||||||
|
|
||||||
# Download and install all available language packs
|
|
||||||
lang_pack_base_url="https://archive.mozilla.org/pub/firefox/releases/${firefox_version}/${lang_pack_arch}/xpi"
|
|
||||||
tmp_dir="/tmp/firefox-languages"
|
|
||||||
|
|
||||||
# Create a temporary directory for language packs
|
|
||||||
mkdir -p ${tmp_dir}
|
|
||||||
|
|
||||||
# List of all language codes available for Firefox
|
|
||||||
lang_codes=$(curl -sL ${lang_pack_base_url}/ | grep -oP 'href="\K[^"]+?\.xpi' | sed 's/\.xpi//')
|
|
||||||
|
|
||||||
# Loop through each language code and download the language pack
|
|
||||||
for lang_code in ${lang_codes}; do
|
|
||||||
wget -O ${tmp_dir}/${lang_code}.xpi ${lang_pack_base_url}/${lang_code}.xpi
|
|
||||||
done
|
|
||||||
|
|
||||||
# Create the directory for language packs in the Firefox installation
|
|
||||||
lang_pack_dir="/opt/firefox/browser/extensions"
|
|
||||||
|
|
||||||
# Move all language packs to the Firefox extensions directory
|
|
||||||
mkdir -p ${lang_pack_dir}
|
|
||||||
mv ${tmp_dir}/*.xpi ${lang_pack_dir}
|
|
||||||
|
|
||||||
# Clean up the temporary directory
|
|
||||||
rm -rf ${tmp_dir}
|
|
||||||
|
|
||||||
echo "Firefox latest ${architecture} installed successfully with all language packs and is ready for auto-updates."
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Detect system architecture and install the appropriate version
|
# Function to install Firefox and available language packs
|
||||||
if [ "$(uname -m)" == "x86_64" ]; then
|
install_firefox() {
|
||||||
echo "Installing Firefox for 64-bit architecture"
|
echo "Installing Firefox and its language packs..."
|
||||||
install_firefox "64bit"
|
|
||||||
else
|
# Install Firefox
|
||||||
echo "Installing Firefox for 32-bit architecture"
|
apt-get install -y firefox
|
||||||
install_firefox "32bit"
|
|
||||||
fi
|
# Install all available Firefox language packs
|
||||||
|
apt-get install -y $(apt-cache search firefox-l10n | awk '{print $1}')
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main execution of the script
|
||||||
|
main() {
|
||||||
|
setup_repository_and_key
|
||||||
|
install_firefox
|
||||||
|
|
||||||
|
echo "Firefox installation completed."
|
||||||
|
}
|
||||||
|
|
||||||
|
# Execute the main function
|
||||||
|
main
|
||||||
|
|
||||||
|
|
130
iso_configs/hooks/normal/devld_32/install-firefox-latest.hook.chroot
Executable file → Normal file
130
iso_configs/hooks/normal/devld_32/install-firefox-latest.hook.chroot
Executable file → Normal file
|
@ -1,92 +1,62 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Script for use as a hook in Debian Live-Build
|
# Script to be used as a hook in Debian Live-Build
|
||||||
# to install Firefox with all available language packs
|
# to install Firefox from the official Mozilla repository along with all available language packs
|
||||||
# Supports both 32-bit and 64-bit architectures
|
|
||||||
|
|
||||||
# Function to download and install Firefox
|
# Function to set up the Mozilla repository and GPG key
|
||||||
install_firefox() {
|
setup_repository_and_key() {
|
||||||
local architecture="$1"
|
echo "Setting up Mozilla repository and GPG key for Firefox..."
|
||||||
local default_locale="en-US"
|
|
||||||
|
|
||||||
# Determine the appropriate URL and file paths based on architecture
|
# Create directory to store the APT repository keyring if it doesn't exist
|
||||||
if [ "$architecture" == "32bit" ]; then
|
install -d -m 0755 /etc/apt/keyrings
|
||||||
arch_url="linux"
|
|
||||||
lang_pack_arch="linux-i686"
|
# Import the Mozilla APT repository authentication key
|
||||||
|
wget -q https://packages.mozilla.org/apt/repo-signing-key.gpg -O- | tee /etc/apt/keyrings/packages.mozilla.org.asc > /dev/null
|
||||||
|
|
||||||
|
# Verify the GPG key fingerprint
|
||||||
|
expected_fingerprint="35BAA0B33E9EB396F59CA838C0BA5CE6DC6315A3"
|
||||||
|
actual_fingerprint=$(gpg -n -q --import --import-options import-show /etc/apt/keyrings/packages.mozilla.org.asc | awk '/pub/{getline; gsub(/^ +| +$/,""); print $0}')
|
||||||
|
|
||||||
|
if [ "$actual_fingerprint" == "$expected_fingerprint" ]; then
|
||||||
|
echo "The GPG key fingerprint matches: $actual_fingerprint."
|
||||||
else
|
else
|
||||||
arch_url="linux64"
|
echo "Verification failed: the GPG key fingerprint ($actual_fingerprint) does not match the expected one ($expected_fingerprint)."
|
||||||
lang_pack_arch="linux-x86_64"
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# URL to download the latest Firefox
|
# Add the Mozilla APT repository to the sources list
|
||||||
firefox_url="https://download.mozilla.org/?product=firefox-latest&os=${arch_url}&lang=${default_locale}"
|
echo "deb [signed-by=/etc/apt/keyrings/packages.mozilla.org.asc] https://packages.mozilla.org/apt mozilla main" > /etc/apt/sources.list.d/mozilla.list
|
||||||
|
|
||||||
# Get the latest version number
|
# Configure APT to prioritize packages from the Mozilla repository
|
||||||
firefox_version=$(curl -sL ${firefox_url} | grep -o 'firefox-[0-9.]*.tar.bz2' | sed 's/firefox-//g' | sed 's/.tar.bz2//g')
|
echo '
|
||||||
|
Package: *
|
||||||
|
Pin: origin packages.mozilla.org
|
||||||
|
Pin-Priority: 1000
|
||||||
|
' > /etc/apt/preferences.d/mozilla
|
||||||
|
|
||||||
# Construct the filename for download
|
# Update the package list
|
||||||
firefox_filename="firefox-${firefox_version}.tar.bz2"
|
apt-get update
|
||||||
|
|
||||||
# Download the latest version of Firefox
|
|
||||||
wget -O /tmp/${firefox_filename} ${firefox_url}
|
|
||||||
|
|
||||||
# Extract and install Firefox to /opt/firefox
|
|
||||||
tar -C /opt -xvf /tmp/${firefox_filename}
|
|
||||||
|
|
||||||
# Create a symbolic link for Firefox in /usr/bin
|
|
||||||
ln -sf /opt/firefox/firefox /usr/bin/firefox
|
|
||||||
|
|
||||||
# Set permissions to allow automatic updates
|
|
||||||
chmod -R 775 /opt/firefox
|
|
||||||
chown -R root:users /opt/firefox
|
|
||||||
|
|
||||||
# Create a .desktop entry for Firefox
|
|
||||||
echo "[Desktop Entry]
|
|
||||||
Name=Firefox
|
|
||||||
Comment=Web Browser
|
|
||||||
GenericName=Web Browser
|
|
||||||
Exec=/usr/bin/firefox
|
|
||||||
Icon=firefox
|
|
||||||
Terminal=false
|
|
||||||
Type=Application
|
|
||||||
Categories=Network;WebBrowser;
|
|
||||||
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;
|
|
||||||
StartupNotify=true" > /usr/share/applications/firefox.desktop
|
|
||||||
|
|
||||||
# Download and install all available language packs
|
|
||||||
lang_pack_base_url="https://archive.mozilla.org/pub/firefox/releases/${firefox_version}/${lang_pack_arch}/xpi"
|
|
||||||
tmp_dir="/tmp/firefox-languages"
|
|
||||||
|
|
||||||
# Create a temporary directory for language packs
|
|
||||||
mkdir -p ${tmp_dir}
|
|
||||||
|
|
||||||
# List of all language codes available for Firefox
|
|
||||||
lang_codes=$(curl -sL ${lang_pack_base_url}/ | grep -oP 'href="\K[^"]+?\.xpi' | sed 's/\.xpi//')
|
|
||||||
|
|
||||||
# Loop through each language code and download the language pack
|
|
||||||
for lang_code in ${lang_codes}; do
|
|
||||||
wget -O ${tmp_dir}/${lang_code}.xpi ${lang_pack_base_url}/${lang_code}.xpi
|
|
||||||
done
|
|
||||||
|
|
||||||
# Create the directory for language packs in the Firefox installation
|
|
||||||
lang_pack_dir="/opt/firefox/browser/extensions"
|
|
||||||
|
|
||||||
# Move all language packs to the Firefox extensions directory
|
|
||||||
mkdir -p ${lang_pack_dir}
|
|
||||||
mv ${tmp_dir}/*.xpi ${lang_pack_dir}
|
|
||||||
|
|
||||||
# Clean up the temporary directory
|
|
||||||
rm -rf ${tmp_dir}
|
|
||||||
|
|
||||||
echo "Firefox latest ${architecture} installed successfully with all language packs and is ready for auto-updates."
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Detect system architecture and install the appropriate version
|
# Function to install Firefox and available language packs
|
||||||
if [ "$(uname -m)" == "x86_64" ]; then
|
install_firefox() {
|
||||||
echo "Installing Firefox for 64-bit architecture"
|
echo "Installing Firefox and its language packs..."
|
||||||
install_firefox "64bit"
|
|
||||||
else
|
# Install Firefox
|
||||||
echo "Installing Firefox for 32-bit architecture"
|
apt-get install -y firefox
|
||||||
install_firefox "32bit"
|
|
||||||
fi
|
# Install all available Firefox language packs
|
||||||
|
apt-get install -y $(apt-cache search firefox-l10n | awk '{print $1}')
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main execution of the script
|
||||||
|
main() {
|
||||||
|
setup_repository_and_key
|
||||||
|
install_firefox
|
||||||
|
|
||||||
|
echo "Firefox installation completed."
|
||||||
|
}
|
||||||
|
|
||||||
|
# Execute the main function
|
||||||
|
main
|
||||||
|
|
||||||
|
|
130
iso_configs/hooks/normal/devld_64/install-firefox-latest.hook.chroot
Executable file → Normal file
130
iso_configs/hooks/normal/devld_64/install-firefox-latest.hook.chroot
Executable file → Normal file
|
@ -1,92 +1,62 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Script for use as a hook in Debian Live-Build
|
# Script to be used as a hook in Debian Live-Build
|
||||||
# to install Firefox with all available language packs
|
# to install Firefox from the official Mozilla repository along with all available language packs
|
||||||
# Supports both 32-bit and 64-bit architectures
|
|
||||||
|
|
||||||
# Function to download and install Firefox
|
# Function to set up the Mozilla repository and GPG key
|
||||||
install_firefox() {
|
setup_repository_and_key() {
|
||||||
local architecture="$1"
|
echo "Setting up Mozilla repository and GPG key for Firefox..."
|
||||||
local default_locale="en-US"
|
|
||||||
|
|
||||||
# Determine the appropriate URL and file paths based on architecture
|
# Create directory to store the APT repository keyring if it doesn't exist
|
||||||
if [ "$architecture" == "32bit" ]; then
|
install -d -m 0755 /etc/apt/keyrings
|
||||||
arch_url="linux"
|
|
||||||
lang_pack_arch="linux-i686"
|
# Import the Mozilla APT repository authentication key
|
||||||
|
wget -q https://packages.mozilla.org/apt/repo-signing-key.gpg -O- | tee /etc/apt/keyrings/packages.mozilla.org.asc > /dev/null
|
||||||
|
|
||||||
|
# Verify the GPG key fingerprint
|
||||||
|
expected_fingerprint="35BAA0B33E9EB396F59CA838C0BA5CE6DC6315A3"
|
||||||
|
actual_fingerprint=$(gpg -n -q --import --import-options import-show /etc/apt/keyrings/packages.mozilla.org.asc | awk '/pub/{getline; gsub(/^ +| +$/,""); print $0}')
|
||||||
|
|
||||||
|
if [ "$actual_fingerprint" == "$expected_fingerprint" ]; then
|
||||||
|
echo "The GPG key fingerprint matches: $actual_fingerprint."
|
||||||
else
|
else
|
||||||
arch_url="linux64"
|
echo "Verification failed: the GPG key fingerprint ($actual_fingerprint) does not match the expected one ($expected_fingerprint)."
|
||||||
lang_pack_arch="linux-x86_64"
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# URL to download the latest Firefox
|
# Add the Mozilla APT repository to the sources list
|
||||||
firefox_url="https://download.mozilla.org/?product=firefox-latest&os=${arch_url}&lang=${default_locale}"
|
echo "deb [signed-by=/etc/apt/keyrings/packages.mozilla.org.asc] https://packages.mozilla.org/apt mozilla main" > /etc/apt/sources.list.d/mozilla.list
|
||||||
|
|
||||||
# Get the latest version number
|
# Configure APT to prioritize packages from the Mozilla repository
|
||||||
firefox_version=$(curl -sL ${firefox_url} | grep -o 'firefox-[0-9.]*.tar.bz2' | sed 's/firefox-//g' | sed 's/.tar.bz2//g')
|
echo '
|
||||||
|
Package: *
|
||||||
|
Pin: origin packages.mozilla.org
|
||||||
|
Pin-Priority: 1000
|
||||||
|
' > /etc/apt/preferences.d/mozilla
|
||||||
|
|
||||||
# Construct the filename for download
|
# Update the package list
|
||||||
firefox_filename="firefox-${firefox_version}.tar.bz2"
|
apt-get update
|
||||||
|
|
||||||
# Download the latest version of Firefox
|
|
||||||
wget -O /tmp/${firefox_filename} ${firefox_url}
|
|
||||||
|
|
||||||
# Extract and install Firefox to /opt/firefox
|
|
||||||
tar -C /opt -xvf /tmp/${firefox_filename}
|
|
||||||
|
|
||||||
# Create a symbolic link for Firefox in /usr/bin
|
|
||||||
ln -sf /opt/firefox/firefox /usr/bin/firefox
|
|
||||||
|
|
||||||
# Set permissions to allow automatic updates
|
|
||||||
chmod -R 775 /opt/firefox
|
|
||||||
chown -R root:users /opt/firefox
|
|
||||||
|
|
||||||
# Create a .desktop entry for Firefox
|
|
||||||
echo "[Desktop Entry]
|
|
||||||
Name=Firefox
|
|
||||||
Comment=Web Browser
|
|
||||||
GenericName=Web Browser
|
|
||||||
Exec=/usr/bin/firefox
|
|
||||||
Icon=firefox
|
|
||||||
Terminal=false
|
|
||||||
Type=Application
|
|
||||||
Categories=Network;WebBrowser;
|
|
||||||
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;
|
|
||||||
StartupNotify=true" > /usr/share/applications/firefox.desktop
|
|
||||||
|
|
||||||
# Download and install all available language packs
|
|
||||||
lang_pack_base_url="https://archive.mozilla.org/pub/firefox/releases/${firefox_version}/${lang_pack_arch}/xpi"
|
|
||||||
tmp_dir="/tmp/firefox-languages"
|
|
||||||
|
|
||||||
# Create a temporary directory for language packs
|
|
||||||
mkdir -p ${tmp_dir}
|
|
||||||
|
|
||||||
# List of all language codes available for Firefox
|
|
||||||
lang_codes=$(curl -sL ${lang_pack_base_url}/ | grep -oP 'href="\K[^"]+?\.xpi' | sed 's/\.xpi//')
|
|
||||||
|
|
||||||
# Loop through each language code and download the language pack
|
|
||||||
for lang_code in ${lang_codes}; do
|
|
||||||
wget -O ${tmp_dir}/${lang_code}.xpi ${lang_pack_base_url}/${lang_code}.xpi
|
|
||||||
done
|
|
||||||
|
|
||||||
# Create the directory for language packs in the Firefox installation
|
|
||||||
lang_pack_dir="/opt/firefox/browser/extensions"
|
|
||||||
|
|
||||||
# Move all language packs to the Firefox extensions directory
|
|
||||||
mkdir -p ${lang_pack_dir}
|
|
||||||
mv ${tmp_dir}/*.xpi ${lang_pack_dir}
|
|
||||||
|
|
||||||
# Clean up the temporary directory
|
|
||||||
rm -rf ${tmp_dir}
|
|
||||||
|
|
||||||
echo "Firefox latest ${architecture} installed successfully with all language packs and is ready for auto-updates."
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Detect system architecture and install the appropriate version
|
# Function to install Firefox and available language packs
|
||||||
if [ "$(uname -m)" == "x86_64" ]; then
|
install_firefox() {
|
||||||
echo "Installing Firefox for 64-bit architecture"
|
echo "Installing Firefox and its language packs..."
|
||||||
install_firefox "64bit"
|
|
||||||
else
|
# Install Firefox
|
||||||
echo "Installing Firefox for 32-bit architecture"
|
apt-get install -y firefox
|
||||||
install_firefox "32bit"
|
|
||||||
fi
|
# Install all available Firefox language packs
|
||||||
|
apt-get install -y $(apt-cache search firefox-l10n | awk '{print $1}')
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main execution of the script
|
||||||
|
main() {
|
||||||
|
setup_repository_and_key
|
||||||
|
install_firefox
|
||||||
|
|
||||||
|
echo "Firefox installation completed."
|
||||||
|
}
|
||||||
|
|
||||||
|
# Execute the main function
|
||||||
|
main
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue