update firefox install hook

This commit is contained in:
manuel 2024-06-16 18:27:16 +00:00
parent 18a44bd13b
commit 0cc3dfae47
4 changed files with 190 additions and 22 deletions

View File

@ -1,15 +1,15 @@
#!/bin/bash #!/bin/bash
# Script adapted for use as a hook in Debian Live-Build # Script adapted for use as a hook in Debian Live-Build
# to install and allow automatic updates for Firefox # to install Firefox with all available language packs
# Set default locale to English (US) # Set default locale to English (US) for initial Firefox download
locale="en-US" default_locale="en-US"
# Download the latest version of Firefox # 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_version=$(curl -sL "https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=${default_locale}" | grep -o 'firefox-[0-9.]*.tar.bz2' | sed 's/firefox-//g' | sed 's/.tar.bz2//g')
firefox_filename="firefox-${firefox_version}.tar.bz2" firefox_filename="firefox-${firefox_version}.tar.bz2"
wget -O /tmp/${firefox_filename} "https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=${locale}" wget -O /tmp/${firefox_filename} "https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=${default_locale}"
# Extract and install Firefox # Extract and install Firefox
tar -C /opt -xvf /tmp/${firefox_filename} tar -C /opt -xvf /tmp/${firefox_filename}
@ -18,12 +18,7 @@ tar -C /opt -xvf /tmp/${firefox_filename}
ln -sf /opt/firefox/firefox /usr/bin/firefox ln -sf /opt/firefox/firefox /usr/bin/firefox
# Set permissions to allow automatic updates # 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 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 chown -R root:users /opt/firefox
# Create a .desktop entry for Firefox # Create a .desktop entry for Firefox
@ -39,4 +34,30 @@ 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; 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 StartupNotify=true" > /usr/share/applications/firefox.desktop
echo "Firefox latest installed successfully and is ready for auto-updates." # Download and install all available language packs
lang_pack_base_url="https://archive.mozilla.org/pub/firefox/releases/${firefox_version}/linux-x86_64/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 installed successfully with all language packs and is ready for auto-updates."

View File

@ -1,15 +1,15 @@
#!/bin/bash #!/bin/bash
# Script adapted for use as a hook in Debian Live-Build # Script adapted for use as a hook in Debian Live-Build
# to install and allow automatic updates for Firefox # to install Firefox with all available language packs
# Set default locale to English (US) # Set default locale to English (US) for initial Firefox download
locale="en-US" default_locale="en-US"
# Download the latest version of Firefox # 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_version=$(curl -sL "https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=${default_locale}" | grep -o 'firefox-[0-9.]*.tar.bz2' | sed 's/firefox-//g' | sed 's/.tar.bz2//g')
firefox_filename="firefox-${firefox_version}.tar.bz2" firefox_filename="firefox-${firefox_version}.tar.bz2"
wget -O /tmp/${firefox_filename} "https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=${locale}" wget -O /tmp/${firefox_filename} "https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=${default_locale}"
# Extract and install Firefox # Extract and install Firefox
tar -C /opt -xvf /tmp/${firefox_filename} tar -C /opt -xvf /tmp/${firefox_filename}
@ -18,12 +18,7 @@ tar -C /opt -xvf /tmp/${firefox_filename}
ln -sf /opt/firefox/firefox /usr/bin/firefox ln -sf /opt/firefox/firefox /usr/bin/firefox
# Set permissions to allow automatic updates # 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 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 chown -R root:users /opt/firefox
# Create a .desktop entry for Firefox # Create a .desktop entry for Firefox
@ -39,4 +34,30 @@ 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; 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 StartupNotify=true" > /usr/share/applications/firefox.desktop
echo "Firefox latest installed successfully and is ready for auto-updates." # Download and install all available language packs
lang_pack_base_url="https://archive.mozilla.org/pub/firefox/releases/${firefox_version}/linux-x86_64/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 installed successfully with all language packs and is ready for auto-updates."

View File

@ -0,0 +1,63 @@
#!/bin/bash
# Script adapted for use as a hook in Debian Live-Build
# to install Firefox with all available language packs
# Set default locale to English (US) for initial Firefox download
default_locale="en-US"
# Download the latest version of Firefox
firefox_version=$(curl -sL "https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=${default_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=${default_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
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}/linux-x86_64/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 installed successfully with all language packs and is ready for auto-updates."

View File

@ -0,0 +1,63 @@
#!/bin/bash
# Script adapted for use as a hook in Debian Live-Build
# to install Firefox with all available language packs
# Set default locale to English (US) for initial Firefox download
default_locale="en-US"
# Download the latest version of Firefox
firefox_version=$(curl -sL "https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=${default_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=${default_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
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}/linux-x86_64/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 installed successfully with all language packs and is ready for auto-updates."