Can't copy files using hooks

commented out the lines (https://github.com/xwiki-contrib/packaging-snap/blob/1452e936e0d1a30eab65e9122bed468c06babbfd/xwiki-jetty/snapcraft.yaml#L17)

similar logs:

Aug 11 18:21:54 vm2-Standard-PC-Q35-ICH9-2009 systemd[1]: Started snap.xwiki.hook.install.f9d745d3-5ce3-429d-9eea-061589d0ae8d.scope.

Aug 11 18:21:54 vm2-Standard-PC-Q35-ICH9-2009 systemd[1]: tmp-snap.rootfs_F7Yd7g.mount: Deactivated successfully.

Aug 11 18:21:54 vm2-Standard-PC-Q35-ICH9-2009 systemd[1]: snap.xwiki.hook.install.f9d745d3-5ce3-429d-9eea-061589d0ae8d.scope: Deactivated successfully.

Aug 11 18:21:54 vm2-Standard-PC-Q35-ICH9-2009 sudo[9928]: pam_unix(sudo:session): session closed for user root

lol … so i think i know what the issue is … can you create a snap/ dir in your source tree and mv the hooks dir into it ? snapcraft will simply not consider a toplevel hooks/ dir as belonging to the snap …

1 Like

lol the hooks seems to be running now …

throws the following error while installing the snap tho :

error: cannot perform the following tasks:

  • Run install hook of “xwiki” snap if present (run hook “install”:

  • TARGET=/var/snap/xwiki/x1/xwiki-platform-distribution-jetty-hsqldb-13.10.8
  • [ -d /var/snap/xwiki/x1/xwiki-platform-distribution-jetty-hsqldb-13.10.8 ]
  • mkdir -p /var/snap/xwiki/x1/xwiki-platform-distribution-jetty-hsqldb-13.10.8
  • [ ! -e /var/snap/xwiki/x1/xwiki-platform-distribution-jetty-hsqldb-13.10.8/stop_xwiki.sh ]
  • cp /snap/xwiki/x1/xwiki-platform-distribution-jetty-hsqldb-13.10.8/stop_xwiki.sh /var/snap/xwiki/x1/xwiki-platform-distribution-jetty-hsqldb-13.10.8/
  • exit 1 -----)

dont know what it means

the exit 1 prevents the hook from finishing, that prevents the whole snap from installing …

now that we know what was wrong you can remove the set -x and exit 1 lines again and it should work as expected …

1 Like

another thing i noticed …

you are using the dump plugin which will simply unpack the zip archive but not run any binaries from it

…so you do not really need build-packages: at all.

if you drop that block completely from your snapcraft.yaml your build will be 10x faster …

1 Like

thank you very much @ogra ,

it copies the files now …works flawlessly :slight_smile:

1 Like