Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

AppImage doesn't find files #201

Closed
ReenigneArcher opened this issue May 15, 2022 · 2 comments
Closed

AppImage doesn't find files #201

ReenigneArcher opened this issue May 15, 2022 · 2 comments

Comments

@ReenigneArcher
Copy link

Previously during my AppImage build I was creating a portable home and config directory, manually loading my required files there, then bundling those directories along with the AppImage as a zip. I don't believe this is the best practice so attempting a different approach in order to have everything in a single file.

This is a cmake project and I have initially followed this tutorial: https://www.codeintrinsic.com/create-appimage-with-linuxdeploy-and-cmake/

I am struggling to get my AppImage to find files that are contained within the AppImage. I am probably missing something simple, but haven't been able to find an answer by searching for the past 2 days. Any guidance would be appreciated.

I have 3 main cmake variables that are of interest.

  • CMAKE_INSTALL_PREFIX
  • SUNSHINE_ASSETS_DIR (should be read only)
  • SUNSHINE_CONFIG_DIR (ideally user would have write access)

I've attempted several combinations but have yet to get the AppImage to run properly. I'll only show the config directory in this table for simplification.

Trial 1:
run: https://github.com/SunshineStream/Sunshine/actions/runs/2328210056
CMAKE_INSTALL_PREFIX = /usr
SUNSHINE_CONFIG_DIR = config
where program looks for config = config
config dir location in AppDir = usr/config (however folder is empty)
./sunshine.AppImage finds config = ❌
extract, then AppRun finds config = ❌
where program attempts to save config = n/a

Trial 2:
run: https://github.com/SunshineStream/Sunshine/actions/runs/2328317061
CMAKE_INSTALL_PREFIX = /usr/local/sunshine
SUNSHINE_CONFIG_DIR = config
where program looks for config = config
config dir location in AppDir = usr/local/sunshine/config (files present unlike Trial 1)
./sunshine.AppImage finds config = ❌
extract, then AppRun finds config = ❌
where program attempts to save config = n/a

Trial 3:
run: https://github.com/SunshineStream/Sunshine/actions/runs/2328361321
CMAKE_INSTALL_PREFIX = /
SUNSHINE_CONFIG_DIR = usr/local/sunshine/config
where program looks for config = usr/local/sunshine/config
config dir location in AppDir = usr/local/sunshine/config
./sunshine.AppImage finds config = ❌
extract, then AppRun finds config = ✅
where program attempts to save config = ~/.config/sunshine/usr/local/sunshine/config (fails to save anything here, but folder is created)

Trial 4:
run: https://github.com/SunshineStream/Sunshine/actions/runs/2328397391
CMAKE_INSTALL_PREFIX = .
SUNSHINE_CONFIG_DIR = usr/local/sunshine/config
where program looks for config = usr/local/sunshine/config
config dir location in AppDir = home/runner/work/Sunshine/Sunshine/build/usr/local/sunshine/config
./sunshine.AppImage finds config = ❌
extract, then AppRun finds config = ❌
where program attempts to save config = n/a

@ReenigneArcher
Copy link
Author

ReenigneArcher commented Aug 14, 2022

Revisiting this, hoping to find a solution so we can distribute a single AppImage file, instead of an ugly archive with portable home/config directories. A little has changed since I created the issue.

current run: https://github.com/LizardByte/Sunshine/actions/runs/2856262421
SUNSHINE_ASSETS_DIR = ./usr/share/sunshine/ (this is where the program looks for the assets)
config dir location in AppDir = ./usr/share/sunshine/
./sunshine.AppImage finds config = ❌
extract, then ./AppRun finds config = ✅

I think this is close, but clearly I am missing something. Can you provide any guidance? Tried with both the default AppRun (symlink to binary) and a custom bash AppRun (below).

I've also tried using our normal assets definition (/usr/share/sunshine/) and then patching per this documentation (https://docs.appimage.org/reference/best-practices.html?highlight=relocatable#closed-source-applications-with-compiled-in-absolute-paths) but that results in errors like "aborted (core dumped)"

custom AppRun (simplified)

#!/bin/bash

# run sunshine
./usr/bin/sunshine $@

Custom AppRun cannot find ./usr directory... makes sense, but I don't know how to solve it.

@ReenigneArcher
Copy link
Author

Adding this to the beginning of the custom AppRun file works fine.

HERE="$(dirname "$(readlink -f "${0}")")"

cd "$HERE" || exit

I referenced this AppRun: https://github.com/KurtPfeifle/ImageMagick/blob/master/appimage/AppRun

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant