Last active
March 26, 2025 14:19
-
-
Save rubo77/b999c1bc6d10ab802536 to your computer and use it in GitHub Desktop.
a script that downloads a certain Firefox or Thunderbird version and installs it in an extra folder to create an independent and portable App for Linux. source: http://portableapps.com/node/16344
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Configure the following default variables according to your requirements | |
language="en-US" # e.g. "de" or "en-US" | |
if [ ! "$1" ]; then | |
# default if no argument is set: | |
version="95.0" # chose from http://download.cdn.mozilla.net/pub/mozilla.org/firefox/releases/ | |
application="firefox" # "thunderbird" or "firefox" but file extension, archive extraction, and binary | |
fi | |
if [ "$1" = "--help" ] || [ "$1" = "-h" ] ; then | |
echo 'Usage: $0 [application] [version]' | |
echo | |
echo Usage: | |
echo " for example" | |
echo " $0 mozilla 68.5.0esr" | |
echo ' -h --help display this help' | |
exit 0 | |
fi | |
if [ "$1" ] ; then | |
application="$1" | |
fi | |
if [ "$2" ] ; then | |
version="$2" | |
fi | |
echo result $0 $application $version | |
echo "This script downloads | |
-- | |
$application Version $version | |
-- | |
If you want to install another version press Ctrl+C and call this program with other options, for | |
example: $0 $application 68.5.0esr" | |
echo | |
dir="$application-portable-$version" | |
if [ -d "$dir" ]; then | |
echo "the folder $dir already exists, exiting" | |
exit 0 | |
fi | |
read -n1 -r -p "Press space to continue..." key | |
file="$application-$version.tar.bz2" | |
#for 32bit use the first line instead: | |
#url="http://download-origin.cdn.mozilla.net/pub/$application/releases/$version/linux-i686/$language/$file" | |
url="http://download-origin.cdn.mozilla.net/pub/$application/releases/$version/linux-x86_64/$language/$file" | |
# or example for firefox nightly: | |
#file=firefox-32.0a2.en-US.linux-i686.tar.bz2 | |
#url=http://download.cdn.mozilla.net/pub/mozilla.org/firefox/nightly/latest-mozilla-aurora/$file | |
mkdir "$dir" | |
cd "$dir" | |
wget $url -O $file | |
echo "Extracting archive, please wait..." | |
tar xfj $file | |
rm $file | |
mv $application app | |
mkdir data | |
echo '#!/bin/sh' > "${application}-portable" | |
echo 'dir=${0%/*}' >> "${application}-portable" | |
echo 'if [ "$dir" = "$0" ]; then' >> "${application}-portable" | |
echo ' dir="."' >> "${application}-portable" | |
echo 'fi' >> "${application}-portable" | |
echo 'cd "$dir/app"' >> "${application}-portable" | |
echo './firefox --no-remote -profile ../data' >> "${application}-portable" | |
chmod +x "$application-portable" | |
echo ... finished | |
cat <<EOM | |
... finished | |
"#close all running instances of another $application version:" | |
killall $application | |
"#change into the directory" | |
"# and start the application there" | |
cd "$dir" | |
./"$application-portable" | |
EOM |
The list of releases
Firefox - http://download.cdn.mozilla.net/pub/firefox/releases/
Thunderbird - http://download.cdn.mozilla.net/pub/thunderbird/releases/
I added --no-remote and also updated the script to use 64 bit and the latest firefox version by default.
Hi @rubo77. Thanks for the script. I'm trying to download FF version around 3. Tried with 3.0, 3.5.1, 3.6; always get downloading errors like this:
Connecting to download.cdn.mozilla.net (download.cdn.mozilla.net)|23.209.86.45|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2020-03-21 12:07:27 ERROR 404: Not Found.
Extracting archive, please wait...
tar (child): 3.6-.tar.bz2: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
rm: cannot remove '3.6-.tar.bz2': No such file or directory
mv: cannot stat '3.6': No such file or directory
UPD: Answering myself. Have to fix URL to this for older versions:
url="http://download.cdn.mozilla.net/pub/$application/releases/$version/linux-x86_64/$language/$file"
This is awesome!
One quick suggestion:
add echo 'user_pref("app.update.auto", false);' >> data/user.js;
on line 58 to disable auto updates.
Thanks!
@sxiii I updated the gist with the new url
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks! very useful!!
One suggestion is to add
--no-remote
in the firefox command, so that you can run a separate instance if you are already running another version of firefox. so line 63 would be like this:echo './firefox --no-remote -profile ../data' >> "${application}-portable"