From Flathub to Snapcraft

Hi all… I have a simple flatpak that runs on Flathub…

this is my manifest.

I really don’t know how to map it on snapcraft. can you show me an initial example on how to port it on snapcraft?

1 Like

You can follow our workshop excercise.

ok. I have created something like this:

name: fireflyluciferin
base: core24
version: '2.17.12'
summary: my summary
description: |
  mydescription

grade: stable
confinement: strict
icon: meta/gui/fireflyluciferin.png

apps:
  fireflyluciferin:
    command: bin/FireflyLuciferin
    plugs:
      - network
      - home
      - network-bind
      - pulseaudio
      - x11
      - removable-media
      - desktop
      - desktop-legacy

parts:
  fireflyluciferin:
    plugin: nil
    source: .
    source-type: local
    build-packages:
      - wget
      - libgtk2.0-dev
      - libzstd1
      - zstd
      - tar
    override-build: |
      snapcraftctl build
      wget -nc https://dpsoftware.org/2.17.12/FireflyLuciferinLinux.deb
      ar x FireflyLuciferinLinux.deb
      tar xvf data.tar.zst
      ls -la
      ls -la opt/fireflyluciferin
      mkdir -p $SNAPCRAFT_PART_INSTALL/bin
      mkdir -p $SNAPCRAFT_PART_INSTALL/usr/share/applications
      mkdir -p $SNAPCRAFT_PART_INSTALL/meta/gui      
      cp -R opt/fireflyluciferin/* $SNAPCRAFT_PART_INSTALL
      cp opt/fireflyluciferin/lib/app/classes/build_assets/org.dpsoftware.FireflyLuciferin.snap.desktop $SNAPCRAFT_PART_INSTALL/usr/share/applications/fireflyluciferin.desktop
      cp opt/fireflyluciferin/lib/app/classes/org/dpsoftware/gui/img/luciferin_logo.png $SNAPCRAFT_PART_INSTALL/meta/gui/fireflyluciferin.png

I can create the snap, install it, and execute it. If I run the snap snap run fireflyluciferin

I can see the output of my program crashing because it lacks deps and permission but this is another story.

I can see the app installed in the app store but there is no icon and more importantly there is no buttton to open it. leave alone that my .desktop doesn’t added an icon of the app in the app launcher.

as you can see from the yaml file I copied the .desktop file in $SNAPCRAFT_PART_INSTALL/usr/share/applications/fireflyluciferin.desktop and the icon in $SNAPCRAFT_PART_INSTALL/meta/gui/fireflyluciferin.png

is this correct?

this is my desktop file:

[Desktop Entry]
Name=Firefly Luciferin
Comment=Ambient lighting software
Exec=${SNAP}/bin/FireflyLuciferin
Icon=${SNAP}/meta/gui/fireflyluciferin.png
Terminal=false
Type=Application
Categories=AudioVideo;Audio;Video;Game

You should probably omit the ${SNAP} part:

[Desktop Entry]
...
Exec=bin/FireflyLuciferin
Icon=meta/gui/fireflyluciferin.png
...