Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ensure_snap_package_managment ()
- {
- # Description: Function to ensure that snap is installed.
- # Globals: none
- # Dependencies: [distro pakcage managment] [function: check_dependencies] [Internet access]
- # Arguments: None
- # Outputs: stdout
- # Returns: Standard return codes 1/0
- # Usage: Call the function with no arguments
- # NOTE: https://www.fosslinux.com/42410/snap-vs-flatpak-vs-appimage-know-the-differences-which-is-better.htm
- #
- # Like Snap, Flatpak is another distribution independent package format aimed to simplify overall
- # app distribution and usage in Linux systems. Previously known as xdg-app, the framework was based
- # on the concept of running applications in a secure virtual sandbox without requiring root privileges
- # or posing a security threat to the system.
- # Flatpak was officially released in 2015 with a reliable backup from Red Hat, Endless Computers, and
- # Collabora. It targeted primarily three Desktop Environments. That is FreeDesktop, KDE, and GNOME. The
- # Linux distributions currently having this framework are arch Linux, Debian, Fedora, Mageia,
- # Solus, and Ubuntu.The Flatpak framework itself is developed in C programming and released under the
- # LGPL license. The lead developer is Alexander Larsson – a Red Hat employee. Like Snapcraft for Snap,
- # Flatpak also has the Flathub app store where users can find and install all Flatpak packages.
- # Initially, Flathub only allowed open-source publishing applications on the website but
- # has recently approved the publishing of proprietary apps.
- # Additionally, unlike Snap, where we have a single repository controlled by Canonical to install and update
- # software packages, Flatpak supports the use of multiple repos. The one significant disadvantage with this
- # package is the lack of support for Servers.
- #
- # * --- PREFFERRED Software install (Security + Control) ---- *
- #
- # CAPABILITY TABLE:
- # +-----------------------------------------------------+----------------+-------------+-----------------+
- # | Features | Snap | Flatpak | AppImage |
- # +-----------------------------------------------------+----------------+-------------+-----------------+
- # | Permission Controls Toggles | Yes | Yes | No |
- # | Sandboxing Support | Yes | Yes | Yes |
- # | Sandboxing Mandatory | Yes | Yes | No |
- # | App Portability | Yes | Yes | No |
- # | Native Theme Support | Yes (with | Yes (with c | Yes (with cav |
- # | Support for Bundled Libraries | Yes | Yes | Yes |
- # | Fully Contained Single Executable Support | No | No | Yes |
- # | Online App Store | Yes | Yes | Yes |
- # | Multi-version Parallel Apps Support | Yes | Yes | Yes |
- # | Automatic Updates | Yes | Yes | Yes(with cave |
- # | Support for Chrome OS (through Crostini containers) | Yes | Yes | Yes |
- # | App Size | higher than | higher than | Lowest |
- # | Number of Applications Available in the App Store | Highest | Lowest | Somewhere in n |
- # | Plugins for Desktop App Store Software | Yes | Yes | No |
- # +-----------------------------------------------------+----------------+-------------+-----------------+
- # End of documentation
- if [[ $(echo "$OSTYPE" |grep "linux") ]]; then
- if hostnamectl |grep "SUSE" 2>/dev/null ; then
- # Special case for suse
- zypper addrepo --refresh https://download.opensuse.org/repositories/system:/snappy/openSUSE_Leap_$(cat /etc/os-release |grep VERSION_ID |cut -d= -f2|cut -d\" -f2) snappy
- write_information "${FUNCNAME[0]}: Ensuring SNAP software distribution system is available..."
- check_dependencies snapd || write_error "${FUNCNAME[0]}: Failed to satisfy dependecy SNAP!"
- systemctl enable snapd ; systemctl start snapd ; systemctl status snapd
- systemctl is-active --quiet snapd || return 1
- if [[ -e /snap ]]; then
- write_information "SNAP classic support present... "
- else
- ln -s /var/lib/snapd/snap /snap
- fi
- return $?
- elif hostnamectl |grep "Solus" 2>/dev/null ; then
- write_information "${FUNCNAME[0]}: Solus has snap support built in..." ;return 0
- elif hostnamectl |grep "Ubuntu" 2>/dev/null ; then
- write_information "${FUNCNAME[0]}: Ubuntu has snap support built in..." ;return 0
- elif hostnamectl |grep "Zorin" 2>/dev/null ; then
- write_information "${FUNCNAME[0]}: Zoring has snap support built in..." ;return 0
- elif hostnamectl |grep "Manjaro" 2>/dev/null ; then
- write_information "${FUNCNAME[0]}: Manjaro has snap support built in..." ;return 0
- else
- # For distributions that do not need to add a repository to install snap
- # But would need to install it from their standard reopsitory....
- write_information "${FUNCNAME[0]}: Ensuring SNAP software distribution system is available..."
- check_dependencies snapd || write_error "${FUNCNAME[0]}: Failed to satisfy dependecy SNAP!"
- systemctl enable snapd ; systemctl start snapd ; systemctl status snapd
- systemctl is-active --quiet snapd || return 1
- if [[ -e /snap ]]; then
- write_information "SNAP classic support present... "
- else
- ln -s /var/lib/snapd/snap /snap
- fi
- return $?
- fi
- elif [[ "$OSTYPE" == "darwin"* ]]; then
- write_error "${FUNCNAME[0]}: Mac OSX is currently not supported with snap..." ; return 1
- elif [[ "$OSTYPE" == "cygwin" ]]; then
- write_error "${FUNCNAME[0]}: CYGWIN is currently unsupported with snap..." ; return 1
- elif [[ "$OSTYPE" == "msys" ]]; then
- write_error "${FUNCNAME[0]}: Lightweight shell is currently unsupported with snap... " ; return 1
- elif [[ "$OSTYPE" == "freebsd"* ]]; then
- write_error "${FUNCNAME[0]}: Free BSD is currently unsupported with snap... " ; return 1
- else
- echo "I have no Idea what this system is" ; return 1
- fi
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement