-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
114 lines (86 loc) · 3.03 KB
/
install.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/bash
app_name="thunderbird"
display_name="Thunderbird"
literal_name_of_installation_directory=".tarball-installations"
universal_path_for_installation_directory="$HOME/$literal_name_of_installation_directory"
app_installation_directory="$universal_path_for_installation_directory/$app_name"
official_package_location="https://download.mozilla.org/?product=thunderbird-115.10.2-SSL&os=linux64&lang=en-US"
tar_location="./hello.tar.bz2"
local_bin_path="$HOME/.local/bin"
local_application_path="$HOME/.local/share/applications"
app_bin_in_local_bin="$local_bin_path/$app_name"
desktop_in_local_applications="$local_application_path/$app_name.desktop"
icon_path=$app_installation_directory/chrome/icons/default/default256.png
executable_path=$app_installation_directory/thunderbird
desktop_keywords=mail,email,mozilla,thunderbird
desktop_terminal=false
desktop_type=Application
desktop_categories="Mail;Email;E-mail;Thunderbird;Mozilla;RSS"
desktop_startup_wm_class="Thunderbird"
desktop_exec="$executable_path %u"
echo "Welcome to $display_name tarball installer, just chill and wait for the installation to complete!"
sleep 1
echo "Checking if old files exist"
if [ -f $app_bin_in_local_bin ]; then
echo "Old bin file detected, removing..."
rm $app_bin_in_local_bin
fi
if [ -d $app_installation_directory ]; then
echo "Old app files are found, removing..."
rm -rf $app_installation_directory
fi
if [ -f $desktop_in_local_applications ]; then
echo "Old bin file detected, removing..."
rm $desktop_in_local_applications
fi
sleep 1
echo "Installing the latest package"
curl -L -o $tar_location $official_package_location
if [ $? -eq 0 ]; then
echo OK
else
echo "Installation failed. Curl not found or not installed"
exit
fi
mkdir $app_name
tar -xvjf $tar_location -C $app_name --strip-components=1
echo "Installed and untarred successfully"
if [ ! -d $universal_path_for_installation_directory ]; then
echo "Creating the $universal_path_for_installation_directory directory for installation"
mkdir $universal_path_for_installation_directory
fi
mv $app_name $app_installation_directory
echo "$app_name successfully moved to your safe place!"
rm $tar_location
if [ ! -d $local_bin_path ]; then
echo "$local_bin_path not found, creating it for you"
mkdir $local_bin_path
fi
touch $app_bin_in_local_bin
chmod u+x $app_bin_in_local_bin
echo "#!/bin/bash
$executable_path" >> $app_bin_in_local_bin
echo "Created executable for your \$PATH if you ever need"
if [ ! -d $local_application_path ]; then
echo "Creating the $local_application_path directory for desktop file"
mkdir $local_application_path
fi
touch $desktop_in_local_applications
echo "
[Desktop Entry]
Name=$display_name
Keywords=$desktop_keywords
Exec=$desktop_exec
Icon=$icon_path
Terminal=$desktop_terminal
Type=$desktop_type
StartupWMClass=$desktop_startup_wm_class
Categories=$desktop_categories
" >> $desktop_in_local_applications
echo "Created desktop entry successfully"
sleep 1
echo "Installation is successful"
sleep 1
echo "Done, and done, have fun!"
sleep 1
exit 0