forked from canonical/lxd-pkg-snap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync with latest-edge (latest-candidate) (canonical#639)
- Loading branch information
Showing
4 changed files
with
44 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ version: "6.1" | |
grade: stable | ||
summary: LXD - container and VM manager | ||
license: AGPL-3.0 | ||
title: LXD | ||
description: |- | ||
LXD is a system container and virtual machine manager. | ||
|
@@ -303,7 +304,8 @@ parts: | |
after: | ||
- sqlite | ||
source: https://github.com/canonical/dqlite | ||
source-depth: 1 | ||
# XXX: We often cherry-pick for candidate builds so don't do shallow clone | ||
#source-depth: 1 | ||
source-commit: 6339f32a9b15b31163798de309a585927b22025f # v1.18.0 | ||
source-type: git | ||
plugin: autotools | ||
|
@@ -316,6 +318,17 @@ parts: | |
build-packages: | ||
- liblz4-dev | ||
- libuv1-dev | ||
override-build: | | ||
set -ex | ||
# Git cherry-picks | ||
cd ../src | ||
git config user.email "[email protected]" | ||
git config user.name "LXD snap builder" | ||
git cherry-pick -x 7a37bdfbf0e83edc09ecc621f02a6c7159c9a816 # Segfault fix | ||
craftctl default | ||
organize: | ||
usr/lib/: lib/ | ||
prime: | ||
|
@@ -1437,7 +1450,7 @@ parts: | |
source: https://github.com/canonical/lxd | ||
# XXX: We often cherry-pick for candidate builds so don't do shallow clone | ||
#source-depth: 1 | ||
source-commit: 6671ca9577c09bd57aacceaa94217e094acdb4c6 # Pre LXD 6.2 | ||
source-commit: ad6f13a99181648dd81e29566cb04d4f64bb89a6 # Pre LXD 6.2 | ||
source-type: git | ||
after: | ||
- lxc | ||
|
@@ -1502,7 +1515,12 @@ parts: | |
# Build the binaries | ||
go build -trimpath -o "${CRAFT_PART_INSTALL}/bin/lxc" github.com/canonical/lxd/lxc | ||
go build -trimpath -o "${CRAFT_PART_INSTALL}/bin/lxd" -tags=libsqlite3 github.com/canonical/lxd/lxd | ||
# Build LXD server binary into ${CRAFT_PART_INSTALL}/sbin/lxd so that it does not conflict with the | ||
# lxd-stophook wrapper script which is stored in ${CRAFT_PART_INSTALL}/bin/lxd. | ||
# This way when a container stops it will call "/snap/lxd/current/bin/lxd callhook" which is handled by the | ||
# lxd-stophook script, which in turn will execute "/snap/lxd/current/bin/lxd-user callhook" to notify LXD. | ||
go build -trimpath -o "${CRAFT_PART_INSTALL}/sbin/lxd" -tags=libsqlite3 github.com/canonical/lxd/lxd | ||
# Build static binaries | ||
CGO_ENABLED=0 go build -trimpath -o "${CRAFT_PART_INSTALL}/bin/lxd-agent" -tags=agent,netgo github.com/canonical/lxd/lxd-agent | ||
|
@@ -1543,7 +1561,7 @@ parts: | |
usr/share/misc/: share/misc/ | ||
var/lib/usbutils/usb.ids: share/misc/ | ||
usr/sbin/: bin/ | ||
sbin/: bin/ | ||
sbin/sgdisk: bin/ | ||
prime: | ||
- bin/dnsmasq | ||
- bin/getfattr | ||
|
@@ -1564,9 +1582,9 @@ parts: | |
- share/misc/usb.ids | ||
|
||
- bin/lxc | ||
- bin/lxd | ||
- bin/lxd-agent | ||
- bin/lxd-user | ||
- sbin/lxd | ||
|
||
lxd-ui: | ||
source: https://github.com/canonical/lxd-ui | ||
|
@@ -1642,10 +1660,12 @@ parts: | |
rm -rf "${CRAFT_PRIME}/usr/share/" | ||
# Strip binaries (excluding shell scripts and LXCFS) | ||
# The "${CRAFT_PRIME}/bin/lxd" file is ignored as that is the lxd-stophook wrapper script. | ||
find "${CRAFT_PRIME}"/bin -type f \ | ||
-not -path "${CRAFT_PRIME}/bin/ceph" \ | ||
-not -path "${CRAFT_PRIME}/bin/editor" \ | ||
-not -path "${CRAFT_PRIME}/bin/lxc-checkconfig" \ | ||
-not -path "${CRAFT_PRIME}/bin/lxd" \ | ||
-not -path "${CRAFT_PRIME}/bin/nvidia-container-cli" \ | ||
-not -path "${CRAFT_PRIME}/bin/remote-viewer" \ | ||
-not -path "${CRAFT_PRIME}/bin/snap-query" \ | ||
|
@@ -1657,6 +1677,9 @@ parts: | |
-not -path "${CRAFT_PRIME}/bin/gpu-2404-custom-wrapper" \ | ||
-exec strip --strip-all {} + | ||
# This is the actual LXD binary. | ||
strip --strip-all "${CRAFT_PRIME}/sbin/lxd" | ||
# Strip binaries not under bin/ due to being dynamically | ||
# added to the path with `snap set lxd`, like `criu.enable=true` | ||
for binary in "${CRAFT_PRIME}/criu/criu"; do | ||
|
@@ -1698,6 +1721,7 @@ parts: | |
organize: | ||
commands/snap-query: bin/ | ||
hooks/: snap/hooks/ | ||
wrappers/lxd-stophook: bin/lxd | ||
wrappers/editor: bin/ | ||
wrappers/remote-viewer: bin/ | ||
wrappers/sshfs: bin/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/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 "$@" | ||
fi | ||
|
||
echo "lxd-stophook: Invalid argument: ${1}" >&2 | ||
exit 1 |