How to specify command to run on build?

I’ve just setup automatic GitHub building for my Snap, and I get “Failed to Build” with the following issue: Failed to generate snap metadata: The specified command ‘usr/bin/run’ defined in the app ‘duckpowered’ is not executable.

I know what the issue is, the .sh file thar usr/bin/run is created from is not executable, on my local machine I fix this by running: chmod +x

What I’m wondering is how can I get the Snap auto-build environment to automatically make that file executable? Is there a way to get it to run a command on build?

Thank you for your help, and have a great day!

You’d usually do minor touchups like this by using overrides, for example:

    source: whereever
    plugin: cmake
    override-build: |
     snapcraftctl build
     chmod +x $SNAPCRAFT_PART_INSTALL/bin/

On the Core22 base, recommended practise would be to replace snapcraftctl build with craftctl default and $SNAPCRAFT_PART_INSTALL with $CRAFT_PART_INSTALL.


Thank you so much for your help! It worked.