-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathget_latest_firefox.sh
executable file
·72 lines (54 loc) · 1.82 KB
/
get_latest_firefox.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash -
#===============================================================================
#
# FILE: get_latest_firefox.sh
#
# USAGE: ./get_latest_firefox.sh
#
# DESCRIPTION:
#
# OPTIONS: ---
# REQUIREMENTS: curl tar
# BUGS: ---
# NOTES: ---
# AUTHOR: Bhaskar Chowdhury (https://about.me/unixbhaskar), unixbhaskar@gmail.com
# ORGANIZATION: Independent
# CREATED: 09/24/2019 15:27
# REVISION: ---
#===============================================================================
set -o nounset # Treat unset variables as an error
source $HOME/colors.sh
NOCOLOR="\033[0m"
printf "\n\n\n ${Reverse}${Bright}${LimeYellow} Get the latest firefox from Mozilla ${NOCOLOR} ....\n\n\n"
curl -Lo firefox.tar.bz2 'https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=en-US'
if [[ $? == 0 ]];then
printf "${Bright}${Green} Success ${NOCOLOR} \n\n"
else
printf "${Bright}${Red} Failed ${NOCOLOR} \n\n"
fi
current_date=$(date '+%F')
folder_date=$(ls -ld --full-time $HOME/firefox | gawk '{ print $6 }')
if [[ "$folder_date" -ne "$current_date" ]];then
mv -v $HOME/firefox $HOME/firefox.$(date +"%d-%m-%Y")
fi
tar -xjf firefox.tar.bz2
cd firefox
$HOME/firefox/firefox firefox_$version
cp $HOME/firefox/firefox $HOME/bin/firefox
printf "${Bright}${Magenta} Kill the existing process.... ${NOCOLOR}...\n\n"
pkill firefox
printf "Clearing the startup cache ..wait \n\n"
find ~/.cache/mozilla/firefox -type d -name startupCache | xargs rm -rf
printf "\n\n Done \n"
cd ..
rm -f firefox.tar.bz2
# whereis firefox
# printf "\n\n Put the old binary file to remove : %s "
# read old_binary
# rm -f $old_binary
# printf "\n\n Put the old directory too for removal : %s "
# read old_dir
# rm -rf $old_dir
#start up
firefox&
exit 0