From 518240fb88d1eb9f279545bd7cdce8c9af926f1c Mon Sep 17 00:00:00 2001 From: Sannidhya <58990408+sannidhyaroy@users.noreply.github.com> Date: Wed, 26 Mar 2025 15:46:31 +0530 Subject: [PATCH 1/3] `feat`: add uninstall option --- install.sh | 201 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 125 insertions(+), 76 deletions(-) diff --git a/install.sh b/install.sh index 7e07466..e417abd 100644 --- a/install.sh +++ b/install.sh @@ -16,98 +16,147 @@ desktop_in_local_applications="$local_application_path/$app_name.desktop" icon_path="$app_installation_directory/browser/chrome/icons/default/default128.png" executable_path=$app_installation_directory/zen -echo "Welcome to Zen tarball installer, just chill and wait for the installation to complete!" - +echo -e "Welcome to Zen tarball installer!\n" sleep 1 -echo "Downloading the latest package" -curl -L -o $tar_location $official_package_location -if [ $? -eq 0 ]; then - echo OK -else - echo "Download failed. Curl not found or not installed" - exit -fi +echo "What would you like to do?" +echo "1) Install/Update Zen Browser" +echo "2) Uninstall Zen Browser" +echo "3) Exit" +read -rn1 -p "Enter your choice [1/2/3]: " choice +echo -echo "Extracting Zen Browser..." -tar -xvJf $tar_location +case $choice in + 1) + install + ;; + 2) + uninstall + ;; + 3) + echo "Exiting... Bye! 🐷" + exit 0 + ;; + *) + echo "Invalid choice. Exiting." + exit 1 + ;; +esac -echo "Untarred successfully!" +install() { + echo "We're installing Zen, just chill and wait for the installation to complete!\n" + echo "Downloading the latest package" + curl -L --progress-bar -o $tar_location $official_package_location + if [ $? -eq 0 ]; then + echo OK + else + echo "Download failed. Curl not found or not installed" + exit + fi -echo "Checking to see if an older installation exists" -if [ -f "$app_bin_in_local_bin" ]; then - echo "Old bin file detected, removing..." - rm "$app_bin_in_local_bin" -fi + echo "Extracting Zen Browser..." + tar -xvJf $tar_location -if [ -d "$app_installation_directory" ]; then - echo "Old app files are found, removing..." - rm -rf "$app_installation_directory" -fi + echo "Untarred successfully!" -if [ -f "$desktop_in_local_applications" ]; then - echo "Old app files are found, removing..." - rm "$desktop_in_local_applications" -fi + echo "Checking to see if an older installation exists" + remove -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 + 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 $open_tar_application_data_location $app_installation_directory + mv $open_tar_application_data_location $app_installation_directory -echo "Zen successfully moved to your safe place!" + echo "Zen successfully moved to your safe place!" -rm $tar_location + rm $tar_location -if [ ! -d $local_bin_path ]; then - echo "$local_bin_path not found, creating it for you" - mkdir $local_bin_path -fi + 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 + 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" + 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 + 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=Zen Browser -Comment=Experience tranquillity while browsing the web without people tracking you! -Keywords=web;browser;internet -Exec=$executable_path %u -Icon=$icon_path -Terminal=false -StartupNotify=true -StartupWMClass=zen -NoDisplay=false -Type=Application -MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https; -Categories=Network;WebBrowser; -Actions=new-window;new-private-window;profile-manager-window; -[Desktop Action new-window] -Name=Open a New Window -Exec=$executable_path --new-window %u -[Desktop Action new-private-window] -Name=Open a New Private Window -Exec=$executable_path --private-window %u -[Desktop Action profile-manager-window] -Name=Open the Profile Manager -Exec=$executable_path --ProfileManager -" >> $desktop_in_local_applications + touch $desktop_in_local_applications + echo " + [Desktop Entry] + Name=Zen Browser + Comment=Experience tranquillity while browsing the web without people tracking you! + Keywords=web;browser;internet + Exec=$executable_path %u + Icon=$icon_path + Terminal=false + StartupNotify=true + StartupWMClass=zen + NoDisplay=false + Type=Application + MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https; + Categories=Network;WebBrowser; + Actions=new-window;new-private-window;profile-manager-window; + [Desktop Action new-window] + Name=Open a New Window + Exec=$executable_path --new-window %u + [Desktop Action new-private-window] + Name=Open a New Private Window + Exec=$executable_path --private-window %u + [Desktop Action profile-manager-window] + Name=Open the Profile Manager + Exec=$executable_path --ProfileManager + " >> $desktop_in_local_applications -echo "Created desktop entry successfully" -echo "Installation is successful" -echo "Done, and done, have fun! 🐷" + echo "Created desktop entry successfully" + echo "Installation is successful" + echo "Done, and done, have fun! 🐷" -exit 0 + exit 0 +} + +remove() { + 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 desktop files are found, removing..." + rm "$desktop_in_local_applications" + fi +} + +uninstall() { + read -p "WARN: This will remove Zen Browser from your system. Do you wish to proceed? [y/N]: " confirm + if [[ ! "$confirm" =~ ^[Yy]$ ]]; then + echo "Nice save! We didn't remove Zen from your system." + echo "Exiting..." + exit 0 + fi + echo "Uninstalling Zen Browser..." + remove + echo "Keeping your profile data will let you continue where you left off if you reinstall Zen later." + read -p "Do you want to delete your Zen Profiles? This will remove all your bookmarks, history, and settings. [y/N]: " remove_profile + if [[ "$remove_profile" =~ ^[Yy]$ ]]; then + echo "Removing Zen Profiles data..." + rm -rf "$HOME/.zen" + else + echo "Keeping Zen Profiles data..." + fi + echo "Zen Browser has been uninstalled." + exit 0 +} From 28bfffeb66001cbce94316fb876f64986b09a206 Mon Sep 17 00:00:00 2001 From: Sannidhya <58990408+sannidhyaroy@users.noreply.github.com> Date: Wed, 26 Mar 2025 16:12:11 +0530 Subject: [PATCH 2/3] `feat`: support twilight flag --- install.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/install.sh b/install.sh index e417abd..595dc08 100644 --- a/install.sh +++ b/install.sh @@ -28,6 +28,7 @@ echo case $choice in 1) + parseTwilight "$@" install ;; 2) @@ -125,6 +126,13 @@ install() { exit 0 } +parseTwilight() { + if [ "$1" == "--twilight" ]; then + official_package_location="https://github.com/zen-browser/desktop/releases/download/twilight/zen.linux-x86_64.tar.xz" + echo "You're currently in Twilight mode, this means you're downloading the latest experimental features and updates." + fi +} + remove() { if [ -f "$app_bin_in_local_bin" ]; then echo "Old bin file detected, removing..." From a172d71a842d2b22e2468d56539e3aa3a89adee1 Mon Sep 17 00:00:00 2001 From: Sannidhya <58990408+sannidhyaroy@users.noreply.github.com> Date: Wed, 26 Mar 2025 16:35:50 +0530 Subject: [PATCH 3/3] `fix`: twilight variable unbound --- install.sh | 64 +++++++++++++++++++++++++----------------------------- 1 file changed, 29 insertions(+), 35 deletions(-) mode change 100644 => 100755 install.sh diff --git a/install.sh b/install.sh old mode 100644 new mode 100755 index 595dc08..f0f7b6f --- a/install.sh +++ b/install.sh @@ -16,44 +16,10 @@ desktop_in_local_applications="$local_application_path/$app_name.desktop" icon_path="$app_installation_directory/browser/chrome/icons/default/default128.png" executable_path=$app_installation_directory/zen -echo -e "Welcome to Zen tarball installer!\n" -sleep 1 - -echo "What would you like to do?" -echo "1) Install/Update Zen Browser" -echo "2) Uninstall Zen Browser" -echo "3) Exit" -read -rn1 -p "Enter your choice [1/2/3]: " choice -echo - -case $choice in - 1) - parseTwilight "$@" - install - ;; - 2) - uninstall - ;; - 3) - echo "Exiting... Bye! 🐷" - exit 0 - ;; - *) - echo "Invalid choice. Exiting." - exit 1 - ;; -esac - install() { echo "We're installing Zen, just chill and wait for the installation to complete!\n" echo "Downloading the latest package" curl -L --progress-bar -o $tar_location $official_package_location - if [ $? -eq 0 ]; then - echo OK - else - echo "Download failed. Curl not found or not installed" - exit - fi echo "Extracting Zen Browser..." tar -xvJf $tar_location @@ -127,7 +93,7 @@ install() { } parseTwilight() { - if [ "$1" == "--twilight" ]; then + if [ "${1:-}" == "--twilight" ]; then official_package_location="https://github.com/zen-browser/desktop/releases/download/twilight/zen.linux-x86_64.tar.xz" echo "You're currently in Twilight mode, this means you're downloading the latest experimental features and updates." fi @@ -168,3 +134,31 @@ uninstall() { echo "Zen Browser has been uninstalled." exit 0 } + +echo -e "Welcome to Zen tarball installer!\n" +sleep 1 + +echo "What would you like to do?" +echo "1) Install/Update Zen Browser" +echo "2) Uninstall Zen Browser" +echo "3) Exit" +read -rn1 -p "Enter your choice [1/2/3]: " choice +echo + +case $choice in + 1) + parseTwilight "$@" + install + ;; + 2) + uninstall + ;; + 3) + echo "Exiting... Bye! 🐷" + exit 0 + ;; + *) + echo "Invalid choice. Exiting." + exit 1 + ;; +esac