Announcement

Collapse
No announcement yet.

Script to install traditional Firefox

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Script to install traditional Firefox

    Purpose of this script

    This is a little helper script for Kubuntu™ (22.04 & later) users who want to install the traditional Firefox from Mozilla.org (the way Debian suggests) and use it complementary to or instead of the Firefox Snap​​.​
    It can also remove the traditional Firefox, if it has been installed by this script before, and has been tested many times with Kubuntu™ 22.04 LTS up to 24.04 LTS.

    I hope you find the script useful! Yours respectfully, Schwarzer Kater

    Installation and usage of this script
    1. You can download the script from here: https://gitlab.com/scripts94/kubuntu...tional-firefox
      Click on its name in the file list and on the next page use the download button on the far right side of the script name.
      OR
      Copy and paste the code of the script into a blank Kate text editor document and save it as "Kubuntu_install_traditional_Firefox.sh" to e.g. your home directory.
    2. Make the file Kubuntu_install_traditional_Firefox.sh executable in the Dolphin file manager:
      go to the directory you downloaded/saved the script to, right-click on the file and choose Properties --> Permissions --> enable Is executable --> choose OK.
      OR
      Make the file Kubuntu_install_traditional_Firefox.sh executable in the Konsole terminal emulator:
      go to the directory you downloaded/saved the script to (cd [path to]/[name of directory], e.g. cd ~/Downloads) and enter:
      chmod +x Kubuntu_install_traditional_Firefox.sh.
    3. To run the script in the Konsole terminal emulator go to the directory you downloaded/saved the script to and enter:
      ./Kubuntu_install_traditional_Firefox.sh.

    Important
    • It is advised to run this script after a full upgrade of the system (either with Discover or in Konsole with sudo apt update && sudo apt full-upgrade) AND a reboot.​​
    • Firefox from Mozilla.org can simply be used alternatively with or without the Firefox Snap and no further actions are to be taken.
      It will remain installed when release-upgrading (e.g. from 23.10 to 24.04 LTS) and causes no conflicts during the upgrade process​​.
      This version of Firefox behaves roughly like the ones for macOS™ or Windows™ do and updates itself independently from Discover or APT package management (and can ask you before updating - if you would prefer being asked see the Firefox settings).​

    You will be asked if you want [1] to download and install Firefox from Mozilla.org OR [2] to remove a previously installed Firefox, but if you choose [3] to cancel, no changes at all are made to your system.
    After you chose [1] to install Firefox from Mozilla.org, you will be asked to select your preferred language next​.​

    For some more information about what is done in detail see the comments within the script itself.

    Known issues / bugs
    • Don't start and use both the traditional Firefox and the Firefox Snap simultaneously - this can lead to problems!​
    • In very rare cases the compressed binary from Mozilla's server was either temporarily not available in a particular language or was corrupted (it once happened with "English (South African) lang=en-ZA" for example).
      The script will inform you about this and suggest the following solution.
      --> The solution is to run the script again, choosing a more "common" (but nonetheless fitting) language version like "English (US) lang=en-US" instead - which then has always worked fine.
      After the installation you can change to your preferred language in Firefox when it starts for the first time or later on in the Firefox settings​.​


    Other Ubuntu™-based distributions

    No other Ubuntu™-based distributions/flavours but Kubuntu™ 22.04 LTS & later are officially supported.

    Due to the amount of time it would take to thoroughly test this script with other distributions/flavours I will probably also not support them in the future.

    That said the script should work with other official flavours of Ubuntu™ and with Debian so far.
    Last edited by Schwarzer Kater; May 01, 2024, 09:39 PM.
    Debian KDE & LXQt • Kubuntu & Lubuntu • openSUSE KDE • Windows • macOS X
    Desktop: Lenovo ThinkCentre M75s • Laptop: Apple MacBook Pro 13" • and others

    get rid of Snap script (20.04 +)reinstall Snap for release-upgrade script (20.04 +)
    install traditional Firefox script (22.04 +)​ • install traditional Thunderbird script (24.04)

    #2
    Changelog
    • Version 2.1.3, released 2024-05-12
      - improved code (now the script tests first if the computer has established an
      internet connection)​
    • Version 2.1.2, released 2024-05-02
      - improved code (and re-added link to /usr/local/bin for CLI usage)
      - improved summary regarding the Firefox Snap​
    • Version 2.1.1, released 2024-04-25
      - improved summary regarding removal​
    • Version 2.1.0, released 2024-04-17
      - ADDED FEATURE to offer removing traditional Firefox from /opt if it has been
      installed by this script before
      - improved code (now the script exits and tells the user when the Firefox .tar
      in the chosen language was e.g temporarily not available or was corrupt)​
    • Version 2.0.2, released 2024-04-07
      - improved code for Kubuntu 20.10 up to 21.10​
    • Version 2.0.1, released 2024-04-05
      - improved code​
    • Version 2.0.0, released 2024-04-05
      - REMOVED FEATURE: the Mozilla Team PPA is not supported any longer!
      - improved code
      - improved summary
      - improved language
      - improved comments​
    • Version 1.2.3, released 2024-03-28
      - CORRECTED BUG IN CODE (removed the link from /usr/local/bin for CLI usage of
      Firefox from Mozilla.org as at the moment there is a conflict when the Firefox
      Snap is also installed)​
      - improved language
    • Version 1.2.2, released 2023-10-26
      - improved summary
    • Version 1.2.1, released 2023-06-21
      - improved code​
    • Version 1.2.0, released 2023-04-25
      - ADDED FEATURE to offer removing the Firefox Snap and strongly recommend to do
      so, if Firefox from the Mozilla Team PPA is to be installed
      - cleaned up code
      - improved summary
      - improved language
      - renamed the project
    • Version 1.1.2, released 2023-04-07
      - CORRECTED BUG IN CODE (now the "invisible" placeholder files for a former
      installation from the Mozilla Team PPA are removed, if the user installs Firefox
      from Mozilla.org instead after running the "reinstall_Snap_for_release-upgrade"
      script)
      - improved code
      - improved output
    • Version 1.1.1, released 2023-04-06
      - CORRECTED BUG IN CODE (now the firefox.desktop file for Firefox from
      Mozilla.org is created in /usr/local/share/applications instead of
      /usr/share/applications - otherwise in some situations the .desktop file could
      be removed when (re)installing the Firefox Snap or release-upgrading)
      - improved summary
      - improved comments
    • Version 1.1.0, released 2023-04-03
      - ADDED FEATURE to save summary as a text file for future reference, if the
      script had changed anything
      - changed version number to semantic versioning
    • Version 290323, released 2023-03-29
      - initial public release​


    Some questions have already been answered here: https://www.kubuntuforums.net/forum/...600#post669600

    The script has been tested extensively, but I appreciate it if you report any errors you come across (concerning the coding or the English language).


    Thank you very much!​

    Code:
    #!/bin/bash
    
    ################################################################################
    #                                                                              #
    #                                                                              #
    #         $$     $$                                                $$          #
    #         $$     $$  $$$$$$$$$  $$         $$          $$$$$$$     $$          #
    #         $$     $$  $$         $$         $$         $$     $$    $$          #
    #         $$$$$$$$$  $$$$$$$$   $$         $$         $$     $$    $$          #
    #         $$     $$  $$         $$         $$         $$     $$    $$          #
    #         $$     $$  $$         $$         $$         $$     $$                #
    #         $$     $$  $$$$$$$$$  $$$$$$$$$  $$$$$$$$$   $$$$$$$     $$          #
    #                                                                              #
    #                                                                              #
    # This is a little helper script for Kubuntu™ (22.04 & later) users who want   #
    # to install the traditional Firefox from Mozilla.org (the way Debian          #
    # suggests) and use it complementary to or instead of the Firefox Snap.        #
    # It can also remove Firefox, if it has been installed by this script before,  #
    # and has been tested many times with Kubuntu™ 22.04 LTS up to 24.04 LTS.      #
    #                                                                              #
    # -> IMPORTANT:                                                                #
    #    It is advised to run this script after a full upgrade of the system       #
    #    (either with Discover or in Konsole with "sudo apt update && sudo apt     #
    #    full-upgrade") AND a reboot.                                              #
    #                                                                              #
    # -> Firefox from Mozilla.org can simply be used alternatively with or without #
    #    the Firefox Snap and no further actions are to be taken.                  #
    #    It will remain installed when release-upgrading (e.g. from 23.10 to       #
    #    24.04 LTS) and causes no conflicts during the upgrade process.            #
    #    This version of Firefox behaves roughly like the ones for macOS™ or       #
    #    Windows™ do and updates itself independently from Discover or APT package #
    #    management (and can ask you before updating - if you would prefer being   #
    #    asked see the Firefox settings).                                          #
    #                                                                              #
    # You will be asked if you want [1] to download and install Firefox from       #
    # Mozilla.org OR [2] to remove a previously installed Firefox, but if you      #
    # choose [3] to cancel, no changes at all are made to your system.             #
    # After you chose [1] to install Firefox from Mozilla.org, you will be asked   #
    # to select your preferred language next.                                      #
    #                                                                              #
    # For some more information about what is done in detail see the comments      #
    # within this script.                                                          #
    #                                                                              #
    # My scripts are in no way associated with Canonical™, Ubuntu™ or Kubuntu™.    #
    # This script comes with ABSOLUTELY NO WARRANTY OF ANY KIND.                   #
    # It may be used, shared, copied and modified freely.                          #
    #                                                                              #
    # You can download my scripts from here: https://gitlab.com/scripts94          #
    #                                                                              #
    # I hope you find the script useful! Yours respectfully, Schwarzer Kater       #
    #                                                                              #
    ################################################################################
    
    versionnr="2.1.3"
    
    ########
    ## During this session let's make sure no "exotic" or interfering aliases can be
    ## used in this script
    ########
    shopt -u expand_aliases
    
    ########
    ## Display purpose of this script
    ########
    clear
    echo -e "########"
    echo -e "## This is a little helper script for Kubuntu™ (22.04 & later) users who want"
    echo -e "## to install the traditional Firefox from Mozilla.org (the way Debian"
    echo -e "## suggests) and use it complementary to or instead of the Firefox Snap."
    echo -e "## It can also remove Firefox, if it has been installed by this script before,"
    echo -e "## and has been tested many times with Kubuntu™ 22.04 LTS up to 24.04 LTS."
    echo -e "##"
    echo -e "## -> IMPORTANT:"
    echo -e "##    It is advised to run this script after a full upgrade of the system"
    echo -e "##    (either with Discover or in Konsole with \"sudo apt update && sudo apt"
    echo -e "##    full-upgrade\") AND a reboot."
    echo -e "## -> Firefox from Mozilla.org can simply be used alternatively with or without"
    echo -e "##    the Firefox Snap and no further actions are to be taken."
    echo -e "##    It will remain installed when release-upgrading (e.g. from 23.10 to"
    echo -e "##    24.04 LTS) and causes no conflicts during the upgrade process."
    echo -e "##    This version of Firefox behaves roughly like the ones for macOS™ or"
    echo -e "##    Windows™ do and updates itself independently from Discover or APT package"
    echo -e "##    management (and can ask you before updating - if you would prefer being"
    echo -e "##    asked see the Firefox settings)."
    echo -e "##"
    echo -e "## You will be asked if you want [1] to download and install Firefox from"
    echo -e "## Mozilla.org OR [2] to remove a previously installed Firefox, but if you"
    echo -e "## choose [3] to cancel, no changes at all are made to your system."
    echo -e "## After you chose [1] to install Firefox from Mozilla.org, you will be asked"
    echo -e "## to select your preferred language next."
    echo -e "##"
    echo -e "## For some more information about what is done in detail see the comments"
    echo -e "## within the script itself."
    echo -e "##"
    echo -e "## This script comes with ABSOLUTELY NO WARRANTY OF ANY KIND."
    echo -e "## It may be used, shared, copied and modified freely."
    echo -e "##"
    echo -e "## I hope you find the script useful! Yours respectfully, Schwarzer Kater"
    echo -e "########\n"
    read -p "Press [Enter] to continue, press [Ctrl] [c] to exit. "
    
    ########
    ## Make sure the computer has established an internet connection with IP and DNS
    ## before running the rest of the script
    ########
    if ! ping -c1 -W1 ubuntu.com &> /dev/null && ! ping -c1 -W1 kde.org &> /dev/null && ! ping -c1 -W1 kernel.org &> /dev/null
    then
        echo -e "\n###############################################################################\n## -> AN ERROR OCCURED! <-                                                   ##\n## An Internet connection is required to run this script.                    ##\n## -> Please connect your Kubuntu™ to the Internet and run the script again! ##\n###############################################################################\n"
        exit 1
    fi
    
    ########
    ## Install or remove the traditional Firefox from Mozilla.org (the way Debian
    ## suggests - see: https://wiki.debian.org/Firefox#From_Mozilla_binaries) and
    ## remove the Mozilla Team PPA placeholder files (if they have been installed by
    ## a previous version of the scripts)
    ########
    inff=0
    fferror=0
    rmff=0
    
    # Test if the operating system is Kubuntu 22.04 or later / Ubuntu 22.04 or
    # later-based with KDE Plasma
    if ! cat /etc/os-release | grep -Ei "(^|\s)VERSION=(|\s|\"|\s\")(22.04|22.10|23.04|23.10|24.04)" &> /dev/null || ! echo "$XDG_CURRENT_DESKTOP" | grep -i KDE &> /dev/null
    then
        echo -e "\n######################################################################\n## This script is meant to be used with Kubuntu™ 22.04 LTS or later ##\n## -> PROCEED AT YOUR OWN RISK!                                     ##\n######################################################################"
    fi
    
    echo -e "\n########\n## Do you want to:\n## [1] DOWNLOAD and INSTALL the latest stable Firefox from Mozilla.org?"
    echo -e "##     or\n## [2] REMOVE Firefox from /opt if it has been installed by this script before?"
    if test -d "$HOME/.mozilla/firefox" ; then echo -e "##     (Your user data e.g. in \".mozilla\" within your $HOME" ; fi
    if test -d "$HOME/.mozilla/firefox" ; then echo -e '##     directory will NOT be touched!)'; fi
    echo -e "##     or\n## [3] CANCEL the download and installation or removal?\n########"
    
    # Give option to cancel the installation
    while true
    do
        read -p "[1], [2] or [3] " choice
        if [[ "${choice}" = "1" ]]
        then
            # Test if traditional Firefox is still installed in 20.04 up to 21.10
            if cat /etc/os-release | grep -Ei "(^|\s)VERSION=(|\s|\"|\s\")(20.04|20.10|21.04|21.10)" &> /dev/null && [[ -d "/usr/lib/firefox" ]] && command -v firefox &> /dev/null
            then
                echo -e "\n########\n## Traditional Firefox seems to already be installed -> not changing anything …\n########"
                break
            # Test if traditional Firefox is installed conventionally/from a PPA or
            # to /opt
            elif [[ -d "/usr/lib/firefox" && $(command -v firefox) ]] || test -x "/opt/firefox/firefox"
            then
                echo -e "\n########\n## Traditional Firefox seems to already be installed -> not changing anything …\n########"
                break
            else
                # Choose from a list of languages and download latest stable Firefox
                # in the chosen language to $HOME - see:
                # https://ftp.mozilla.org/pub/firefox/releases/latest/README.txt
                echo
                PS3="$(printf '\nChoose your preferred language for Firefox: ')"
                select languagesel in "Acholi lang=ach" "Afrikaans lang=af" "Albanian lang=sq" "Arabic lang=ar" "Aragonese lang=an" "Armenian lang=hy-AM" "Assamese lang=as" "Asturian lang=ast" "Azerbaijani lang=az" "Basque lang=eu" "Belarusian lang=be" "Bengali (Bangladesh) lang=bn-BD" "Bengali (India) lang=bn-IN" "Bosnian lang=bs" "Breton lang=br" "Bulgarian lang=bg" "Catalan lang=ca" "Chinese (Simplified) lang=zh-CN" "Chinese (Traditional) lang=zh-TW" "Croatian lang=hr" "Czech lang=cs" "Danish lang=da" "Dutch lang=nl" "English (British) lang=en-GB" "English (South African) lang=en-ZA" "English (US) lang=en-US" "Esperanto lang=eo" "Estonian lang=et" "Finnish lang=fi" "French lang=fr" "Frisian lang=fy-NL" "Fulah lang=ff" "Gaelic (Scotland) lang=gd" "Galician lang=gl" "German lang=de" "Greek lang=el" "Gujarati (India) lang=gu-IN" "Hebrew lang=he" "Hindi (India) lang=hi-IN" "Hungarian lang=hu" "Icelandic lang=is" "Indonesian lang=id" "Irish lang=ga-IE" "Italian lang=it" "Kannada lang=kn" "Kazakh lang=kk" "Khmer lang=km" "Korean lang=ko" "Latvian lang=lv" "Ligurian lang=lij" "Lithuanian lang=lt" "Lower Sorbian lang=dsb" "Macedonian lang=mk" "Maithili lang=mai" "Malay lang=ms" "Malayalam lang=ml" "Marathi lang=mr" "Norwegian (Bokmål) lang=nb-NO" "Norwegian (Nynorsk) lang=nn-NO" "Oriya lang=or" "Persian lang=fa" "Polish lang=pl" "Portuguese (Brazilian) lang=pt-BR" "Portuguese (Portugal) lang=pt-PT" "Punjabi (India) lang=pa-IN" "Romanian lang=ro" "Romansh lang=rm" "Russian lang=ru" "Serbian lang=sr" "Sinhala lang=si" "Slovak lang=sk" "Slovenian lang=sl" "Songhai lang=son" "Spanish (Argentina) lang=es-AR" "Spanish (Chile) lang=es-CL" "Spanish (Mexico) lang=es-MX" "Spanish (Spain) lang=es-ES" "Swedish lang=sv-SE" "Tamil lang=ta" "Telugu lang=te" "Thai lang=th" "Turkish lang=tr" "Ukrainian lang=uk" "Upper Sorbian lang=hsb" "Uzbek lang=uz" "Vietnamese lang=vi" "Welsh lang=cy" "Xhosa lang=xh"
                do
                    if [[ $REPLY -ge 1 && $REPLY -le 88 ]]
                    then
                        languagename="$(echo "${languagesel}" | sed 's/ lang.*$//')"
                        languagecode="$(echo "${languagesel}" | sed 's/^.* //')"
                        echo -e "\n########\n## -> Downloading ${languagename} version of Firefox from Mozilla.org …\n########\n" && wget -O "$HOME/firefox-latest-stable.tar.bz2" "https://download.mozilla.org/?product=firefox-latest&os=linux64&${languagecode}"
                        # Test if archive was e.g. not available at all
                        if [[ $? -ne 0 ]]
                        then
                            echo -e '\n#############################################################################\n## -> AN ERROR OCCURED! <-                                                 ##'
                            echo -e "## Firefox seems not to be available in your chosen language at the moment ##\n## -> not changing anything …                                              ##\n#############################################################################"
                            fferror=1
                            break 2
                        fi
                        break
                    else
                        echo -e "\n-> Please enter a valid number [1-88]!"
                    fi
                done
                
                # Decompress the downloaded Firefox archive
                echo -e "########\n## -> Decompressing the Firefox archive …\n########\n" && tar xjf "$HOME/firefox-latest-stable.tar.bz2" -C "$HOME"
                # Test if archive was e.g. corrupt
                if [[ $? -ne 0 ]]
                then
                    echo -e '\n##############################################\n## -> AN ERROR OCCURED! <-                  ##'
                    echo -e "## This Firefox archive seems to be corrupt ##\n## -> not changing anything …               ##\n##############################################"
                    fferror=1
                    break
                fi
    
                # Install Firefox to /opt
                echo -e "########\n## -> Installing Firefox from Mozilla.org to /opt …\n########\n" && sudo mv "$HOME/firefox" /opt
    
                # Clean up: remove the dowloaded Firefox archive from $HOME
                if test -e "$HOME/firefox-latest-stable.tar.bz2" ; then echo -e "\n########\n## -> Cleaning up …\n########\n" && rm -f "$HOME/firefox-latest-stable.tar.bz2" ; fi
    
                # Make the new Firefox accessible from CLI (don't use /usr/bin -
                # otherwise the link could be removed when release-upgrading /
                # (re)installing the Firefox Snap)
                # Create /usr/local/bin before, if it doesn't exit
                sudo mkdir -p /usr/local/bin && sudo ln -s /opt/firefox/firefox /usr/local/bin/firefox
    
                # Create firefox.desktop in /usr/local/share/applications to give
                # all users access to the new Firefox via application menu (don't
                # use /usr/share/applications - otherwise the .desktop file could be
                # removed when release-upgrading / (re)installing the Firefox Snap)
                echo -e "########\n## -> Writing firefox.desktop file to /usr/local/share/applications/ :\n########\n"
                # Create /usr/local/share/applications before, if it doesn't exit
                sudo mkdir -p /usr/local/share/applications
                echo -e "[Desktop Entry]\nName=Firefox from Mozilla.org\nComment=Browse the World Wide Web\nGenericName=Web Browser\nKeywords=Internet;WWW;Browser;Web;Explorer\nExec=/opt/firefox/firefox %u\nTerminal=false\nType=Application\nIcon=/opt/firefox/browser/chrome/icons/default/default128.png\nCategories=Network;WebBrowser;\nMimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;\nStartupNotify=true\nActions=Private;\n\n[Desktop Action Private]\nExec=/opt/firefox/firefox --private-window %u\nName=Open in private mode\n" | sudo tee /usr/local/share/applications/firefox.desktop
    
                # Rebuild the KDE Plasma application menu index as sometimes this
                # helps when the new Firefox does not show properly (especially if
                # the Firefox Snap is additionally installed)
                if command -v kbuildsycoca5 &> /dev/null ; then kbuildsycoca5 &> /dev/null ; fi
    
                # Make the new Firefox the main application for www-browser
                sudo update-alternatives --install /usr/bin/x-www-browser x-www-browser /opt/firefox/firefox 200 && sudo update-alternatives --set x-www-browser /opt/firefox/firefox
    
                # Test if the "Mozilla Team PPA" placeholder file from a previous
                # version of the scripts is in $HOME and remove it
                if test -f "$HOME/.mtppa-placeholder" ; then rm -f "$HOME/.mtppa-placeholder" ; fi
    
                # Test if the "prefer Firefox from the Mozilla Team PPA APT pinning"
                # placeholder file from a previous version of the scripts is in
                # $HOME and remove it
                if test -f "$HOME/.mtppa-ffpin-placeholder" ; then  rm -f "$HOME/.mtppa-ffpin-placeholder" ; fi
    
                # Test if the "Firefox from the Mozilla Team PPA" placeholder file
                # from a previous version of the scripts is in $HOME and remove it
                if test -f "$HOME/.mtff-placeholder" ; then rm -f "$HOME/.mtff-placeholder" ; fi
    
                inff=1
                break
            fi
        elif [[ "${choice}" = "2" ]]
        then
            # Test if traditional Firefox has been installed to /opt by this script
            if ! [[ -x "/opt/firefox/firefox" && -r "/usr/local/share/applications/firefox.desktop" ]]
            then
                echo -e "\n########\n## Traditional Firefox does not seem to have been installed from Mozilla.org\n## to /opt by this script before -> not changing anything …\n########"
                break
            else
                # Give option to cancel
                echo -e "\n########\n## Are you sure you want to UNINSTALL traditional Firefox from /opt ?\n########"
                while true
                do
                    read -p "[y/n] " removeff
                    if [[ "${removeff}" = [Yy] ]]
                    then
                        # Remove Firefox from /opt, the link from /usr/local/bin and
                        # the .desktop file from /usr/local/share/applications
                        echo -e "\n########\n## -> Removing traditional Firefox from /opt …\n########\n"
                        sudo rm -rf /opt/firefox && sudo rm -f /usr/local/bin/firefox && sudo rm -f /usr/local/share/applications/firefox.desktop
    
                        # Rebuild the KDE Plasma application menu index
                        if command -v kbuildsycoca5 &> /dev/null ; then kbuildsycoca5 &> /dev/null ; fi
    
                        rmff=1
                        break 2
                    elif [[ "${removeff}" = [Nn] ]]
                    then
                        echo -e "\n########\n## You have canceled the removal of traditional Firefox from /opt\n## -> not changing anything …\n########"
                        break 2
                    fi
                done
            fi
        elif [[ "${choice}" = "3" ]]
        then
            echo -e "\n########\n## You have canceled the download & installation or removal of the traditional\n## Firefox -> not changing anything …\n########"
            break
        fi
    done
    
    ########
    ## Report what has been done
    ########
    summary_first="\n########\n## -> SUMMARY:"
    summary_what="## Firefox has been successfully installed from Mozilla.org to /opt ."
    summary_where="## -> You can find it in your application menu under \"Internet\"."
    summary_snap="## -> Be aware that the Firefox Snap is still additionally installed.\n##    DON'T START AND USE BOTH the traditional Firefox AND the Firefox Snap\n##    SIMULTANEOUSLY - this can lead to problems!"
    summary_snapremove="##    You can remove and block Snaps entirely with the \"get_rid_of_Snap\" script."
    summary_nochange="## The script has made no changes at all to your system!"
    summary_last="## Have a nice day and enjoy Kubuntu™.\n########\n"
    summary_lastff="## Have a nice day and enjoy your new Firefox and Kubuntu™.\n########\n"
    savesummary=0
    
    if [[ ${inff} = 1 ]]
    then
        # Tell that Firefox has been installed from Mozilla.org
        echo -e "${summary_first}"
        echo -e "${summary_what}"
        echo -e "${summary_where}"
        if snap list firefox &> /dev/null ; then echo -e "${summary_snap}" ; fi
        if snap list firefox &> /dev/null ; then echo -e "${summary_snapremove}" ; fi
        echo -e "${summary_lastff}"
        savesummary=1
    elif [[ ${rmff} = 1 ]]
    then
        # Tell that Firefox has been removed from /opt
        echo -e "${summary_first}"
        echo -e "## Firefox has been successfully removed from /opt ."
        if test -d "$HOME/.mozilla/firefox" ; then echo -e "## -> Your user data in \".mozilla\" within your $HOME" ; fi
        if test -d "$HOME/.mozilla/firefox" ; then echo -e '##    directory has NOT been touched!'; fi
        echo -e "${summary_last}"
        savesummary=1
    elif [[ ${inff} = 0 ]] && [[ ${fferror} = 1 ]]
    then
        # Tell that an error has occured and nothing has been changed
        echo -e "${summary_first}"
        echo -e '## Firefox could NOT be installed from Mozilla.org to /opt !'
        echo -e "## It was either not available in your chosen language at the moment or this\n## archive was corrupt…"
        echo -e "## -> Please run the script again and choose a more \"common\" (but nonetheless\n##    fitting) language version instead."
        echo -e "##    After the installation you can change to your preferred language in\n##    Firefox when it starts for the first time or later on in the Firefox\n##    settings."
        echo -e "${summary_nochange}"
        echo -e "${summary_last}"
    else
        # Tell that nothing has been changed
        echo -e "${summary_first}"
        echo -e "${summary_nochange}"
        echo -e "${summary_last}"
    fi
    
    ########
    ## Give option to save the summary, if the script has changed anything
    ########
    appendix="$(date +"%Y-%m-%d_%H:%M")"
    
    if [[ ${savesummary} = 1 ]]
    then
        echo -e "########\n## -> Do you want to save this summary for future reference?\n########"
        while true
        do
            read -p "[y/n] " wantsave
            if [[ "${wantsave}" = [Yy] ]] && [[ ${inff} = 1 ]]
            then
                # Save to text file that Firefox has been installed from Mozilla.org
                echo -e "${summary_first}" > "$HOME/install_traditional_Firefox-SUMMARY_${appendix}.txt"
                echo -e "${summary_what}" >> "$HOME/install_traditional_Firefox-SUMMARY_${appendix}.txt"
                echo -e "${summary_where}" >> "$HOME/install_traditional_Firefox-SUMMARY_${appendix}.txt"
                if snap list firefox &> /dev/null ; then echo -e "${summary_snap}" >> "$HOME/install_traditional_Firefox-SUMMARY_${appendix}.txt" ; fi
                if snap list firefox &> /dev/null ; then echo -e "${summary_snapremove}" >> "$HOME/install_traditional_Firefox-SUMMARY_${appendix}.txt" ; fi
                echo -e "${summary_lastff}" >> "$HOME/install_traditional_Firefox-SUMMARY_${appendix}.txt"
                echo -e "Script version used: ${versionnr}" >> "$HOME/install_traditional_Firefox-SUMMARY_${appendix}.txt"
                echo -e "\n########\n## -> The summary of what has been done by this script was saved to:\n##    $HOME/install_traditional_Firefox-SUMMARY_${appendix}\n########\n"
                break
            elif [[ "${wantsave}" = [Yy] ]] && [[ ${rmff} = 1 ]]
            then
                # Save to text file that Firefox has been removed from /opt
                echo -e "${summary_first}" > "$HOME/install_traditional_Firefox-SUMMARY_${appendix}.txt"
                echo -e "## Firefox has been successfully removed from /opt ." >> "$HOME/install_traditional_Firefox-SUMMARY_${appendix}.txt"
                if test -d "$HOME/.mozilla/firefox" ; then echo -e "## -> Your user data in \".mozilla\" within your $HOME" >> "$HOME/install_traditional_Firefox-SUMMARY_${appendix}.txt" ; fi
                if test -d "$HOME/.mozilla/firefox" ; then echo -e '##    directory has NOT been touched!' >> "$HOME/install_traditional_Firefox-SUMMARY_${appendix}.txt" ; fi
                echo -e "${summary_last}" >> "$HOME/install_traditional_Firefox-SUMMARY_${appendix}.txt"
                echo -e "Script version used: ${versionnr}" >> "$HOME/install_traditional_Firefox-SUMMARY_${appendix}.txt"
                echo -e "\n########\n## -> The summary of what has been done by this script was saved to:\n##    $HOME/install_traditional_Firefox-SUMMARY_${appendix}\n########\n"
                break
            elif [[ "${wantsave}" = [Nn] ]]
            then
                echo
                break
            fi
        done
    fi
    ​​
    Last edited by Schwarzer Kater; May 12, 2024, 10:39 AM. Reason: update to version 2.1.3
    Debian KDE & LXQt • Kubuntu & Lubuntu • openSUSE KDE • Windows • macOS X
    Desktop: Lenovo ThinkCentre M75s • Laptop: Apple MacBook Pro 13" • and others

    get rid of Snap script (20.04 +)reinstall Snap for release-upgrade script (20.04 +)
    install traditional Firefox script (22.04 +)​ • install traditional Thunderbird script (24.04)

    Comment


    • GreyGeek
      GreyGeek commented
      Editing a comment
      The bash foo is strong in this one!
      ~Yoda

    #3
    I recommend De-Snapping your install prior to running this: https://www.kubuntuforums.net/forum/...et-rid-of-snap

    Please Read Me

    Comment


    • GreyGeek
      GreyGeek commented
      Editing a comment
      For sure!
      And even if you don't use the script!

    #4
    -> Firefox from Mozilla.org can be used with or without Snap easily, regardless the Kubuntu version or if you want to release-upgrade or not.


    -> For Firefox from the Mozilla Team PPA I indeed strongly recommend to remove Snap - either do it by the given option in this script or use the "get_rid_of_Snap" and "reinstall_Snap_for_release-upgrade" scripts (they will automatically take care of everything "Firefox from the Mozilla Team PPA"-related for you).

    But one could also use Firefox from the Mozilla Team PPA​ additionally to the Firefox Snap version or Snap in general.
    One of the problems then are the conflicting entries/.desktop files for the (KDE) application menu…
    Also it gets a bit more complicated when you do a release-upgrade (due to the necessary manual removal of APT pinning for Firefox before and re-enabling of the Mozilla Team PPA and reapplying of the Firefox APT pinning and reinstallation after the release-upgrade).

    If one wants to keep using Snap and manually removes the APT pinning for Firefox from the Mozilla Team PPA and deinstalls Firefox from the Mozilla Team PPA before the release-upgrade, the three necessary steps after the release-upgrade can be done with this "install_traditional_Firefox" script again.
    Last edited by Schwarzer Kater; Apr 26, 2023, 09:10 AM. Reason: language corrections and updated information for 1.2.0
    Debian KDE & LXQt • Kubuntu & Lubuntu • openSUSE KDE • Windows • macOS X
    Desktop: Lenovo ThinkCentre M75s • Laptop: Apple MacBook Pro 13" • and others

    get rid of Snap script (20.04 +)reinstall Snap for release-upgrade script (20.04 +)
    install traditional Firefox script (22.04 +)​ • install traditional Thunderbird script (24.04)

    Comment


      #5
      During the past days I have tested the script with Kubuntu 23.10 and with upgrades from Kubuntu 22.04 -> 23.04 -> 23.10 both on "bare metal" and in virtual machines.
      Works.
      Debian KDE & LXQt • Kubuntu & Lubuntu • openSUSE KDE • Windows • macOS X
      Desktop: Lenovo ThinkCentre M75s • Laptop: Apple MacBook Pro 13" • and others

      get rid of Snap script (20.04 +)reinstall Snap for release-upgrade script (20.04 +)
      install traditional Firefox script (22.04 +)​ • install traditional Thunderbird script (24.04)

      Comment


        #6
        I updated the script - it now does not support the Mozilla Team PPA any longer!

        This version has been prepared and pretested for Kubuntu 24.04 LTS - I will keep testing it until the official release of 24.04, of course.​
        Last edited by Schwarzer Kater; Apr 05, 2024, 01:26 PM.
        Debian KDE & LXQt • Kubuntu & Lubuntu • openSUSE KDE • Windows • macOS X
        Desktop: Lenovo ThinkCentre M75s • Laptop: Apple MacBook Pro 13" • and others

        get rid of Snap script (20.04 +)reinstall Snap for release-upgrade script (20.04 +)
        install traditional Firefox script (22.04 +)​ • install traditional Thunderbird script (24.04)

        Comment


          #7
          Now the script can (finally ) remove the traditional Firefox from /opt, if it has been installed by this script before​.
          Plain error handling for e.g. a bad connection or a missing particular language version has also been added…
          Debian KDE & LXQt • Kubuntu & Lubuntu • openSUSE KDE • Windows • macOS X
          Desktop: Lenovo ThinkCentre M75s • Laptop: Apple MacBook Pro 13" • and others

          get rid of Snap script (20.04 +)reinstall Snap for release-upgrade script (20.04 +)
          install traditional Firefox script (22.04 +)​ • install traditional Thunderbird script (24.04)

          Comment


            #8
            Re-tested dozens of times with Kubuntu 24.04 LTS (development branch, Beta and final release): works.
            Debian KDE & LXQt • Kubuntu & Lubuntu • openSUSE KDE • Windows • macOS X
            Desktop: Lenovo ThinkCentre M75s • Laptop: Apple MacBook Pro 13" • and others

            get rid of Snap script (20.04 +)reinstall Snap for release-upgrade script (20.04 +)
            install traditional Firefox script (22.04 +)​ • install traditional Thunderbird script (24.04)

            Comment


              #9
              Just tested the install script, but without removing snap version. Is that a problem? Also the mozilla version is not taking on the characteristics of the desktop or the behaviors. I install the plastik window icons, but the script install fiefox does not take these on (the install for 22.04 did/does), and raising and lowering the window with the border clicks does not work either.

              The kubuntu default snap version does not obey the plastik icon theme or the raise and lower commands either.

              Both obey the "focus follows mouse" option.

              Settings: Breeze global theme, Oxygen window theme, plastik icon theme, focus follows mouse (mouse precedent), focus stealing Low, left click on border of active window is raise, right click on border of active window is lower.

              All KDE default applications obey all the settings.

              Does this script install another snap? There was a repo for 22.04 that was used to just do the apt install firefox command, with no script. Is this different in 24.04?

              thanks

              Comment


                #10
                No, it is no problem to test this "traditional" Firefox version without removing the Firefox Snap.
                1. As the instructions say: Just don't start and use both the traditional Firefox and the Firefox Snap simultaneously - this can lead to problems!​​
                2. Also the Plasma Panel can get a bit confused when icons of the Firefoxes are present - this has no impact on the browsers' functionality, when in doubt just use the application menu to start the "traditional" Firefox (called "Firefox from Mozilla.org") or the Firefox Snap when both are installed.
                Both 1. and 2. have nothing to do with the specific way how this script installs the "traditional" Firefox - this will also happen if you install it e.g. from a repository or a PPA and use it complementary to the Snap version.
                You can also remove the "traditional" Firefox from /opt again with this script if you want to.

                For questions regarding other themes and icons:
                Know that Firefox like e.g. also GIMP (no matter if Snap, Flatpak, installed by this script, or …) is a GTK application - in contrary to all KDE programs being Qt applications. This matters when modifying e.g. their looks.

                And no: this script does not install another Snap - it downloads the official Firefox .tar from the Mozilla website, decompresses it and installs it to /opt , including e.g. the appropriate .desktop file et al.
                See the comments within the script itself and also see https://support.mozilla.org/en-US/kb...mozilla-builds. and https://wiki.debian.org/Firefox#From_Mozilla_binaries.

                A problem with using an external repository or a PPA for Firefox is that Canonical/Kubuntu (22.04 and later) installs a "fake" Firefox to /usr/bin when trying to install it with apt (to "secretely" install the Firefox Snap instead) - and that can lead to additional problems in *Ubuntu (in contrary to using the way this script/the official instructions from Mozilla do it) if you don't additionally block/de-prioritise this "fake" package by APT pinning in /etc/apt/preferences.d . The latter blocking can cause trouble when release-upgrading to the next Kubuntu version for example (the reinstall Snap for release-upgrade script tries to solve those problems if you used APT pinning, by the way).
                Last edited by Schwarzer Kater; May 05, 2024, 07:28 AM. Reason: typos
                Debian KDE & LXQt • Kubuntu & Lubuntu • openSUSE KDE • Windows • macOS X
                Desktop: Lenovo ThinkCentre M75s • Laptop: Apple MacBook Pro 13" • and others

                get rid of Snap script (20.04 +)reinstall Snap for release-upgrade script (20.04 +)
                install traditional Firefox script (22.04 +)​ • install traditional Thunderbird script (24.04)

                Comment


                  #11
                  Thanks.

                  Way above my head. No idea what the difference between /opt and /usr/bin is.

                  I used the PPA method in 22.04 and all the window decoration rules and behaviors were 100% followed. I don't do release upgrades though, I do completely new installs, and might never cross over into the preferences.d issues. Or maybe not.

                  At this point, the snap for firefox is a no-go for me because it actually does not obey the window management rules of raising and lowering and that makes it impossible for me to keep windows layered properly to work with.
                  I will retest just the script version and see how that behaves.

                  Thanks

                  Comment


                    #12
                    Update to version 2.1.3:
                    better late than never - now all scripts test first if the computer has established an internet connection as this is needed.​​
                    Debian KDE & LXQt • Kubuntu & Lubuntu • openSUSE KDE • Windows • macOS X
                    Desktop: Lenovo ThinkCentre M75s • Laptop: Apple MacBook Pro 13" • and others

                    get rid of Snap script (20.04 +)reinstall Snap for release-upgrade script (20.04 +)
                    install traditional Firefox script (22.04 +)​ • install traditional Thunderbird script (24.04)

                    Comment


                      #13
                      SOLVED: TLDR: I had installed manually to /opt via earlier mozilla PPA, and made a distribution/policy.json file to prevent nags about the installed version not being in sync with the mozilla PPA. I removed that install with "sudo apt-get remove firefox-mozilla-build", then installed with this script, and all is well, and presumably updates will just work now.

                      Old post in case it's useful:

                      Hey Schwarzer Kater​ -- I just upgraded to 24.10 (not sure if that's relevant) and I'm a little confused about the proper upgrade process here... Under 24.04 I used your script (thanks a lot for it!) and I'm correctly running /opt/firefox/firefox, but it's still at version 112.0.2... what is the proper procedure to do a firefox update, since there are no PPAs relating to this install?

                      Thanks!

                      Edit: I copied my profile from my snap firefox over to this one, and I see that about: policies (space inserted because I can't defeat the smilies) has disabled update (causing "updates disabled by your system administrator" to be enabled in the settings...) I will try disabling this and doing an update to see what happens.

                      Edit2: I see that the issue is /opt/firefox/distribution/policies.json -- however if I fetch the latest from download.mozilla.org it does not have this "distribution" directory at all. So maybe the smartest thing is to just use your script to uninstall the installed version, then install the latest? I will try that next.

                      Edit3: ah, it appears that it was not your script that installed this version in /opt after all ("Traditional Firefox does not seem to have been installed from Mozilla.org to /opt by this script before -> not changing anything​"). So it seems that I have some other manual install in /opt, perhaps before I found your script. I will try removing the distrinution/ directory next.
                      Last edited by chconnor; Oct 27, 2024, 09:46 PM.

                      Comment

                      Working...
                      X