Use golang for the core snap configure hook

The configure hook for the `core’ snap is currently written n shell. This is not ideal as the code becomes harder and harder to maintain, the recent PR to add support for proxy settings to core config (https://github.com/snapcore/core/pull/48) highlighted the problem once more.

After the unsuccessful proposal to port the code to python (https://forum.snapcraft.io/t/use-python-for-the-core-snap-configure-hook) here is another proposal to port it to go (WIP branch: https://github.com/snapcore/snapd/compare/master...mvo5:configure-hook?expand=1)

The strawman proposal is:

  • add new /usr/lib/snapd/core-configure
  • once that has landed, change the core snap configure hook to just exec the above command

Alternatively instead of making it a separate command we could make it a (hidden) command in snapctl.

1 Like

I think it makes sense to have it as part of snapctl, as an implementation detail only as you point out (snapctl internal configure-core?). It saves space, avoids yet another command, and the context is appropriate: a lot of the things this tool will be doing depends on snapctl-based APIs.

Do you see any downsides on that which led you towards the independent command?

1 Like

This has landed in master now.