Results 1 to 3 of 3

Thread: Check Whether an Application is Debian Package/Flatpak/Snap

  1. #1
    Join Date
    Aug 2011
    Beans
    97

    Check Whether an Application is Debian Package/Flatpak/Snap

    My program runs a function of an application. The command for the Snap doesn't work for the Debian Package and vice-versa. I could just try each in turn and ignore the command which fails, but that seem a bit crude to me. Is there a command I could use or a variable I could check to see whether the user has installed the application from a Debian application, a Flatpak or a Snap?

    The only way I can think of is to use a command like snap info {program} > filename.txt then read and edit the text file to find whether it indicates success or not. That's very long-winded.
    Last edited by ChrisOfBristol; 4 Weeks Ago at 10:35 PM.
    Ubuntu 20.04

  2. #2
    Join Date
    Feb 2010
    Location
    Obscurial Springs
    Beans
    14,234
    Distro
    Ubuntu Budgie Development Release

    Re: Check Whether an Application is Debian Package/Flatpak/Snap

    I don't know of a single command, but there could be one.Process of elimination is not an elegant solution and some applications listed in the output are default and not user installed.
    Code:
    snap list
    Code:
    flatpak list
    Last edited by Frogs Hair; 4 Weeks Ago at 10:59 PM.
    “Start where you are. Use what you have. Do what you can".

    Ubuntu Documentation Search: Popular Pages
    Ubuntu: Security Basics
    Ubuntu: Flavors

  3. #3
    Join Date
    Aug 2011
    Beans
    97

    Arrow Re: Check Whether an Application is Debian Package/Flatpak/Snap

    I have found 3 useful commands on a post elsewhere:
    command -v {application name} (Posix compliant systems only)
    hash {application name}
    type {application name}

    If I call type from Python, it produces the most useful result - a zero if it has found the application and something else if not. Since the Debian package and the Snap have different names, I can try both and see which comes up with a zero.
    Ubuntu 20.04

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •