-
Notifications
You must be signed in to change notification settings - Fork 670
Description
Edit: Added manifest for source build below.
@ devs if you could leave this open in case someone wanted to implement. Although verified would be great 🥇 https://docs.flathub.org/docs/for-app-authors/verification
I tested Flatpak install using pre-built appimage if anyone wants to build off of this. It is a bit cursed.
I got it to run in game but the app uses the directory where it is executed as its "home" directory and generate the files and folders there. I am not sure if this is how the executable runs or if it is flatpak related. Maybe an argument or something in the wrapper script would fix.
Not sure if there is enough permissions granted either.
I used this as a example of a flatpak using a pre-built appimg, they extract the appimg and use the extracted contents as the "bin".
https://github.com/flathub/io.github.spacingbat3.webcord/tree/master
(This is probably the best method but I didn't want to attempt compile: https://github.com/flathub/org.openmw.OpenMW)
Guide
Pre-req
- linux install, or windows wsl...?
- download latest linux zip, don't unzip
- install flatpak & flatpak-builder
- add flathub repo
- make a folder like ~/flatpak-build
Folder Structure
├─ flatpak-build/
│ ├─ files/
│ │ └─ apprun.sh # your launch script
│ ├─ SoH-Copper-Charlie-Linux.zip # (optional – you can replace this with a URL in the YAML)
│ └─ com.example.soh.yml # Flatpak manifest
Files/Code
apprun.sh
#!/usr/bin/env bash
appName="soh.elf"
# Run the extracted AppImage from the sandbox
# $@ should forward all arguments received by the wrapper, preserving quoting and spacing.
exec "/app/bin/soh/bin/$appName" "$@"
com.example.soh.yml
app-id: com.example.soh
runtime: org.freedesktop.Platform
runtime-version: '25.08' # choose a recent runtime
sdk: org.freedesktop.Sdk
command: apprun.sh # What flatpak would execute
modules:
- name: appimage-extract
buildsystem: simple
sources:
- type: file
path: ./SoH-Copper-Charlie-Linux.zip # local copy; you could also use a URL w/ sha hash
- type: file
dest-filename: apprun.sh
path: ./files/apprun.sh
build-commands:
# Install sh script, create bin dir
- install -Dm775 apprun.sh ${FLATPAK_DEST}/bin/apprun.sh
# Unzip the archive that you shipped with the repo
- unzip -q ./SoH-*-Linux.zip
# Move readme to location
- mv ./readme.txt ${FLATPAK_DEST}/bin
# Make the AppImage executable
- chmod +x ./soh.appimage
# Extract appimg
- ./soh.appimage --appimage-extract #> /dev/null 2>&1 ## optional silent
# Move the contents
- mv ./squashfs-root/usr ${FLATPAK_DEST}/bin/soh
### Flatpak permissions
finish-args:
# X11 or Wayland display
- --socket=x11
- --socket=wayland
- --socket=fallback-x11
- --socket=pulseaudio
# Access to the DRM device for direct rendering
- --device=dri
- --device=input
# Share the host’s IPC (needed by many GL/Vulkan apps)
- --share=ipc
- --share=network
# Allow the app to read its own files (already granted) and the home dir
- --filesystem=home
extensions:
- org.freedesktop.Platform.GL # pulls in the matching OpenGL/Vulkan libsSteps
- Make sh script executeable before build chmod +x ./apprun.sh
- go to build dir
- run
-- flatpak-builder --force-clean --install-deps-from=flathub build-dir com.example.soh.yml - should be built in ~/flatpak-built/build-dir
- if need to re-run build, just delete temp folder and build-dir folder. Not sure if right, but it was working ok for testing.
- build local repo & add (commands)
-- flatpak build-export repo build-dir
-- flatpak remote-add --no-gpg-verify local-repo repo - install from local repo
-- flatpak install local-repo com.example.soh - run installed app
-- flatpak run com.example.soh - uninstall flatpak, don't forget to remove folder in ~/.var
-- flatpak uninstall com.example.soh
In the example repo up top you can see how they add desktop entries and other stuff.