Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

flatpak error #45

Closed
ledudulela opened this issue Jun 9, 2019 · 12 comments
Closed

flatpak error #45

ledudulela opened this issue Jun 9, 2019 · 12 comments
Labels
enhancement:compatibility Compatibility fix enhancement:wontfix Enhancement that won't be implemented

Comments

@ledudulela
Copy link

First, sorry for my english :)
When i try to execute the command: /betterdiscordctl install --flatpak
I've got an error: "ERROR: Discord installation not found."
So, I added comments on the following rows:

flatpak_location=$("$flatpak_bin" info --show-location com.discordapp.Discord)

flatpak_location=${flatpak_location##*$'\n'}

discord=${flatpak_location:?}/files/extra

and add this one to set discord variable with the real folder:
discord='/var/lib/flatpak/app/com.discordapp.Discord/x86_64/stable/8a0fc700c701feacfc3e8cc630fbcbd7ff98c13045cfdf5cbc1aea6e7b307378/files/extra/'

The command "./betterdiscordctl install --flatpak" is now ok.
So, I think there is a problem with the row: flatpak_location=$("$flatpak_bin" info --show-location com.discordapp.Discord) and the option "info" of flatpak.

Thank You

@ObserverOfTime
Copy link
Collaborator

What's the output of flatpak info --show-location com.discordapp.Discord?

@ledudulela
Copy link
Author

flatpak info --show-location com.discordapp.Discord
error: Unknown option --show-location

flatpak --version
Flatpak 0.8.9

OS: Linux Mint Debian Edition 3
uname -a
Linux pc1 4.9.0-9-amd64 #1 SMP Debian 4.9.168-1+deb9u2 (2019-05-13) x86_64 GNU/Linux

@ObserverOfTime
Copy link
Collaborator

Can you update flatpak? It seems that --show-location was introduced in v1.0.0.

@ledudulela
Copy link
Author

ledudulela commented Jun 10, 2019

No i can't . Flatpak installation depends on update system of LMDE .
So it's not a problem of your script but a version problem of flatpak.
In this case, you could obtain the directory of Discord with the command:

flatpak info com.discordapp.Discord
The return of this command is:
app/com.discordapp.Discord/x86_64/stable flathub 8a0fc700c701feacfc3e8cc630fbcbd7ff98c13045cfdf5cbc1aea6e7b307378

If you replace " flathub " (with space before and after) in this previous string by the last string you can build the installation directory:
discord='/var/lib/flatpak/app/com.discordapp.Discord/x86_64/stable/8a0fc700c701feacfc3e8cc630fbcbd7ff98c13045cfdf5cbc1aea6e7b307378/files/extra/'

It's just an idea :)

@ObserverOfTime ObserverOfTime added the enhancement:compatibility Compatibility fix label Jun 10, 2019
@ObserverOfTime
Copy link
Collaborator

ObserverOfTime commented Jun 10, 2019

I can't find a way to reliably get the location since v0.8.9 doesn't show whether it was installed system-wide or per-user. Moreover, the output of flatpak info is way too inconsistent between versions:

v1.4.0

$ flatpak info com.discordapp.Discord

Discord - Chat client

          ID: com.discordapp.Discord
         Ref: app/com.discordapp.Discord/x86_64/stable
        Arch: x86_64
      Branch: stable
     Version: 0.0.9
     License: LicenseRef-proprietary
      Origin: flathub
  Collection: org.flathub.Stable
Installation: system
   Installed: 3.0 MB
     Runtime: org.freedesktop.Platform/x86_64/18.08
         Sdk: org.freedesktop.Sdk/x86_64/18.08

      Commit: 8a0fc700c701feacfc3e8cc630fbcbd7ff98c13045cfdf5cbc1aea6e7b307378
      Parent: 0b2fdc203d5e26872dcec04ed18fa87edfc3c548ae57518a89baa2e1f39ff46d
     Subject: Use xdg-run/app/$id dir instead of custom one (f9017362)
        Date: 2019-05-29 01:22:17 +0000
$ flatpak info --show-location com.discordapp.Discord
/var/lib/flatpak/app/com.discordapp.Discord/x86_64/stable/8a0fc700c701feacfc3e8cc630fbcbd7ff98c13045cfdf5cbc1aea6e7b307378

v0.10.0

$ flatpak info com.discordapp.Discord
Ref: app/com.discordapp.Discord/x86_64/stable
ID: com.discordapp.Discord
Arch: x86_64
Branch: stable
Origin: flathub
Commit: 8a0fc700c701feacfc3e8cc630fbcbd7ff98c13045cfdf5cbc1aea6e7b307378
Location: /var/lib/flatpak/app/com.discordapp.Discord/x86_64/stable/8a0fc700c701feacfc3e8cc630fbcbd7ff98c13045cfdf5cbc1aea6e7b307378
Installed size: 3.0 MB
Runtime: org.freedesktop.Platform/x86_64/18.08
$ flatpak info com.discordapp.Discord | sed -n 's/Location: //p'
/var/lib/flatpak/app/com.discordapp.Discord/x86_64/stable/8a0fc700c701feacfc3e8cc630fbcbd7ff98c13045cfdf5cbc1aea6e7b307378

v0.8.9

$ flatpak info com.discordapp.Discord
app/com.discordapp.Discord/x86_64/stable flathub 8a0fc700c701feacfc3e8cc630fbcbd7ff98c13045cfdf5cbc1aea6e7b307378
$ flatpak info com.discordapp.Discord | sed 's| flathub |/|'
app/com.discordapp.Discord/x86_64/stable/8a0fc700c701feacfc3e8cc630fbcbd7ff98c13045cfdf5cbc1aea6e7b307378
$ # ^ closest I can get to the full path

@ObserverOfTime
Copy link
Collaborator

What I'm gonna do instead is make it so the -d, --discord & -m, --modules options can be used with --flatpak to manually specify the location:

betterdiscordctl $bdctl_command --flatpak \
  -d /var/lib/flatpak/app/com.discordapp.Discord/current/active/files/extra \
  -m ~/.var/app/com.discordapp.Discord/config/discord/$discord_version/modules
  • Replace $bdctl_command with whatever command you need (e.g. install).
  • Replace $discord_version with the current Discord version (e.g. 0.0.9).
  • If Discord was installed with --user then /var/lib/ should be ~/.local/share/.

@ObserverOfTime ObserverOfTime added the enhancement:wontfix Enhancement that won't be implemented label Jun 10, 2019
@ledudulela
Copy link
Author

Ok, you could suggest this options when "ERROR: Discord installation not found" message appear.
Anyway, thank you ++

@RyanHakurei
Copy link

@ObserverOfTime Nice workaround, but do note for some reason the "extra" folder did not exist for me and I had to manually create it.

@ObserverOfTime
Copy link
Collaborator

ObserverOfTime commented Nov 6, 2019

@ryaniskira It seems that either Discord's app or flatpak itself changed its folder structure. The new location is /var/lib/flatpak/app/com.discordapp.Discord/current/active/files/discord.

@RyanHakurei
Copy link

@ObserverOfTime

/var/lib/flatpak/app/com.discordapp.Discord/current/active/files/discord

I actually tried that first and it didn't work, manually creating the extra folder then pointing to that did work.

@ledudulela
Copy link
Author

It works for me.
Comments following lines (from 425 to 436):

  flatpak_version=$("$flatpak_bin" --version | sed -n 's/Flatpak //p')
  if [[ $(Semver::compare "$flatpak_version" '1.0.0') -eq -1 ]]; then
    die 'ERROR: You are using an unsupported version of Flatpak.' \
        'See https://github.com/bb010g/betterdiscordctl/issues/45'
  fi
  # flatpak sucks and doesn't use stderr for warnings.
  # https://github.com/flatpak/flatpak/blob/13e449b/app/flatpak-main.c#L259-L286
  # This really should be better for directories with newlines, but...
  # We're just going to grab the last line and hope for the best.
  flatpak_location=$("$flatpak_bin" info --show-location com.discordapp.Discord)
  flatpak_location=${flatpak_location##*$'\n'}
  discord=${flatpak_location:?}/files/extra

and add

  discord='/var/lib/flatpak/app/com.discordapp.Discord/current/active/files/discord/'

@ObserverOfTime
Copy link
Collaborator

ObserverOfTime commented Nov 22, 2019

You can achieve the same thing by using -d '/var/lib/flatpak/app/com.discordapp.Discord/current/active/files/discord/'. On the other hand, thanks to your comment I noticed that I ought to update that last line.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement:compatibility Compatibility fix enhancement:wontfix Enhancement that won't be implemented
Projects
None yet
Development

No branches or pull requests

3 participants