<div dir="ltr"><div><div>Got it, thanks so much.<br><br></div>Br<br></div>Enwei<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 9, 2016 at 3:38 PM, Didier Roche <span dir="ltr"><<a href="mailto:didrocks@ubuntu.com" target="_blank">didrocks@ubuntu.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"><span class="">
<div class="m_-4435627333589711443moz-cite-prefix">Le 09/11/2016 à 07:44, Enwei Zhang a
écrit :<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>
<div>Hi Didier,<br>
</div>
Sorry to cut in.<br>
</div>
Is "hooks" working now in snapcraft?<br>
</div>
I encountered error:<br>
I used below in snapcraft.yaml:<br>
<br>
hooks: # Top-level YAML attribute, parallel to `apps`<br>
upgrade: # Hook name, corresponds to executable name<br>
plugs: [network] # Or any other plugs required by
this hook<br>
<br>
enwei@XPS-13-9350:~/work/snap/<wbr>simple-daemon$ snapcraft<br>
Issues while validating snapcraft.yaml: Additional
properties are not allowed ('hooks' was unexpected)<br>
enwei@XPS-13-9350:~/work/snap/<wbr>simple-daemon$ snapcraft
--version<br>
2.20<br>
</div>
</div>
</div>
</div>
</blockquote>
<br></span>
No, right now, they are only implemented in snapd.<br>
You need to place the correct file in the meta/hooks/ folder (if you
are using snapcraft, do this in the prime/ directory, before
"snapcraft snap prime/").<br>
<br>
There is an example available at
<a class="m_-4435627333589711443moz-txt-link-freetext" href="https://github.com/snapcore/snapd/tree/master/tests/lib/snaps/basic-hooks/meta/hooks" target="_blank">https://github.com/snapcore/<wbr>snapd/tree/master/tests/lib/<wbr>snaps/basic-hooks/meta/hooks</a>.<br>
<br>
Hope that helps!<span class="HOEnZb"><font color="#888888"><br>
Didier</font></span><div><div class="h5"><br>
<blockquote type="cite">
<div dir="ltr">
<div>
<div>
<div><br>
</div>
Thanks.<br>
<br>
</div>
Br<br>
</div>
Enwei<br>
<div>
<div>
<div>
<div><br>
<div>
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Tue, Nov 8, 2016 at 6:28 PM, Didier
Roche <span dir="ltr"><<a href="mailto:didrocks@ubuntu.com" target="_blank">didrocks@ubuntu.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>Le 08/11/2016 à 04:52, Kyle Fazzari a écrit :<br>
><br>
> On Nov 6, 2016 21:51, "Didier Roche" <<a href="mailto:didrocks@ubuntu.com" target="_blank">didrocks@ubuntu.com</a><br>
</span><span>> <mailto:<a href="mailto:didrocks@ubuntu.com" target="_blank">didrocks@ubuntu.com</a>>>
wrote:<br>
>><br>
>> Le 06/11/2016 à 00:22, Boris Rybalkin a écrit :<br>
>> ><br>
>> > Hello,<br>
>> ><br>
>><br>
>> Hey Boris,<br>
>> ><br>
>> > I want to generate my config on snap install
using snap location<br>
>> > variables.<br>
>> ><br>
>> > From the docs configure hook is only
triggered when 'snap set' is<br>
>> > called. Will configure also be called on
install and upgrade?<br>
>> ><br>
>> I didn't try it myself yet, but from what I heard
yeah, they will be run<br>
>> at that time. Kyle can confirm (and if so, we'll
update to the<br>
>> documentation to reflect that).<br>
><br>
> When I wrote it (and the docs) it was only run with
`snap set`. I<br>
> believe it's been modified since then to run upon
initial install as<br>
> well as upgrade; indeed Gustavo mentioned that it
should serve as an<br>
> install and an upgrade hook. The docs weren't updated
with this change,<br>
> it seems. That recommendation should also be
documented.<br>
><br>
> Kyle<br>
><br>
<br>
</span>FYI, opened <a href="https://github.com/ubuntudesign/snapcraft.io/issues/216" rel="noreferrer" target="_blank">https://github.com/ubuntudesig<wbr>n/snapcraft.io/issues/216</a><br>
about it (after confirming manually this new behavior).<br>
<br>
So, to answer on the initial reply: yes, the hooks are ran
on install<br>
and upgrade.<br>
<div class="m_-4435627333589711443HOEnZb">
<div class="m_-4435627333589711443h5"><br>
Cheers,<br>
Didier<br>
<br>
--<br>
Snapcraft mailing list<br>
<a href="mailto:Snapcraft@lists.snapcraft.io" target="_blank">Snapcraft@lists.snapcraft.io</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/snapcraft" rel="noreferrer" target="_blank">https://lists.ubuntu.com/mailm<wbr>an/listinfo/snapcraft</a><br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset class="m_-4435627333589711443mimeAttachmentHeader"></fieldset>
<br>
</blockquote>
<p><br>
</p>
</div></div></div>
<br>--<br>
Snapcraft mailing list<br>
<a href="mailto:Snapcraft@lists.snapcraft.io">Snapcraft@lists.snapcraft.io</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/snapcraft" rel="noreferrer" target="_blank">https://lists.ubuntu.com/<wbr>mailman/listinfo/snapcraft</a><br>
<br></blockquote></div><br></div>