I have this application(gizmo) which I have configured to run from the snapcraft.yaml file. I am making changes and I want to run this application from a configure hook.
So I tried to accomplish this by putting the application binary in the path “snap/hooks/configure”.
When I try to execute the application using “sudo snap get gizmo”
I get the error: “snap gizmo has no configuration”
Can you give more explanation of what you are trying to do? What do you want to do with the configure hook and what does your app do?
Do you mean that you want to run the gizmo.mundane command in the configure hook of your snap? You cannot use the gizmo.mundane command itself for that. You need to manually execute the binary in your application and use snapcraft-runner. This is an example of how to do that: https://github.com/IBCNServices/easy-openvpn-server/blob/master/snap/hooks/configure
This is the configure hook:
#!/bin/bash
set -e
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
$SNAP/snap/command-chain/snapcraft-runner $SNAP/bin/setup.py setup
The setup.py script that this hook runs is also one of the commands of my app.
Users can run easy-openvpn-server, but these commands are only available to users, not to the snap itself. So the configure hook of the snap needs to run bin/setup.py directly. Note that the configure hook always runs as root so your application will always be executed as root if you execute it from the configure hook.
When a user runs the snap set key=value1 command, the configure hook of the application will run, and in that hook, you can see value1 by running snap get key.
When a configure hook runs the command snap set key=value2, value1 is now value2, but this does not execute anything.