@@ -16,98 +16,147 @@ desktop_in_local_applications="$local_application_path/$app_name.desktop"
1616icon_path=" $app_installation_directory /browser/chrome/icons/default/default128.png"
1717executable_path=$app_installation_directory /zen
1818
19- echo " Welcome to Zen tarball installer, just chill and wait for the installation to complete!"
20-
19+ echo -e " Welcome to Zen tarball installer!\n"
2120sleep 1
2221
23- echo " Downloading the latest package"
24- curl -L -o $tar_location $official_package_location
25- if [ $? -eq 0 ]; then
26- echo OK
27- else
28- echo " Download failed. Curl not found or not installed"
29- exit
30- fi
31-
32- echo " Extracting Zen Browser..."
33- tar -xvJf $tar_location
34-
35- echo " Untarred successfully!"
36-
37- echo " Checking to see if an older installation exists"
38- if [ -f " $app_bin_in_local_bin " ]; then
39- echo " Old bin file detected, removing..."
40- rm " $app_bin_in_local_bin "
41- fi
42-
43- if [ -d " $app_installation_directory " ]; then
44- echo " Old app files are found, removing..."
45- rm -rf " $app_installation_directory "
46- fi
47-
48- if [ -f " $desktop_in_local_applications " ]; then
49- echo " Old app files are found, removing..."
50- rm " $desktop_in_local_applications "
51- fi
52-
53- if [ ! -d $universal_path_for_installation_directory ]; then
54- echo " Creating the $universal_path_for_installation_directory directory for installation"
55- mkdir $universal_path_for_installation_directory
56- fi
57-
58- mv $open_tar_application_data_location $app_installation_directory
59-
60- echo " Zen successfully moved to your safe place!"
61-
62- rm $tar_location
63-
64- if [ ! -d $local_bin_path ]; then
65- echo " $local_bin_path not found, creating it for you"
66- mkdir $local_bin_path
67- fi
68-
69- touch $app_bin_in_local_bin
70- chmod u+x $app_bin_in_local_bin
71- echo " #!/bin/bash
72- $executable_path " >> $app_bin_in_local_bin
73-
74- echo " Created executable for your \$ PATH if you ever need"
75-
76- if [ ! -d $local_application_path ]; then
77- echo " Creating the $local_application_path directory for desktop file"
78- mkdir $local_application_path
79- fi
80-
81-
82- touch $desktop_in_local_applications
83- echo "
84- [Desktop Entry]
85- Name=Zen Browser
86- Comment=Experience tranquillity while browsing the web without people tracking you!
87- Keywords=web;browser;internet
88- Exec=$executable_path %u
89- Icon=$icon_path
90- Terminal=false
91- StartupNotify=true
92- StartupWMClass=zen
93- NoDisplay=false
94- Type=Application
95- MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https;
96- Categories=Network;WebBrowser;
97- Actions=new-window;new-private-window;profile-manager-window;
98- [Desktop Action new-window]
99- Name=Open a New Window
100- Exec=$executable_path --new-window %u
101- [Desktop Action new-private-window]
102- Name=Open a New Private Window
103- Exec=$executable_path --private-window %u
104- [Desktop Action profile-manager-window]
105- Name=Open the Profile Manager
106- Exec=$executable_path --ProfileManager
107- " >> $desktop_in_local_applications
108-
109- echo " Created desktop entry successfully"
110- echo " Installation is successful"
111- echo " Done, and done, have fun! 🐷"
112-
113- exit 0
22+ echo " What would you like to do?"
23+ echo " 1) Install/Update Zen Browser"
24+ echo " 2) Uninstall Zen Browser"
25+ echo " 3) Exit"
26+ read -rn1 -p " Enter your choice [1/2/3]: " choice
27+ echo
28+
29+ case $choice in
30+ 1)
31+ install
32+ ;;
33+ 2)
34+ uninstall
35+ ;;
36+ 3)
37+ echo " Exiting... Bye! 🐷"
38+ exit 0
39+ ;;
40+ * )
41+ echo " Invalid choice. Exiting."
42+ exit 1
43+ ;;
44+ esac
45+
46+ install () {
47+ echo " We're installing Zen, just chill and wait for the installation to complete!\n"
48+ echo " Downloading the latest package"
49+ curl -L --progress-bar -o $tar_location $official_package_location
50+ if [ $? -eq 0 ]; then
51+ echo OK
52+ else
53+ echo " Download failed. Curl not found or not installed"
54+ exit
55+ fi
56+
57+ echo " Extracting Zen Browser..."
58+ tar -xvJf $tar_location
59+
60+ echo " Untarred successfully!"
61+
62+ echo " Checking to see if an older installation exists"
63+ remove
64+
65+ if [ ! -d $universal_path_for_installation_directory ]; then
66+ echo " Creating the $universal_path_for_installation_directory directory for installation"
67+ mkdir $universal_path_for_installation_directory
68+ fi
69+
70+ mv $open_tar_application_data_location $app_installation_directory
71+
72+ echo " Zen successfully moved to your safe place!"
73+
74+ rm $tar_location
75+
76+ if [ ! -d $local_bin_path ]; then
77+ echo " $local_bin_path not found, creating it for you"
78+ mkdir $local_bin_path
79+ fi
80+
81+ touch $app_bin_in_local_bin
82+ chmod u+x $app_bin_in_local_bin
83+ echo " #!/bin/bash
84+ $executable_path " >> $app_bin_in_local_bin
85+
86+ echo " Created executable for your \$ PATH if you ever need"
87+
88+ if [ ! -d $local_application_path ]; then
89+ echo " Creating the $local_application_path directory for desktop file"
90+ mkdir $local_application_path
91+ fi
92+
93+
94+ touch $desktop_in_local_applications
95+ echo "
96+ [Desktop Entry]
97+ Name=Zen Browser
98+ Comment=Experience tranquillity while browsing the web without people tracking you!
99+ Keywords=web;browser;internet
100+ Exec=$executable_path %u
101+ Icon=$icon_path
102+ Terminal=false
103+ StartupNotify=true
104+ StartupWMClass=zen
105+ NoDisplay=false
106+ Type=Application
107+ MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https;
108+ Categories=Network;WebBrowser;
109+ Actions=new-window;new-private-window;profile-manager-window;
110+ [Desktop Action new-window]
111+ Name=Open a New Window
112+ Exec=$executable_path --new-window %u
113+ [Desktop Action new-private-window]
114+ Name=Open a New Private Window
115+ Exec=$executable_path --private-window %u
116+ [Desktop Action profile-manager-window]
117+ Name=Open the Profile Manager
118+ Exec=$executable_path --ProfileManager
119+ " >> $desktop_in_local_applications
120+
121+ echo " Created desktop entry successfully"
122+ echo " Installation is successful"
123+ echo " Done, and done, have fun! 🐷"
124+
125+ exit 0
126+ }
127+
128+ remove () {
129+ if [ -f " $app_bin_in_local_bin " ]; then
130+ echo " Old bin file detected, removing..."
131+ rm " $app_bin_in_local_bin "
132+ fi
133+ if [ -d " $app_installation_directory " ]; then
134+ echo " Old app files are found, removing..."
135+ rm -rf " $app_installation_directory "
136+ fi
137+ if [ -f " $desktop_in_local_applications " ]; then
138+ echo " Old desktop files are found, removing..."
139+ rm " $desktop_in_local_applications "
140+ fi
141+ }
142+
143+ uninstall () {
144+ read -p " WARN: This will remove Zen Browser from your system. Do you wish to proceed? [y/N]: " confirm
145+ if [[ ! " $confirm " =~ ^[Yy]$ ]]; then
146+ echo " Nice save! We didn't remove Zen from your system."
147+ echo " Exiting..."
148+ exit 0
149+ fi
150+ echo " Uninstalling Zen Browser..."
151+ remove
152+ echo " Keeping your profile data will let you continue where you left off if you reinstall Zen later."
153+ read -p " Do you want to delete your Zen Profiles? This will remove all your bookmarks, history, and settings. [y/N]: " remove_profile
154+ if [[ " $remove_profile " =~ ^[Yy]$ ]]; then
155+ echo " Removing Zen Profiles data..."
156+ rm -rf " $HOME /.zen"
157+ else
158+ echo " Keeping Zen Profiles data..."
159+ fi
160+ echo " Zen Browser has been uninstalled."
161+ exit 0
162+ }
0 commit comments