Defined 'curl' by default

This commit is contained in:
clamsawd 2015-10-14 18:15:33 +02:00
parent 64d8b6a62e
commit b787264192
2 changed files with 450 additions and 486 deletions

View File

@ -2,19 +2,11 @@
# Script to install Firefox on GNU/Linux # Script to install Firefox on GNU/Linux
# Created by clamsawd (clamsawd@openmailbox.org) # Created by clamsawd (clamsawd@openmailbox.org)
# Version 2.0 # Version 2.1
# Licensed by GPL v.2 # Licensed by GPL v.2
# Last update: 24-08-2015 # Last update: 14-10-2015
# -------------------------------------- # --------------------------------------
function printf(){
echo "$1" "$2"
}
function textprint(){
echo "$1"
}
# Check if 'user' is 'root' # Check if 'user' is 'root'
user=$(whoami) user=$(whoami)
if [ "$user" == "root" ] ; then if [ "$user" == "root" ] ; then
@ -23,7 +15,7 @@ user=$(whoami)
echo "You must be root!" echo "You must be root!"
exit 0 exit 0
fi fi
# Detect "kernel" name # Detect "kernel" name
KERNEL=$(uname -s) KERNEL=$(uname -s)
if [ $KERNEL == "Linux" ]; then if [ $KERNEL == "Linux" ]; then
@ -32,42 +24,42 @@ KERNEL=$(uname -s)
echo "Unsupported OS ($KERNEL)" echo "Unsupported OS ($KERNEL)"
exit 0 exit 0
fi fi
# Create Mozilla Firefox shortcut after of install it. # Create Mozilla Firefox shortcut after of install it.
function create_firefox_icon(){ function create_firefox_icon(){
textprint "[Desktop Entry]" > /usr/share/applications/firefox.desktop echo "[Desktop Entry]" > /usr/share/applications/firefox.desktop
#textprint "Encoding=UTF-8" >> /usr/share/applications/firefox.desktop #echo "Encoding=UTF-8" >> /usr/share/applications/firefox.desktop
textprint "Name=Mozilla Firefox" >> /usr/share/applications/firefox.desktop echo "Name=Mozilla Firefox" >> /usr/share/applications/firefox.desktop
textprint "Comment=Browse the World Wide Web" >> /usr/share/applications/firefox.desktop echo "Comment=Browse the World Wide Web" >> /usr/share/applications/firefox.desktop
textprint "GenericName=Web Browser" >> /usr/share/applications/firefox.desktop echo "GenericName=Web Browser" >> /usr/share/applications/firefox.desktop
textprint "X-GNOME-FullName=Mozilla Firefox" >> /usr/share/applications/firefox.desktop echo "X-GNOME-FullName=Mozilla Firefox" >> /usr/share/applications/firefox.desktop
textprint "Exec=firefox %u" >> /usr/share/applications/firefox.desktop echo "Exec=firefox %u" >> /usr/share/applications/firefox.desktop
textprint "Terminal=false" >> /usr/share/applications/firefox.desktop echo "Terminal=false" >> /usr/share/applications/firefox.desktop
textprint "X-MultipleArgs=false" >> /usr/share/applications/firefox.desktop echo "X-MultipleArgs=false" >> /usr/share/applications/firefox.desktop
textprint "Type=Application" >> /usr/share/applications/firefox.desktop echo "Type=Application" >> /usr/share/applications/firefox.desktop
textprint "Icon=/opt/firefox/browser/icons/mozicon128.png" >> /usr/share/applications/firefox.desktop echo "Icon=/opt/firefox/browser/icons/mozicon128.png" >> /usr/share/applications/firefox.desktop
textprint "Categories=Network;WebBrowser;" >> /usr/share/applications/firefox.desktop echo "Categories=Network;WebBrowser;" >> /usr/share/applications/firefox.desktop
#textprint "StartupWMClass=Firefox-bin" >> /usr/share/applications/firefox.desktop #echo "StartupWMClass=Firefox-bin" >> /usr/share/applications/firefox.desktop
textprint "StartupNotify=true" >> /usr/share/applications/firefox.desktop echo "StartupNotify=true" >> /usr/share/applications/firefox.desktop
chmod 755 /usr/share/applications/firefox.desktop chmod 755 /usr/share/applications/firefox.desktop
printf " <-Finished->" echo " <-Finished->"
exit exit
} }
# Install Firefox using 'tar' command and # Install Firefox using 'tar' command and
# initialize the 'create_firefox_icon' function. # initialize the 'create_firefox_icon' function.
function install_firefox(){ function install_firefox(){
printf "" echo ""
printf " <-Downloading Mozilla Firefox->" echo " <-Downloading Mozilla Firefox->"
cd /tmp/ cd /tmp/
if [ "$APP_DOWNLOAD" == "curl" ] ; then if [ "$APP_DOWNLOAD" == "curl" ] ; then
$APP_DOWNLOAD $SERVER > firefox-$VERSION $APP_DOWNLOAD $SERVER > firefox-$VERSION
else else
$APP_DOWNLOAD $SERVER $APP_DOWNLOAD $SERVER
fi fi
printf " <-Installing Mozilla Firefox->" echo " <-Installing Mozilla Firefox->"
tar jxvf firefox-$VERSION -C /opt/ tar jxvf firefox-$VERSION -C /opt/
rm -rf /usr/bin/firefox rm -rf /usr/bin/firefox
ln -s /opt/firefox/firefox /usr/bin/firefox ln -s /opt/firefox/firefox /usr/bin/firefox
@ -75,72 +67,72 @@ KERNEL=$(uname -s)
rm -rf /tmp/firefox-$VERSION rm -rf /tmp/firefox-$VERSION
create_firefox_icon create_firefox_icon
} }
# Define the complete URL of selected firefox package, show # Define the complete URL of selected firefox package, show
# the selected previous options to confirm and will initialize # the selected previous options to confirm and will initialize
# the install ('install_firefox' function). # the install ('install_firefox' function).
function step5_install_firefox(){ function step5_install_firefox(){
SERVER=http://archive.mozilla.org/pub/firefox/releases/$RELEASE/$ARCH/$LANGUAGE/firefox-$VERSION SERVER=http://archive.mozilla.org/pub/firefox/releases/$RELEASE/$ARCH/$LANGUAGE/firefox-$VERSION
clear clear
printf "" echo ""
printf "[Step 5/5] Check your selected installation:" echo "[Step 5/5] Check your selected installation:"
printf "" echo ""
printf "Install: Mozilla Firefox" echo "Install: Mozilla Firefox"
printf "Package: firefox-$VERSION" echo "Package: firefox-$VERSION"
printf "Language: $LANGUAGE" echo "Language: $LANGUAGE"
printf "Arch: $ARCH" echo "Arch: $ARCH"
printf "Directory: /opt/firefox/" echo "Directory: /opt/firefox/"
printf "" echo ""
printf "Apps: $NAME_APP (download) , tar (unpack) " echo "Apps: $NAME_APP (download) , tar (unpack) "
printf "" echo ""
printf -n "(default: y) Is correct (y/n/q); " ; read VAREND echo -n "(default: y) Is correct (y/n/q); " ; read VAREND
if [ "${VAREND:-NO_VALUE}" == "NO_VALUE" -o "$VAREND" == "yes" -o "$VAREND" == "y" ] ; then if [ "${VAREND:-NO_VALUE}" == "NO_VALUE" -o "$VAREND" == "yes" -o "$VAREND" == "y" ] ; then
install_firefox install_firefox
elif [ "$VAREND" == "no" -o "$VAREND" == "n" ] ; then elif [ "$VAREND" == "no" -o "$VAREND" == "n" ] ; then
get_list_versions get_list_versions
elif [ "$VAREND" == "q" -o "$VAREND" == "quit" ] ; then elif [ "$VAREND" == "q" -o "$VAREND" == "quit" ] ; then
exit exit
else else
clear clear
printf "" echo ""
printf "Invalid option, please, choose any available option" echo "Invalid option, please, choose any available option"
printf "" echo ""
printf "Press 'ENTER' to return" echo -n "Press 'ENTER' to return "
read yesorno read yesorno
step5_install_firefox step5_install_firefox
fi fi
} }
# Check if 'wget', 'aria2c' & 'axel' are installed, # Check if 'wget', 'aria2c' & 'axel' are installed,
# define the corresponding variable and initialize the # define the corresponding variable and initialize the
# 'step4_choose_app_download' function. # 'step4_choose_app_download' function.
function check_downloaders_on_system() { function check_downloaders_on_system() {
wget --help > /dev/null wget --help > /dev/null
if [ "$?" -eq 0 ] ; then if [ "$?" -eq 0 ] ; then
WGET=Available WGET=Available
else else
WGET='Not available' WGET='Not available'
fi fi
aria2c --help > /dev/null aria2c --help > /dev/null
if [ "$?" -eq 0 ] ; then if [ "$?" -eq 0 ] ; then
ARIA2C=Available ARIA2C=Available
else else
ARIA2C='Not available' ARIA2C='Not available'
fi fi
axel --help > /dev/null axel --help > /dev/null
if [ "$?" -eq 0 ] ; then if [ "$?" -eq 0 ] ; then
AXEL=Available AXEL=Available
else else
AXEL='Not available' AXEL='Not available'
fi fi
step4_choose_app_download step4_choose_app_download
} }
@ -148,48 +140,48 @@ KERNEL=$(uname -s)
# allows overwrite it, uninstall it or exit to cancel. # allows overwrite it, uninstall it or exit to cancel.
# Initialize the 'step1_choose_version' function too. # Initialize the 'step1_choose_version' function too.
function check_other_installs_on_system(){ function check_other_installs_on_system(){
if [ -d /opt/firefox/ ]; then if [ -d /opt/firefox/ ]; then
clear clear
printf "" echo ""
printf "Detected a previous installation of Firefox" echo "Detected a previous installation of Firefox"
printf "Do you want to overwrite or uninstall the current version?" echo "Do you want to overwrite or uninstall the current version?"
printf "" echo ""
printf "(1) - overwrite" echo "(1) - overwrite"
printf "(2) - uninstall" echo "(2) - uninstall"
printf "(3) - quit (q)" echo "(3) - quit (q)"
printf "" echo ""
printf -n "(Default: overwrite) Choose an option; " ; read INST echo -n "(Default: overwrite) Choose an option; " ; read INST
if [ "${INST:-NO_VALUE}" == "NO_VALUE" ] ; then if [ "${INST:-NO_VALUE}" == "NO_VALUE" ] ; then
get_list_versions get_list_versions
elif [ "$INST" == "1" -o "$INST" == "overwrite" ] ; then elif [ "$INST" == "1" -o "$INST" == "overwrite" ] ; then
get_list_versions get_list_versions
elif [ "$INST" == "2" -o "$INST" == "uninstall" ] ; then elif [ "$INST" == "2" -o "$INST" == "uninstall" ] ; then
clear clear
printf "" echo ""
printf "Uninstalling Firefox, please wait..." echo "Uninstalling Firefox, please wait..."
printf "" echo ""
sleep 5 sleep 5
rm -rf /usr/bin/firefox rm -rf /usr/bin/firefox
rm -rf /usr/share/applications/firefox.desktop rm -rf /usr/share/applications/firefox.desktop
rm -rf /opt/firefox/ rm -rf /opt/firefox/
printf "Done!" echo "Done!"
printf "" echo ""
exit exit
elif [ "$INST" == "3" -o "$INST" == "quit" -o "$INST" == "q" ]; then elif [ "$INST" == "3" -o "$INST" == "quit" -o "$INST" == "q" ]; then
exit exit
else else
clear clear
printf "" echo ""
printf "Invalid option, please, choose any available option" echo "Invalid option, please, choose any available option"
printf "" echo ""
printf "Press 'ENTER' to return" echo -n "Press 'ENTER' to return "
read notoption read notoption
check_other_installs_on_system check_other_installs_on_system
fi fi
@ -202,15 +194,15 @@ function check_other_installs_on_system(){
# if it is not installed. Initialize the 'check_other_installs_on_system' # if it is not installed. Initialize the 'check_other_installs_on_system'
# too. # too.
function check_curl_on_system(){ function check_curl_on_system(){
curl --help > /dev/null curl --help > /dev/null
if [ "$?" -eq 0 ] ; then if [ "$?" -eq 0 ] ; then
check_other_installs_on_system check_other_installs_on_system
else else
clear clear
printf "" echo ""
printf "Error: Need 'curl' installed on your system!" echo "Error: Need 'curl' installed on your system!"
printf "" echo ""
exit exit
fi fi
} }
@ -219,25 +211,25 @@ function check_other_installs_on_system(){
# initialize the 'step5_install_firefox' # initialize the 'step5_install_firefox'
# function. # function.
function step4_choose_app_download(){ function step4_choose_app_download(){
clear clear
printf "" echo ""
printf "[ Step 4/5 (App to download) ]" echo "[ Step 4/5 (App to download) ]"
printf "" echo ""
printf "Available apps to download:" echo "Available apps to download:"
printf "" echo ""
printf "(1) - wget ($WGET)" echo "(1) - wget ($WGET)"
printf "(2) - aria2c ($ARIA2C)" echo "(2) - aria2c ($ARIA2C)"
printf "(3) - axel ($AXEL)" echo "(3) - axel ($AXEL)"
printf "(4) - curl (Available)" echo "(4) - curl (Available)"
printf "" echo ""
printf "(q) - quit" echo "(q) - quit"
printf "" echo ""
APP=0 APP=0
printf -n "(Default: wget) Choose an option; " ; read APP echo -n "(Default: curl) Choose an option; " ; read APP
if [ "$APP" == "1" -o "$APP" == "wget" ] ; then if [ "$APP" == "1" -o "$APP" == "wget" ] ; then
# Check if 'wget' is available using the variable # Check if 'wget' is available using the variable
# defined in 'check_downloaders_on_system' function. # defined in 'check_downloaders_on_system' function.
if [ "$WGET" == "Available" ]; then if [ "$WGET" == "Available" ]; then
@ -246,16 +238,16 @@ function check_other_installs_on_system(){
step5_install_firefox step5_install_firefox
else else
clear clear
printf "" echo ""
printf "'wget' is not available in your system" echo "'wget' is not available in your system"
printf "" echo ""
printf "Press 'ENTER' to return" echo -n "Press 'ENTER' to return "
read not read not
step4_choose_app_download step4_choose_app_download
fi fi
elif [ "$APP" == "2" -o "$APP" == "aria2c" ] ; then elif [ "$APP" == "2" -o "$APP" == "aria2c" ] ; then
# Check if 'aria2c' is available using the variable # Check if 'aria2c' is available using the variable
# defined in 'check_downloaders_on_system' function. # defined in 'check_downloaders_on_system' function.
if [ "$ARIA2C" == "Available" ]; then if [ "$ARIA2C" == "Available" ]; then
@ -264,16 +256,16 @@ function check_other_installs_on_system(){
step5_install_firefox step5_install_firefox
else else
clear clear
printf "" echo ""
printf "'aria2c' is not available in your system" echo "'aria2c' is not available in your system"
printf "" echo ""
printf "Press 'ENTER' to return" echo -n "Press 'ENTER' to return "
read not read not
step4_choose_app_download step4_choose_app_download
fi fi
elif [ "$APP" == "3" -o "$APP" == "axel" ] ; then elif [ "$APP" == "3" -o "$APP" == "axel" ] ; then
# Check if 'axel' is available using the variable # Check if 'axel' is available using the variable
# defined in 'check_downloaders_on_system' function. # defined in 'check_downloaders_on_system' function.
if [ "$AXEL" == "Available" ]; then if [ "$AXEL" == "Available" ]; then
@ -282,44 +274,34 @@ function check_other_installs_on_system(){
step5_install_firefox step5_install_firefox
else else
clear clear
printf "" echo ""
printf "'axel' is not available in your system" echo "'axel' is not available in your system"
printf "" echo ""
printf "Press 'ENTER' to return" echo -n "Press 'ENTER' to return "
read not read not
step4_choose_app_download step4_choose_app_download
fi fi
elif [ "$APP" == "4" -o "$APP" == "curl" ] ; then elif [ "$APP" == "4" -o "$APP" == "curl" ] ; then
APP_DOWNLOAD='curl' APP_DOWNLOAD='curl'
NAME_APP='curl' NAME_APP='curl'
step5_install_firefox step5_install_firefox
elif [ "$APP" == "q" -o "$APP" == "quit" ] ; then elif [ "$APP" == "q" -o "$APP" == "quit" ] ; then
exit exit
elif [ "${APP:-NO_VALUE}" == "NO_VALUE" ] ; then
if [ "$WGET" == "Available" ]; then
APP_DOWNLOAD='wget -c'
NAME_APP='wget'
step5_install_firefox
else
clear
printf ""
printf "'wget' is not available in your system"
printf ""
printf "Press 'ENTER' to return"
read not
step4_choose_app_download
fi
elif [ "${APP:-NO_VALUE}" == "NO_VALUE" ] ; then
APP_DOWNLOAD='curl'
NAME_APP='curl'
step5_install_firefox
else else
clear clear
printf "" echo ""
printf "Invalid option, please, choose any available app" echo "Invalid option, please, choose any available app"
printf "" echo ""
printf "Press 'ENTER' to return" echo -n "Press 'ENTER' to return "
read notapp read notapp
step4_choose_app_download step4_choose_app_download
fi fi
@ -328,22 +310,22 @@ function check_other_installs_on_system(){
# Define the variable 'AR' and initialize # Define the variable 'AR' and initialize
# the 'check_downloaders_on_system' function. # the 'check_downloaders_on_system' function.
function step3_choose_arch(){ function step3_choose_arch(){
clear clear
printf "" echo ""
printf "[ Step 3/5 (Arch) ]" echo "[ Step 3/5 (Arch) ]"
printf "" echo ""
printf "Available Arch:" echo "Available Arch:"
printf "" echo ""
printf "(1) - 32 bits (linux-i686)" echo "(1) - 32 bits (linux-i686)"
printf "(2) - 64 bits (linux-x86_64)" echo "(2) - 64 bits (linux-x86_64)"
printf "" echo ""
printf "(q) - quit" echo "(q) - quit"
printf "" echo ""
printf -n "(Default: autodetect) Choose an option; " ; read AR echo -n "(Default: autodetect) Choose an option; " ; read AR
if [ "${AR:-NO_VALUE}" == "NO_VALUE" ] ; then if [ "${AR:-NO_VALUE}" == "NO_VALUE" ] ; then
# Detect the arch of the system if variable # Detect the arch of the system if variable
# 'AR' is empty. # 'AR' is empty.
archs=`uname -m` archs=`uname -m`
@ -360,86 +342,86 @@ function check_other_installs_on_system(){
echo "Unsupported Arquitecture ($archs)" echo "Unsupported Arquitecture ($archs)"
exit 0 exit 0
esac esac
elif [ "$AR" == "1" -o "$AR" == "32" ] ; then elif [ "$AR" == "1" -o "$AR" == "32" ] ; then
ARCH=linux-i686 ARCH=linux-i686
check_downloaders_on_system check_downloaders_on_system
elif [ "$AR" == "2" -o "$AR" == "64" ] ; then elif [ "$AR" == "2" -o "$AR" == "64" ] ; then
ARCH=linux-x86_64 ARCH=linux-x86_64
check_downloaders_on_system check_downloaders_on_system
elif [ "$AR" == "q" -o "$AR" == "quit" ] ; then elif [ "$AR" == "q" -o "$AR" == "quit" ] ; then
exit exit
else else
clear clear
printf "" echo ""
printf "Invalid option, please, choose any available arch" echo "Invalid option, please, choose any available arch"
printf "" echo ""
printf "Press 'ENTER' to return" echo -n "Press 'ENTER' to return "
read notarch read notarch
step3_choose_arch step3_choose_arch
fi fi
} }
# Define the variable 'LANGUAGE' and initialize the # Define the variable 'LANGUAGE' and initialize the
# 'step3_choose_arch' funtion. # 'step3_choose_arch' funtion.
function step2_choose_language(){ function step2_choose_language(){
FILE_LANGUAGES=/tmp/firefox-languages FILE_LANGUAGES=/tmp/firefox-languages
clear clear
printf "" echo ""
printf "[ Step 2/5 (Language) ]" echo "[ Step 2/5 (Language) ]"
printf "" echo ""
printf "Available languages:" echo "Available languages:"
printf "" echo ""
printf "[ach] [af] [an] [ar] [as] [ast] [be]" > $FILE_LANGUAGES echo "[ach] [af] [an] [ar] [as] [ast] [be]" > $FILE_LANGUAGES
printf "[bg] [bn-BD] [bn-IN] [br] [bs] [ca]" >> $FILE_LANGUAGES echo "[bg] [bn-BD] [bn-IN] [br] [bs] [ca]" >> $FILE_LANGUAGES
printf "[cs] [csb] [cy] [da] [de] [el] [en-GB]" >> $FILE_LANGUAGES echo "[cs] [csb] [cy] [da] [de] [el] [en-GB]" >> $FILE_LANGUAGES
printf "[en-US] [en-ZA] [eo] [es-AR] [es-CL]" >> $FILE_LANGUAGES echo "[en-US] [en-ZA] [eo] [es-AR] [es-CL]" >> $FILE_LANGUAGES
printf "[es-ES] [es-MX] [et] [eu] [fa] [ff] [fi]" >> $FILE_LANGUAGES echo "[es-ES] [es-MX] [et] [eu] [fa] [ff] [fi]" >> $FILE_LANGUAGES
printf "[fr] [fy-NL] [ga-IE] [gd] [gl] [gu-IN]" >> $FILE_LANGUAGES echo "[fr] [fy-NL] [ga-IE] [gd] [gl] [gu-IN]" >> $FILE_LANGUAGES
printf "[he] [hi-IN] [hr] [hu] [hy-AM] [id]" >> $FILE_LANGUAGES echo "[he] [hi-IN] [hr] [hu] [hy-AM] [id]" >> $FILE_LANGUAGES
printf "[is] [it] [ja] [kk] [km] [kn] [ko] [ku]" >> $FILE_LANGUAGES echo "[is] [it] [ja] [kk] [km] [kn] [ko] [ku]" >> $FILE_LANGUAGES
printf "[lij] [lt] [lv] [mai] [mk] [ml] [mr]" >> $FILE_LANGUAGES echo "[lij] [lt] [lv] [mai] [mk] [ml] [mr]" >> $FILE_LANGUAGES
printf "[ms] [nb-NO] [nl] [nn-NO] [or] [pa-IN]" >> $FILE_LANGUAGES echo "[ms] [nb-NO] [nl] [nn-NO] [or] [pa-IN]" >> $FILE_LANGUAGES
printf "[pl] [pt-BR] [pt-PT] [rm] [ro] [ru]" >> $FILE_LANGUAGES echo "[pl] [pt-BR] [pt-PT] [rm] [ro] [ru]" >> $FILE_LANGUAGES
printf "[si] [sk] [sl] [son] [sq] [sr] [sv-SE]" >> $FILE_LANGUAGES echo "[si] [sk] [sl] [son] [sq] [sr] [sv-SE]" >> $FILE_LANGUAGES
printf "[sw] [ta] [te] [th] [tr] [uk] [vi] [xh]" >> $FILE_LANGUAGES echo "[sw] [ta] [te] [th] [tr] [uk] [vi] [xh]" >> $FILE_LANGUAGES
printf "[xpi] [zh-CN] [zh-TW] [zu]" >> $FILE_LANGUAGES echo "[xpi] [zh-CN] [zh-TW] [zu]" >> $FILE_LANGUAGES
cat $FILE_LANGUAGES cat $FILE_LANGUAGES
printf "" echo ""
printf -n "(Default: en-US) Type the language; " ; read LANG echo -n "(Default: en-US) Type the language; " ; read LANG
COUNT=1 COUNT=1
# Check if the variable 'LANG' is empty. # Check if the variable 'LANG' is empty.
if [ "${LANG:-NO_VALUE}" != "NO_VALUE" ] ; then if [ "${LANG:-NO_VALUE}" != "NO_VALUE" ] ; then
# Check if the variable 'LANG' is valid. # Check if the variable 'LANG' is valid.
while [ $COUNT -le 10 ]; do while [ $COUNT -le 10 ]; do
LANGUAGE_VAR=`cat $FILE_LANGUAGES | grep $LANG | cut -d "[" -f $COUNT | cut -d "]" -f 1` LANGUAGE_VAR=`cat $FILE_LANGUAGES | grep $LANG | cut -d "[" -f $COUNT | cut -d "]" -f 1`
if [ "$LANGUAGE_VAR" == "$LANG" ]; then if [ "$LANGUAGE_VAR" == "$LANG" ]; then
LANGUAGE=$LANG LANGUAGE=$LANG
step3_choose_arch step3_choose_arch
else else
COUNT=`expr $COUNT + 1` COUNT=`expr $COUNT + 1`
fi fi
done done
clear clear
printf "" echo ""
printf "Language '$LANG' is not valid, please, type any available language" echo "Language '$LANG' is not valid, please, type any available language"
printf "" echo ""
printf "Press 'ENTER' to return" echo -n "Press 'ENTER' to return "
read notlang read notlang
step2_choose_language step2_choose_language
else else
LANGUAGE=en-US LANGUAGE=en-US
step3_choose_arch step3_choose_arch
@ -448,13 +430,13 @@ function check_other_installs_on_system(){
# Get the list of available firefox versions using 'curl', # Get the list of available firefox versions using 'curl',
# and initialize the 'step2_choose_language' function. # and initialize the 'step2_choose_language' function.
function get_list_versions() { function get_list_versions() {
clear clear
printf "" echo ""
printf "Getting information of available versions, please wait.." echo "Getting information of available versions, please wait.."
printf "" echo ""
TMP_FILE_STABLE=/tmp/moz_versions_st TMP_FILE_STABLE=/tmp/moz_versions_st
TMP_FILE_BETA=/tmp/moz_versions_bt TMP_FILE_BETA=/tmp/moz_versions_bt
TMP_FILE_ESR=/tmp/moz_versions_esr TMP_FILE_ESR=/tmp/moz_versions_esr
@ -464,68 +446,68 @@ function check_other_installs_on_system(){
curl "$HTTP_FIREFOX/latest-esr/linux-x86_64/en-US/" | grep "tar.bz2" | cut -d "-" -f 3 | cut -d "<" -f 1 > $TMP_FILE_ESR curl "$HTTP_FIREFOX/latest-esr/linux-x86_64/en-US/" | grep "tar.bz2" | cut -d "-" -f 3 | cut -d "<" -f 1 > $TMP_FILE_ESR
error=$? error=$?
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
printf "OK" > /dev/null echo "OK" > /dev/null
step1_choose_version step1_choose_version
else else
clear clear
printf "" echo ""
printf "Error: Failed to obtain the required information from the server!" echo "Error: Failed to obtain the required information from the server!"
printf "Connection Fail!" echo "Connection Fail!"
printf "" echo ""
exit exit
fi fi
} }
function step1_choose_version(){ function step1_choose_version(){
FIREFOX_STABLE=`cat $TMP_FILE_STABLE` FIREFOX_STABLE=`cat $TMP_FILE_STABLE`
FIREFOX_BETA=`cat $TMP_FILE_BETA` FIREFOX_BETA=`cat $TMP_FILE_BETA`
FIREFOX_ESR=`cat $TMP_FILE_ESR` FIREFOX_ESR=`cat $TMP_FILE_ESR`
DEFAULT=`cat $TMP_FILE_STABLE` DEFAULT=`cat $TMP_FILE_STABLE`
clear clear
printf "" echo ""
printf "[ Step 1/5 (Version) ]" echo "[ Step 1/5 (Version) ]"
printf "" echo ""
printf "Available Versions:" echo "Available Versions:"
printf "" echo ""
printf "(1) - firefox-$FIREFOX_ESR (ESR)" echo "(1) - firefox-$FIREFOX_ESR (ESR)"
printf "(2) - firefox-$FIREFOX_STABLE (stable)" echo "(2) - firefox-$FIREFOX_STABLE (stable)"
printf "(3) - firefox-$FIREFOX_BETA (beta)" echo "(3) - firefox-$FIREFOX_BETA (beta)"
printf "" echo ""
printf "(q) - quit" echo "(q) - quit"
printf "" echo ""
printf -n "(Default: firefox-$DEFAULT) Choose an option; " ; read VER echo -n "(Default: firefox-$DEFAULT) Choose an option; " ; read VER
if [ "$VER" == "1" -o "$VER" == "ESR" ] ; then if [ "$VER" == "1" -o "$VER" == "ESR" ] ; then
VERSION=$FIREFOX_ESR VERSION=$FIREFOX_ESR
RELEASE="latest-esr" RELEASE="latest-esr"
step2_choose_language step2_choose_language
elif [ "$VER" == "2" -o "$VER" == "stable" ] ; then elif [ "$VER" == "2" -o "$VER" == "stable" ] ; then
VERSION=$FIREFOX_STABLE VERSION=$FIREFOX_STABLE
RELEASE="latest" RELEASE="latest"
step2_choose_language step2_choose_language
elif [ "$VER" == "3" -o "$VER" == "beta" ] ; then elif [ "$VER" == "3" -o "$VER" == "beta" ] ; then
VERSION=$FIREFOX_BETA VERSION=$FIREFOX_BETA
RELEASE="latest-beta" RELEASE="latest-beta"
step2_choose_language step2_choose_language
elif [ "${VER:-NO_VALUE}" == "NO_VALUE" ] ; then elif [ "${VER:-NO_VALUE}" == "NO_VALUE" ] ; then
VERSION=$DEFAULT VERSION=$DEFAULT
RELEASE="latest" RELEASE="latest"
step2_choose_language step2_choose_language
elif [ "$VER" == "q" -o "$VER" == "quit" ] ; then elif [ "$VER" == "q" -o "$VER" == "quit" ] ; then
exit exit
else else
clear clear
printf "" echo ""
printf "Invalid option, please, choose any available version" echo "Invalid option, please, choose any available version"
printf "" echo ""
printf "Press 'ENTER' to return" echo -n "Press 'ENTER' to return "
read notversion read notversion
step1_choose_version step1_choose_version
fi fi

View File

@ -2,19 +2,11 @@
# Script to install Thunderbird on GNU/Linux # Script to install Thunderbird on GNU/Linux
# Created by clamsawd (clamsawd@openmailbox.org) # Created by clamsawd (clamsawd@openmailbox.org)
# Version 2.0 # Version 2.1
# Licensed by GPL v.2 # Licensed by GPL v.2
# Last update: 24-08-2015 # Last update: 14-10-2015
# -------------------------------------- # --------------------------------------
function printf(){
echo "$1" "$2"
}
function textprint(){
echo "$1"
}
# Check if 'user' is 'root' # Check if 'user' is 'root'
user=$(whoami) user=$(whoami)
if [ "$user" == "root" ] ; then if [ "$user" == "root" ] ; then
@ -23,7 +15,7 @@ user=$(whoami)
echo "You must be root!" echo "You must be root!"
exit 0 exit 0
fi fi
# Detect "kernel" name # Detect "kernel" name
KERNEL=$(uname -s) KERNEL=$(uname -s)
if [ $KERNEL == "Linux" ]; then if [ $KERNEL == "Linux" ]; then
@ -32,42 +24,42 @@ KERNEL=$(uname -s)
echo "Unsupported OS ($KERNEL)" echo "Unsupported OS ($KERNEL)"
exit 0 exit 0
fi fi
# Create Mozilla thunderbird shortcut after of install it. # Create Mozilla thunderbird shortcut after of install it.
function create_thunderbird_icon(){ function create_thunderbird_icon(){
textprint "[Desktop Entry]" > /usr/share/applications/thunderbird.desktop echo "[Desktop Entry]" > /usr/share/applications/thunderbird.desktop
#textprint "Encoding=UTF-8" >> /usr/share/applications/thunderbird.desktop #echo "Encoding=UTF-8" >> /usr/share/applications/thunderbird.desktop
textprint "Name=Mozilla Thunderbird" >> /usr/share/applications/thunderbird.desktop echo "Name=Mozilla Thunderbird" >> /usr/share/applications/thunderbird.desktop
textprint "Comment=Mozilla Email Reader" >> /usr/share/applications/thunderbird.desktop echo "Comment=Mozilla Email Reader" >> /usr/share/applications/thunderbird.desktop
textprint "GenericName=Email Reader" >> /usr/share/applications/thunderbird.desktop echo "GenericName=Email Reader" >> /usr/share/applications/thunderbird.desktop
textprint "X-GNOME-FullName=Mozilla Thunderbird" >> /usr/share/applications/thunderbird.desktop echo "X-GNOME-FullName=Mozilla Thunderbird" >> /usr/share/applications/thunderbird.desktop
textprint "Exec=thunderbird %u" >> /usr/share/applications/thunderbird.desktop echo "Exec=thunderbird %u" >> /usr/share/applications/thunderbird.desktop
textprint "Terminal=false" >> /usr/share/applications/thunderbird.desktop echo "Terminal=false" >> /usr/share/applications/thunderbird.desktop
textprint "X-MultipleArgs=false" >> /usr/share/applications/thunderbird.desktop echo "X-MultipleArgs=false" >> /usr/share/applications/thunderbird.desktop
textprint "Type=Application" >> /usr/share/applications/thunderbird.desktop echo "Type=Application" >> /usr/share/applications/thunderbird.desktop
textprint "Icon=/opt/thunderbird/chrome/icons/default/default48.png" >> /usr/share/applications/thunderbird.desktop echo "Icon=/opt/thunderbird/chrome/icons/default/default48.png" >> /usr/share/applications/thunderbird.desktop
textprint "Categories=Network;WebBrowser;" >> /usr/share/applications/thunderbird.desktop echo "Categories=Network;WebBrowser;" >> /usr/share/applications/thunderbird.desktop
#textprint "StartupWMClass=thunderbird-bin" >> /usr/share/applications/thunderbird.desktop #echo "StartupWMClass=thunderbird-bin" >> /usr/share/applications/thunderbird.desktop
textprint "StartupNotify=true" >> /usr/share/applications/thunderbird.desktop echo "StartupNotify=true" >> /usr/share/applications/thunderbird.desktop
chmod 755 /usr/share/applications/thunderbird.desktop chmod 755 /usr/share/applications/thunderbird.desktop
printf " <-Finished->" echo " <-Finished->"
exit exit
} }
# Install thunderbird using 'tar' command and # Install thunderbird using 'tar' command and
# initialize the 'create_THUNDERBIRD_icon' function. # initialize the 'create_THUNDERBIRD_icon' function.
function install_thunderbird(){ function install_thunderbird(){
printf "" echo ""
printf " <-Downloading Mozilla Thunderbird->" echo " <-Downloading Mozilla Thunderbird->"
cd /tmp/ cd /tmp/
if [ "$APP_DOWNLOAD" == "curl" ] ; then if [ "$APP_DOWNLOAD" == "curl" ] ; then
$APP_DOWNLOAD $SERVER > thunderbird-$VERSION $APP_DOWNLOAD $SERVER > thunderbird-$VERSION
else else
$APP_DOWNLOAD $SERVER $APP_DOWNLOAD $SERVER
fi fi
printf " <-Installing Mozilla Thunderbird->" echo " <-Installing Mozilla Thunderbird->"
tar jxvf thunderbird-$VERSION -C /opt/ tar jxvf thunderbird-$VERSION -C /opt/
rm -rf /usr/bin/thunderbird rm -rf /usr/bin/thunderbird
ln -s /opt/thunderbird/thunderbird /usr/bin/thunderbird ln -s /opt/thunderbird/thunderbird /usr/bin/thunderbird
@ -75,72 +67,72 @@ KERNEL=$(uname -s)
rm -rf /tmp/thunderbird-$VERSION rm -rf /tmp/thunderbird-$VERSION
create_thunderbird_icon create_thunderbird_icon
} }
# Define the complete URL of selected thunderbird package, show # Define the complete URL of selected thunderbird package, show
# the selected previous options to confirm and will initialize # the selected previous options to confirm and will initialize
# the install ('install_thunderbird' function). # the install ('install_thunderbird' function).
function step5_install_thunderbird(){ function step5_install_thunderbird(){
SERVER=http://archive.mozilla.org/pub/thunderbird/releases/$RELEASE/$ARCH/$LANGUAGE/thunderbird-$VERSION SERVER=http://archive.mozilla.org/pub/thunderbird/releases/$RELEASE/$ARCH/$LANGUAGE/thunderbird-$VERSION
clear clear
printf "" echo ""
printf "[Step 5/5] Check your selected installation:" echo "[Step 5/5] Check your selected installation:"
printf "" echo ""
printf "Install: Mozilla Thunderbird" echo "Install: Mozilla Thunderbird"
printf "Package: thunderbird-$VERSION" echo "Package: thunderbird-$VERSION"
printf "Language: $LANGUAGE" echo "Language: $LANGUAGE"
printf "Arch: $ARCH" echo "Arch: $ARCH"
printf "Directory: /opt/thunderbird/" echo "Directory: /opt/thunderbird/"
printf "" echo ""
printf "Apps: $NAME_APP (download) , tar (unpack) " echo "Apps: $NAME_APP (download) , tar (unpack) "
printf "" echo ""
printf -n "(default: y) Is correct (y/n/q); " ; read VAREND echo -n "(default: y) Is correct (y/n/q); " ; read VAREND
if [ "${VAREND:-NO_VALUE}" == "NO_VALUE" -o "$VAREND" == "yes" -o "$VAREND" == "y" ] ; then if [ "${VAREND:-NO_VALUE}" == "NO_VALUE" -o "$VAREND" == "yes" -o "$VAREND" == "y" ] ; then
install_thunderbird install_thunderbird
elif [ "$VAREND" == "no" -o "$VAREND" == "n" ] ; then elif [ "$VAREND" == "no" -o "$VAREND" == "n" ] ; then
get_list_versions get_list_versions
elif [ "$VAREND" == "q" -o "$VAREND" == "quit" ] ; then elif [ "$VAREND" == "q" -o "$VAREND" == "quit" ] ; then
exit exit
else else
clear clear
printf "" echo ""
printf "Invalid option, please, choose any available option" echo "Invalid option, please, choose any available option"
printf "" echo ""
printf "Press 'ENTER' to return" echo -n "Press 'ENTER' to return "
read yesorno read yesorno
step5_install_thunderbird step5_install_thunderbird
fi fi
} }
# Check if 'wget', 'aria2c' & 'axel' are installed, # Check if 'wget', 'aria2c' & 'axel' are installed,
# define the corresponding variable and initialize the # define the corresponding variable and initialize the
# 'step4_choose_app_download' function. # 'step4_choose_app_download' function.
function check_downloaders_on_system() { function check_downloaders_on_system() {
wget --help > /dev/null wget --help > /dev/null
if [ "$?" -eq 0 ] ; then if [ "$?" -eq 0 ] ; then
WGET=Available WGET=Available
else else
WGET='Not available' WGET='Not available'
fi fi
aria2c --help > /dev/null aria2c --help > /dev/null
if [ "$?" -eq 0 ] ; then if [ "$?" -eq 0 ] ; then
ARIA2C=Available ARIA2C=Available
else else
ARIA2C='Not available' ARIA2C='Not available'
fi fi
axel --help > /dev/null axel --help > /dev/null
if [ "$?" -eq 0 ] ; then if [ "$?" -eq 0 ] ; then
AXEL=Available AXEL=Available
else else
AXEL='Not available' AXEL='Not available'
fi fi
step4_choose_app_download step4_choose_app_download
} }
@ -148,48 +140,48 @@ KERNEL=$(uname -s)
# allows overwrite it, uninstall it or exit to cancel. # allows overwrite it, uninstall it or exit to cancel.
# Initialize the 'step1_choose_version' function too. # Initialize the 'step1_choose_version' function too.
function check_other_installs_on_system(){ function check_other_installs_on_system(){
if [ -d /opt/thunderbird/ ]; then if [ -d /opt/thunderbird/ ]; then
clear clear
printf "" echo ""
printf "Detected a previous installation of Thunderbird" echo "Detected a previous installation of Thunderbird"
printf "Do you want to overwrite or uninstall the current version?" echo "Do you want to overwrite or uninstall the current version?"
printf "" echo ""
printf "(1) - overwrite" echo "(1) - overwrite"
printf "(2) - uninstall" echo "(2) - uninstall"
printf "(3) - quit (q)" echo "(3) - quit (q)"
printf "" echo ""
printf -n "(Default: overwrite) Choose an option; " ; read INST echo -n "(Default: overwrite) Choose an option; " ; read INST
if [ "${INST:-NO_VALUE}" == "NO_VALUE" ] ; then if [ "${INST:-NO_VALUE}" == "NO_VALUE" ] ; then
get_list_versions get_list_versions
elif [ "$INST" == "1" -o "$INST" == "overwrite" ] ; then elif [ "$INST" == "1" -o "$INST" == "overwrite" ] ; then
get_list_versions get_list_versions
elif [ "$INST" == "2" -o "$INST" == "uninstall" ] ; then elif [ "$INST" == "2" -o "$INST" == "uninstall" ] ; then
clear clear
printf "" echo ""
printf "Uninstalling thunderbird, please wait..." echo "Uninstalling thunderbird, please wait..."
printf "" echo ""
sleep 5 sleep 5
rm -rf /usr/bin/thunderbird rm -rf /usr/bin/thunderbird
rm -rf /usr/share/applications/thunderbird.desktop rm -rf /usr/share/applications/thunderbird.desktop
rm -rf /opt/thunderbird/ rm -rf /opt/thunderbird/
printf "Done!" echo "Done!"
printf "" echo ""
exit exit
elif [ "$INST" == "3" -o "$INST" == "quit" -o "$INST" == "q" ]; then elif [ "$INST" == "3" -o "$INST" == "quit" -o "$INST" == "q" ]; then
exit exit
else else
clear clear
printf "" echo ""
printf "Invalid option, please, choose any available option" echo "Invalid option, please, choose any available option"
printf "" echo ""
printf "Press 'ENTER' to return" echo -n "Press 'ENTER' to return "
read notoption read notoption
check_other_installs_on_system check_other_installs_on_system
fi fi
@ -202,15 +194,15 @@ function check_other_installs_on_system(){
# if it is not installed. Initialize the 'check_other_installs_on_system' # if it is not installed. Initialize the 'check_other_installs_on_system'
# too. # too.
function check_curl_on_system(){ function check_curl_on_system(){
curl --help > /dev/null curl --help > /dev/null
if [ "$?" -eq 0 ] ; then if [ "$?" -eq 0 ] ; then
check_other_installs_on_system check_other_installs_on_system
else else
clear clear
printf "" echo ""
printf "Error: Need 'curl' installed on your system!" echo "Error: Need 'curl' installed on your system!"
printf "" echo ""
exit exit
fi fi
} }
@ -219,25 +211,25 @@ function check_other_installs_on_system(){
# initialize the 'step5_install_thunderbird' # initialize the 'step5_install_thunderbird'
# function. # function.
function step4_choose_app_download(){ function step4_choose_app_download(){
clear clear
printf "" echo ""
printf "[ Step 4/5 (App to download) ]" echo "[ Step 4/5 (App to download) ]"
printf "" echo ""
printf "Available apps to download:" echo "Available apps to download:"
printf "" echo ""
printf "(1) - wget ($WGET)" echo "(1) - wget ($WGET)"
printf "(2) - aria2c ($ARIA2C)" echo "(2) - aria2c ($ARIA2C)"
printf "(3) - axel ($AXEL)" echo "(3) - axel ($AXEL)"
printf "(4) - curl (Available)" echo "(4) - curl (Available)"
printf "" echo ""
printf "(q) - quit" echo "(q) - quit"
printf "" echo ""
APP=0 APP=0
printf -n "(Default: wget) Choose an option; " ; read APP echo -n "(Default: curl) Choose an option; " ; read APP
if [ "$APP" == "1" -o "$APP" == "wget" ] ; then if [ "$APP" == "1" -o "$APP" == "wget" ] ; then
# Check if 'wget' is available using the variable # Check if 'wget' is available using the variable
# defined in 'check_downloaders_on_system' function. # defined in 'check_downloaders_on_system' function.
if [ "$WGET" == "Available" ]; then if [ "$WGET" == "Available" ]; then
@ -246,16 +238,16 @@ function check_other_installs_on_system(){
step5_install_thunderbird step5_install_thunderbird
else else
clear clear
printf "" echo ""
printf "'wget' is not available in your system" echo "'wget' is not available in your system"
printf "" echo ""
printf "Press 'ENTER' to return" echo -n "Press 'ENTER' to return "
read not read not
step4_choose_app_download step4_choose_app_download
fi fi
elif [ "$APP" == "2" -o "$APP" == "aria2c" ] ; then elif [ "$APP" == "2" -o "$APP" == "aria2c" ] ; then
# Check if 'aria2c' is available using the variable # Check if 'aria2c' is available using the variable
# defined in 'check_downloaders_on_system' function. # defined in 'check_downloaders_on_system' function.
if [ "$ARIA2C" == "Available" ]; then if [ "$ARIA2C" == "Available" ]; then
@ -264,16 +256,16 @@ function check_other_installs_on_system(){
step5_install_thunderbird step5_install_thunderbird
else else
clear clear
printf "" echo ""
printf "'aria2c' is not available in your system" echo "'aria2c' is not available in your system"
printf "" echo ""
printf "Press 'ENTER' to return" echo -n "Press 'ENTER' to return "
read not read not
step4_choose_app_download step4_choose_app_download
fi fi
elif [ "$APP" == "3" -o "$APP" == "axel" ] ; then elif [ "$APP" == "3" -o "$APP" == "axel" ] ; then
# Check if 'axel' is available using the variable # Check if 'axel' is available using the variable
# defined in 'check_downloaders_on_system' function. # defined in 'check_downloaders_on_system' function.
if [ "$AXEL" == "Available" ]; then if [ "$AXEL" == "Available" ]; then
@ -282,44 +274,34 @@ function check_other_installs_on_system(){
step5_install_thunderbird step5_install_thunderbird
else else
clear clear
printf "" echo ""
printf "'axel' is not available in your system" echo "'axel' is not available in your system"
printf "" echo ""
printf "Press 'ENTER' to return" echo -n "Press 'ENTER' to return "
read not read not
step4_choose_app_download step4_choose_app_download
fi fi
elif [ "$APP" == "4" -o "$APP" == "curl" ] ; then elif [ "$APP" == "4" -o "$APP" == "curl" ] ; then
APP_DOWNLOAD='curl' APP_DOWNLOAD='curl'
NAME_APP='curl' NAME_APP='curl'
step5_install_thunderbird step5_install_thunderbird
elif [ "$APP" == "q" -o "$APP" == "quit" ] ; then elif [ "$APP" == "q" -o "$APP" == "quit" ] ; then
exit exit
elif [ "${APP:-NO_VALUE}" == "NO_VALUE" ] ; then
if [ "$WGET" == "Available" ]; then
APP_DOWNLOAD='wget -c'
NAME_APP='wget'
step5_install_thunderbird
else
clear
printf ""
printf "'wget' is not available in your system"
printf ""
printf "Press 'ENTER' to return"
read not
step4_choose_app_download
fi
elif [ "${APP:-NO_VALUE}" == "NO_VALUE" ] ; then
APP_DOWNLOAD='curl'
NAME_APP='curl'
step5_install_thunderbird
else else
clear clear
printf "" echo ""
printf "Invalid option, please, choose any available app" echo "Invalid option, please, choose any available app"
printf "" echo ""
printf "Press 'ENTER' to return" echo -n "Press 'ENTER' to return "
read notapp read notapp
step4_choose_app_download step4_choose_app_download
fi fi
@ -328,22 +310,22 @@ function check_other_installs_on_system(){
# Define the variable 'AR' and initialize # Define the variable 'AR' and initialize
# the 'check_downloaders_on_system' function. # the 'check_downloaders_on_system' function.
function step3_choose_arch(){ function step3_choose_arch(){
clear clear
printf "" echo ""
printf "[ Step 3/5 (Arch) ]" echo "[ Step 3/5 (Arch) ]"
printf "" echo ""
printf "Available Arch:" echo "Available Arch:"
printf "" echo ""
printf "(1) - 32 bits (linux-i686)" echo "(1) - 32 bits (linux-i686)"
printf "(2) - 64 bits (linux-x86_64)" echo "(2) - 64 bits (linux-x86_64)"
printf "" echo ""
printf "(q) - quit" echo "(q) - quit"
printf "" echo ""
printf -n "(Default: autodetect) Choose an option; " ; read AR echo -n "(Default: autodetect) Choose an option; " ; read AR
if [ "${AR:-NO_VALUE}" == "NO_VALUE" ] ; then if [ "${AR:-NO_VALUE}" == "NO_VALUE" ] ; then
# Detect the arch of the system if variable # Detect the arch of the system if variable
# 'AR' is empty. # 'AR' is empty.
archs=`uname -m` archs=`uname -m`
@ -360,86 +342,86 @@ function check_other_installs_on_system(){
echo "Unsupported Arquitecture ($archs)" echo "Unsupported Arquitecture ($archs)"
exit 0 exit 0
esac esac
elif [ "$AR" == "1" -o "$AR" == "32" ] ; then elif [ "$AR" == "1" -o "$AR" == "32" ] ; then
ARCH=linux-i686 ARCH=linux-i686
check_downloaders_on_system check_downloaders_on_system
elif [ "$AR" == "2" -o "$AR" == "64" ] ; then elif [ "$AR" == "2" -o "$AR" == "64" ] ; then
ARCH=linux-x86_64 ARCH=linux-x86_64
check_downloaders_on_system check_downloaders_on_system
elif [ "$AR" == "q" -o "$AR" == "quit" ] ; then elif [ "$AR" == "q" -o "$AR" == "quit" ] ; then
exit exit
else else
clear clear
printf "" echo ""
printf "Invalid option, please, choose any available arch" echo "Invalid option, please, choose any available arch"
printf "" echo ""
printf "Press 'ENTER' to return" echo -n "Press 'ENTER' to return "
read notarch read notarch
step3_choose_arch step3_choose_arch
fi fi
} }
# Define the variable 'LANGUAGE' and initialize the # Define the variable 'LANGUAGE' and initialize the
# 'step3_choose_arch' funtion. # 'step3_choose_arch' funtion.
function step2_choose_language(){ function step2_choose_language(){
FILE_LANGUAGES=/tmp/thunderbird-languages FILE_LANGUAGES=/tmp/thunderbird-languages
clear clear
printf "" echo ""
printf "[ Step 2/5 (Language) ]" echo "[ Step 2/5 (Language) ]"
printf "" echo ""
printf "Available languages:" echo "Available languages:"
printf "" echo ""
printf "[ach] [af] [an] [ar] [as] [ast] [be]" > $FILE_LANGUAGES echo "[ach] [af] [an] [ar] [as] [ast] [be]" > $FILE_LANGUAGES
printf "[bg] [bn-BD] [bn-IN] [br] [bs] [ca]" >> $FILE_LANGUAGES echo "[bg] [bn-BD] [bn-IN] [br] [bs] [ca]" >> $FILE_LANGUAGES
printf "[cs] [csb] [cy] [da] [de] [el] [en-GB]" >> $FILE_LANGUAGES echo "[cs] [csb] [cy] [da] [de] [el] [en-GB]" >> $FILE_LANGUAGES
printf "[en-US] [en-ZA] [eo] [es-AR] [es-CL]" >> $FILE_LANGUAGES echo "[en-US] [en-ZA] [eo] [es-AR] [es-CL]" >> $FILE_LANGUAGES
printf "[es-ES] [es-MX] [et] [eu] [fa] [ff] [fi]" >> $FILE_LANGUAGES echo "[es-ES] [es-MX] [et] [eu] [fa] [ff] [fi]" >> $FILE_LANGUAGES
printf "[fr] [fy-NL] [ga-IE] [gd] [gl] [gu-IN]" >> $FILE_LANGUAGES echo "[fr] [fy-NL] [ga-IE] [gd] [gl] [gu-IN]" >> $FILE_LANGUAGES
printf "[he] [hi-IN] [hr] [hu] [hy-AM] [id]" >> $FILE_LANGUAGES echo "[he] [hi-IN] [hr] [hu] [hy-AM] [id]" >> $FILE_LANGUAGES
printf "[is] [it] [ja] [kk] [km] [kn] [ko] [ku]" >> $FILE_LANGUAGES echo "[is] [it] [ja] [kk] [km] [kn] [ko] [ku]" >> $FILE_LANGUAGES
printf "[lij] [lt] [lv] [mai] [mk] [ml] [mr]" >> $FILE_LANGUAGES echo "[lij] [lt] [lv] [mai] [mk] [ml] [mr]" >> $FILE_LANGUAGES
printf "[ms] [nb-NO] [nl] [nn-NO] [or] [pa-IN]" >> $FILE_LANGUAGES echo "[ms] [nb-NO] [nl] [nn-NO] [or] [pa-IN]" >> $FILE_LANGUAGES
printf "[pl] [pt-BR] [pt-PT] [rm] [ro] [ru]" >> $FILE_LANGUAGES echo "[pl] [pt-BR] [pt-PT] [rm] [ro] [ru]" >> $FILE_LANGUAGES
printf "[si] [sk] [sl] [son] [sq] [sr] [sv-SE]" >> $FILE_LANGUAGES echo "[si] [sk] [sl] [son] [sq] [sr] [sv-SE]" >> $FILE_LANGUAGES
printf "[sw] [ta] [te] [th] [tr] [uk] [vi] [xh]" >> $FILE_LANGUAGES echo "[sw] [ta] [te] [th] [tr] [uk] [vi] [xh]" >> $FILE_LANGUAGES
printf "[xpi] [zh-CN] [zh-TW] [zu]" >> $FILE_LANGUAGES echo "[xpi] [zh-CN] [zh-TW] [zu]" >> $FILE_LANGUAGES
cat $FILE_LANGUAGES cat $FILE_LANGUAGES
printf "" echo ""
printf -n "(Default: en-US) Type the language; " ; read LANG echo -n "(Default: en-US) Type the language; " ; read LANG
COUNT=1 COUNT=1
# Check if the variable 'LANG' is empty. # Check if the variable 'LANG' is empty.
if [ "${LANG:-NO_VALUE}" != "NO_VALUE" ] ; then if [ "${LANG:-NO_VALUE}" != "NO_VALUE" ] ; then
# Check if the variable 'LANG' is valid. # Check if the variable 'LANG' is valid.
while [ $COUNT -le 10 ]; do while [ $COUNT -le 10 ]; do
LANGUAGE_VAR=`cat $FILE_LANGUAGES | grep $LANG | cut -d "[" -f $COUNT | cut -d "]" -f 1` LANGUAGE_VAR=`cat $FILE_LANGUAGES | grep $LANG | cut -d "[" -f $COUNT | cut -d "]" -f 1`
if [ "$LANGUAGE_VAR" == "$LANG" ]; then if [ "$LANGUAGE_VAR" == "$LANG" ]; then
LANGUAGE=$LANG LANGUAGE=$LANG
step3_choose_arch step3_choose_arch
else else
COUNT=`expr $COUNT + 1` COUNT=`expr $COUNT + 1`
fi fi
done done
clear clear
printf "" echo ""
printf "Language '$LANG' is not valid, please, type any available language" echo "Language '$LANG' is not valid, please, type any available language"
printf "" echo ""
printf "Press 'ENTER' to return" echo -n "Press 'ENTER' to return "
read notlang read notlang
step2_choose_language step2_choose_language
else else
LANGUAGE=en-US LANGUAGE=en-US
step3_choose_arch step3_choose_arch
@ -448,13 +430,13 @@ function check_other_installs_on_system(){
# Get the list of available thunderbird versions using 'curl', # Get the list of available thunderbird versions using 'curl',
# and initialize the 'step2_choose_language' function. # and initialize the 'step2_choose_language' function.
function get_list_versions() { function get_list_versions() {
clear clear
printf "" echo ""
printf "Getting information of available versions, please wait.." echo "Getting information of available versions, please wait.."
printf "" echo ""
TMP_FILE_STABLE=/tmp/moz_versions_st TMP_FILE_STABLE=/tmp/moz_versions_st
TMP_FILE_BETA=/tmp/moz_versions_bt TMP_FILE_BETA=/tmp/moz_versions_bt
TMP_FILE_ESR=/tmp/moz_versions_esr TMP_FILE_ESR=/tmp/moz_versions_esr
@ -464,68 +446,68 @@ function check_other_installs_on_system(){
curl "$HTTP_THUNDERBIRD/latest-esr/linux-x86_64/en-US/" | grep "tar.bz2" | cut -d "-" -f 3 | cut -d "<" -f 1 > $TMP_FILE_ESR curl "$HTTP_THUNDERBIRD/latest-esr/linux-x86_64/en-US/" | grep "tar.bz2" | cut -d "-" -f 3 | cut -d "<" -f 1 > $TMP_FILE_ESR
error=$? error=$?
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
printf "OK" > /dev/null echo "OK" > /dev/null
step1_choose_version step1_choose_version
else else
clear clear
printf "" echo ""
printf "Error: Failed to obtain the required information from the server!" echo "Error: Failed to obtain the required information from the server!"
printf "Connection Fail!" echo "Connection Fail!"
printf "" echo ""
exit exit
fi fi
} }
function step1_choose_version(){ function step1_choose_version(){
THUNDERBIRD_STABLE=`cat $TMP_FILE_STABLE` THUNDERBIRD_STABLE=`cat $TMP_FILE_STABLE`
THUNDERBIRD_BETA=`cat $TMP_FILE_BETA` THUNDERBIRD_BETA=`cat $TMP_FILE_BETA`
THUNDERBIRD_ESR=`cat $TMP_FILE_ESR` THUNDERBIRD_ESR=`cat $TMP_FILE_ESR`
DEFAULT=`cat $TMP_FILE_STABLE` DEFAULT=`cat $TMP_FILE_STABLE`
clear clear
printf "" echo ""
printf "[ Step 1/5 (Version) ]" echo "[ Step 1/5 (Version) ]"
printf "" echo ""
printf "Available Versions:" echo "Available Versions:"
printf "" echo ""
printf "(1) - thunderbird-$THUNDERBIRD_ESR (ESR)" echo "(1) - thunderbird-$THUNDERBIRD_ESR (ESR)"
printf "(2) - thunderbird-$THUNDERBIRD_STABLE (stable)" echo "(2) - thunderbird-$THUNDERBIRD_STABLE (stable)"
printf "(3) - thunderbird-$THUNDERBIRD_BETA (beta)" echo "(3) - thunderbird-$THUNDERBIRD_BETA (beta)"
printf "" echo ""
printf "(q) - quit" echo "(q) - quit"
printf "" echo ""
printf -n "(Default: thunderbird-$DEFAULT) Choose an option; " ; read VER echo -n "(Default: thunderbird-$DEFAULT) Choose an option; " ; read VER
if [ "$VER" == "1" -o "$VER" == "ESR" ] ; then if [ "$VER" == "1" -o "$VER" == "ESR" ] ; then
VERSION=$THUNDERBIRD_ESR VERSION=$THUNDERBIRD_ESR
RELEASE="latest-esr" RELEASE="latest-esr"
step2_choose_language step2_choose_language
elif [ "$VER" == "2" -o "$VER" == "stable" ] ; then elif [ "$VER" == "2" -o "$VER" == "stable" ] ; then
VERSION=$THUNDERBIRD_STABLE VERSION=$THUNDERBIRD_STABLE
RELEASE="latest" RELEASE="latest"
step2_choose_language step2_choose_language
elif [ "$VER" == "3" -o "$VER" == "beta" ] ; then elif [ "$VER" == "3" -o "$VER" == "beta" ] ; then
VERSION=$THUNDERBIRD_BETA VERSION=$THUNDERBIRD_BETA
RELEASE="latest-beta" RELEASE="latest-beta"
step2_choose_language step2_choose_language
elif [ "${VER:-NO_VALUE}" == "NO_VALUE" ] ; then elif [ "${VER:-NO_VALUE}" == "NO_VALUE" ] ; then
VERSION=$DEFAULT VERSION=$DEFAULT
RELEASE="latest" RELEASE="latest"
step2_choose_language step2_choose_language
elif [ "$VER" == "q" -o "$VER" == "quit" ] ; then elif [ "$VER" == "q" -o "$VER" == "quit" ] ; then
exit exit
else else
clear clear
printf "" echo ""
printf "Invalid option, please, choose any available version" echo "Invalid option, please, choose any available version"
printf "" echo ""
printf "Press 'ENTER' to return" echo -n "Press 'ENTER' to return "
read notversion read notversion
step1_choose_version step1_choose_version
fi fi