Can the defaults section of a gadget snap be accessed and modified dynamically?
<gadget-snap-id>.defaults.<snap-id>.key = "some value obtained at run time"
Perhaps an explanation of what I am trying to achieve would help.
I have a snap that has an install hook that will set values based on keys in the gadget file defaults section.
... defaults: <snap_id>: passphrase: hardcoded_passphrase ...
This work fine if I want to use a hardcoded value. And the same value for every device. However, I want this value to NOT be hardcoded and be based on a dynamic device value - in this case the mac id of eth0, which is stored in /sys/class/net/eth0/address.
So, I was hoping that in the prepare_device hook, I could read this value and then set the appropriate defaults key something like:
<gadget-name>.defaults.<snapid>.passphrase = “$(cat /sys/class/net/eth0/address)”
This would effectively let me dynamically set the default passphrase for each individual device with nothing hardcoded or having to set that value manually in each gadget file and creating individual images for every device.
Thanks for any help or suggestions