Skip to content

Commit

Permalink
lxd-stophook-wrapper: Adds stop hook wrapper for the lxd command
Browse files Browse the repository at this point in the history
This command is intended to replace the `lxd` command in the snap so that
existing running containers that are stopping will call this script as part of
their stop hooks.

This will then "route" the command to the `lxd-user` command that will be
statically compiled so that it can connect to the running LXD daemon via
the unix socket to indicate the container is stopping, even after refreshing
the LXD snap to a different core base snap.

Signed-off-by: Thomas Parrott <[email protected]>
  • Loading branch information
tomponline committed Oct 9, 2024
1 parent 34dd519 commit 979e998
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lxd-stophook-wrapper/lxd
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
# Use exec so that this script process is replaced.
# This avoids polluting the process tree with this wrapper script.
if [ "$1" = "callhook" ]; then
exec /snap/lxd/current/bin/lxd-user "$@"
else
exec lxd "$@"
fi

0 comments on commit 979e998

Please sign in to comment.