bubbles/iso_configs/hooks/normal/debld_64/install-firefox-latest.hook...

43 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
# Script adapted for use as a hook in Debian Live-Build
# to install and allow automatic updates for Firefox
# Set default locale to English (US)
locale="en-US"
# Download the latest version of Firefox
firefox_version=$(curl -sL "https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=${locale}" | grep -o 'firefox-[0-9.]*.tar.bz2' | sed 's/firefox-//g' | sed 's/.tar.bz2//g')
firefox_filename="firefox-${firefox_version}.tar.bz2"
wget -O /tmp/${firefox_filename} "https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=${locale}"
# Extract and install Firefox
tar -C /opt -xvf /tmp/${firefox_filename}
# Create a symbolic link for Firefox
ln -sf /opt/firefox/firefox /usr/bin/firefox
# Set permissions to allow automatic updates
# Grant write permissions to the group and others (non-root users).
# This allows Firefox to update itself while maintaining system security.
chmod -R 775 /opt/firefox
# Ensure the directory is owned by a user who can perform updates,
# typically it is good practice to associate it with the group of the users who will use the system.
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
echo "Firefox latest installed successfully and is ready for auto-updates."