Last active
June 8, 2022 04:22
-
-
Save wbotelhos/3899743 to your computer and use it in GitHub Desktop.
Firefox Install (Ubuntu)
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 | |
set -e | |
# Firefox launcher containing a Profile migration helper for | |
# temporary profiles used during alpha and beta phases. | |
# Authors: | |
# Alexander Sack <asac@jwsdot.com> | |
# Fabien Tassin <fta@sofaraway.org> | |
# Steve Langasek <steve.langasek@canonical.com> | |
# Chris Coulson <chris.coulson@canonical.com> | |
# License: GPLv2 or later | |
MOZ_LIBDIR=/usr/lib/firefox | |
MOZ_APP_LAUNCHER=`which $0` | |
MOZ_APP_NAME=firefox | |
MOZ_DEFAULT_PROFILEDIR=.mozilla/firefox | |
MOZ_PROFILEDIR=.mozilla/firefox | |
export MOZ_APP_LAUNCHER | |
while [ ! -x $MOZ_LIBDIR/$MOZ_APP_NAME ] ; do | |
if [ -L "$MOZ_APP_LAUNCHER" ] ; then | |
MOZ_APP_LAUNCHER=`readlink -f $MOZ_APP_LAUNCHER` | |
MOZ_LIBDIR=`dirname $MOZ_APP_LAUNCHER` | |
else | |
echo "Can't find $MOZ_LIBDIR/$MOZ_APP_NAME" | |
exit 1 | |
fi | |
done | |
usage () { | |
$MOZ_LIBDIR/$MOZ_APP_NAME -h | sed -e 's,/.*/,,' | |
echo | |
echo " -g or --debug Start within debugger" | |
echo " -d or --debugger Specify debugger to start with (eg, gdb or valgrind)" | |
echo " -a or --debugger-args Specify arguments for debugger" | |
} | |
moz_debug=0 | |
moz_debugger_args="" | |
moz_debugger="gdb" | |
while [ $# -gt 0 ]; do | |
case "$1" in | |
-h | --help ) | |
usage | |
exit 0 | |
;; | |
-g | --debug ) | |
moz_debug=1 | |
shift | |
;; | |
-d | --debugger) | |
moz_debugger=$2; | |
if [ "${moz_debugger}" != "" ]; then | |
shift 2 | |
else | |
echo "-d requires an argument" | |
exit 1 | |
fi | |
;; | |
-a | --debugger-args ) | |
moz_debugger_args=$2; | |
if [ "${moz_debugger_args}" != "" ] ; then | |
shift 2 | |
else | |
echo "-a requires an argument" | |
exit 1 | |
fi | |
;; | |
-- ) # Stop option processing | |
shift | |
break | |
;; | |
* ) | |
break | |
;; | |
esac | |
done | |
if [ $moz_debug -eq 1 ] ; then | |
case $moz_debugger in | |
memcheck) | |
debugger="valgrind" | |
;; | |
*) | |
debugger=$moz_debugger | |
;; | |
esac | |
debugger=`which $debugger` | |
if [ ! -x $debugger ] ; then | |
echo "Invalid debugger" | |
exit 1 | |
fi | |
case `basename $moz_debugger` in | |
gdb) | |
exec $debugger $moz_debugger_args --args $MOZ_LIBDIR/$MOZ_APP_NAME "$@" | |
;; | |
memcheck) | |
echo "$MOZ_APP_NAME has not been compiled with valgrind support" | |
exit 1 | |
;; | |
*) | |
exec $debugger $moz_debugger_args $MOZ_LIBDIR/$MOZ_APP_NAME "$@" | |
;; | |
esac | |
else | |
exec $MOZ_LIBDIR/$MOZ_APP_NAME "$@" | |
fi |
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/bash | |
VERSION='15.0.1' | |
FILE="firefox-$VERSION.tar.bz2" | |
ARCH=`uname -m` | |
RELEASES='ftp.mozilla.org/pub/mozilla.org/firefox/releases' | |
TO='/var/lib' | |
FILE_PATH="$TO/$FILE" | |
EXEC='firefox/firefox' | |
GREEN='\033[0;32m' | |
RED='\033[1;31m' | |
NO_COLOR='\033[1;0m' | |
export LANGUAGE='en-US' | |
export LC_ALL='en_US.UTF-8' | |
export LANG='en-US' | |
if [ -d "$TO/firefox" ]; then | |
echo -e "${GREEN}Removing the current installed version of Firefox...${NO_COLOR}" | |
sudo apt-get purge firefox firefox-globalmenu firefox-gnome-support | |
sudo apt-get autoremove | |
fi | |
echo -e "${GREEN}Going to home${NO_COLOR}" | |
cd $HOME | |
if [ ! -e $FILE ]; then | |
echo -e "${GREEN}Downloading the file ($RELEASES/$VERSION/linux-$ARCH/$LANG/$FILE)...${NO_COLOR}" | |
wget "$RELEASES/$VERSION/linux-$ARCH/$LANG/$FILE" | |
fi | |
if [ ! -e $FILE ]; then | |
echo -e "${RED}The download was failed!${NO_COLOR}" | |
echo -e "${RED}Check if that version was released on site: http://$RELEASES ${NO_COLOR}" | |
exit 1 | |
fi | |
echo -e "${GREEN}Extracting the zip file${NO_COLOR}" | |
tar -jxf $FILE | |
echo -e "${GREEN}Moving the folder firefox to /var/lib${NO_COLOR}" | |
if [ -d "$TO/firefox" ]; then | |
sudo rm -rf $TO/firefox | |
fi | |
sudo mv -f firefox $TO/firefox | |
echo -e "${GREEN}Applying the permissions${NO_COLOR}" | |
sudo chmod +x $TO/$EXEC | |
echo -e "${GREEN}Creating the /usr/lib/firefox symbolic link to /var/lib${NO_COLOR}" | |
cd /usr/lib | |
if [ -f 'firefox' ]; then | |
sudo rm firefox | |
fi | |
sudo ln -s /var/lib/firefox firefox | |
echo -e "${GREEN}Downloading the firefox.sh launcher${NO_COLOR}" | |
cd $TO/firefox | |
wget "https://gist.github.com/wbotelhos/3899743/raw/e769802e9242999ab837e6620f093e110fb10f5e/firefox.sh" | |
chmod +x firefox.sh | |
echo -e "${GREEN}Creating the launcher link on /usr/bin${NO_COLOR}" | |
cd /usr/bin | |
if [ -f 'firefox' ]; then | |
sudo rm firefox | |
fi | |
sudo ln -s $TO/firefox/firefox.sh firefox | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment