apps:
  activate:
    command: commands/daemon.activate
    daemon: oneshot
    plugs:
    - lxd-support
    - system-observe
  benchmark:
    command: commands/lxd-benchmark
    plugs:
    - lxd-support
    - system-observe
  buginfo:
    command: commands/buginfo
    plugs:
    - lxd-support
    - system-observe
  check-kernel:
    command: commands/lxd-check-kernel
    plugs:
    - lxd-support
    - system-observe
  daemon:
    command: commands/daemon.start
    daemon: simple
    plugs:
    - lxd-support
    - network-bind
    - system-observe
    reload-command: commands/daemon.reload
    restart-condition: on-failure
    slots:
    - lxd
    sockets:
      unix:
        listen-stream: $SNAP_COMMON/lxd/unix.socket
        socket-mode: 432
    stop-command: commands/daemon.stop
    stop-timeout: 600s
  lxc:
    command: commands/lxc
    completer: etc/bash_completion.d/snap.lxd.lxc
    plugs:
    - lxd-support
    - system-observe
  lxc-to-lxd:
    command: commands/lxc-to-lxd
    plugs:
    - lxd-support
    - system-observe
  lxd:
    command: commands/lxd
    plugs:
    - lxd-support
    - system-observe
  migrate:
    command: commands/lxd-migrate
    plugs:
    - lxd-support
    - system-observe
  user-daemon:
    command: commands/lxd-user
    daemon: simple
    plugs:
    - lxd-support
    - network-bind
    - system-observe
    restart-condition: on-failure
    sockets:
      unix:
        listen-stream: $SNAP_COMMON/lxd-user/unix.socket
        socket-mode: 432
    stop-timeout: 600s
assumes:
- snapd2.39
base: core20
confinement: strict
contact: lxd@lists.canonical.com
description: |-
  LXD is a system container and virtual machine manager.

  It offers a simple CLI and REST API to manage local or remote instances,
  uses an image based workflow and support for a variety of advanced features.

  Images are available for all Ubuntu releases and architectures as well
  as for a wide number of other Linux distributions. Existing
  integrations with many deployment and operation tools, makes it work
  just like a public cloud, except everything is under your control.

  LXD containers are lightweight, secure by default and a great
  alternative to virtual machines when running Linux on Linux.

  LXD virtual machines are modern and secure, using UEFI and secure-boot
  by default and a great choice when a different kernel or operating
  system is needed.

  With clustering, up to 50 LXD servers can be easily joined and managed
  together with the same tools and APIs and without needing any external
  dependencies.


  Supported configuration options for the snap (snap set lxd [<key>=<value>...]):

    - ceph.builtin: Use snap-specific Ceph configuration [default=false]
    - ceph.external: Use the system's ceph tools (ignores ceph.builtin) [default=false]
    - criu.enable: Enable experimental live-migration support [default=false]
    - daemon.debug: Increase logging to debug level [default=false]
    - daemon.group: Set group of users that have full control over LXD [default=lxd]
    - daemon.user.group: Set group of users that have restricted LXD access [default=lxd]
    - daemon.preseed: Pass a YAML configuration to `lxd init` on initial start
    - daemon.syslog: Send LXD log events to syslog [default=false]
    - daemon.verbose: Increase logging to verbose level [default=false]
    - lvm.external: Use the system's LVM tools [default=false]
    - lxcfs.pidfd: Start per-container process tracking [default=false]
    - lxcfs.loadavg: Start tracking per-container load average [default=false]
    - lxcfs.cfs: Consider CPU shares for CPU usage [default=false]
    - lxcfs.debug: Increase logging to debug level [default=false]
    - openvswitch.builtin: Run a snap-specific OVS daemon [default=false]
    - openvswitch.external: Use the system's OVS tools (ignores openvswitch.builtin) [default=false]
    - ovn.builtin: Use snap-specific OVN configuration [default=false]
    - shiftfs.enable: Enable shiftfs support [default=auto]
    - ui.enable: Enable the web interface [default=false]

  For system-wide configuration of the CLI, place your configuration in
  /var/snap/lxd/common/global-conf/ (config.yml and servercerts)
grade: stable
hooks:
  configure:
    plugs:
    - lxd-support
    - network
    - system-observe
  remove:
    plugs:
    - lxd-support
    - system-observe
issues: https://github.com/canonical/lxd/issues
name: lxd
parts:
  apparmor:
    build-attributes:
    - core22-step-dependencies
    build-packages:
    - g++
    - bison
    - flex
    - autoconf-archive
    - gettext
    override-build: |-
      set -ex

      cd ./libraries/libapparmor
      sh ./autogen.sh
      sh ./configure --prefix=/
      make
      make install

      cd ../../parser
      make
      make install

      mkdir "${SNAPCRAFT_PART_INSTALL}/bin"
      cp /sbin/apparmor_parser "${SNAPCRAFT_PART_INSTALL}/bin/"
      mkdir "${SNAPCRAFT_PART_INSTALL}/lib"
      cp /lib/libapparmor.so* "${SNAPCRAFT_PART_INSTALL}/lib/"
      mkdir "${SNAPCRAFT_PART_INSTALL}/lib/pkgconfig"
      cp /lib/pkgconfig/libapparmor.pc "${SNAPCRAFT_PART_INSTALL}/lib/pkgconfig/"

      set +ex
    plugin: autotools
    prime:
    - bin/apparmor_parser
    - lib/libapparmor.so.1
    - lib/libapparmor.so.1.*
    source: https://gitlab.com/apparmor/apparmor.git
    source-commit: 84a6bc1b6dcdfeabb1ed3597f01e314f3bcee5c1
    source-depth: 1
    source-type: git
  btrfs:
    build-attributes:
    - core22-step-dependencies
    organize:
      sbin/: bin/
    plugin: nil
    prime:
    - bin/btrfs
    - bin/btrfstune
    - bin/mkfs.btrfs
    source: snapcraft/empty
    stage-packages:
    - btrfs-progs
  ceph:
    build-attributes:
    - core22-step-dependencies
    organize:
      usr/bin/: bin/
      usr/lib/: lib/
    plugin: nil
    prime:
    - bin/ceph
    - bin/radosgw-admin
    - bin/rbd
    - lib/*/ceph
    - lib/*/libasn1.so*
    - lib/*/libatomic.so*
    - lib/*/libboost_context.so*
    - lib/*/libboost_iostreams.so*
    - lib/*/libboost_program_options.so*
    - lib/*/libboost_thread.so*
    - lib/*/libbrotlicommon.so*
    - lib/*/libbrotlidec.so*
    - lib/*/libcephfs*
    - lib/*/libcurl-gnutls*
    - lib/*/libgssapi.so*
    - lib/*/libhcrypto.so*
    - lib/*/libheimbase.so*
    - lib/*/libheimntlm.so*
    - lib/*/libhx509.so*
    - lib/*/libibverbs.so*
    - lib/*/libkrb5.so*
    - lib/*/liblber-2.4.so*
    - lib/*/libldap_r-2.4.so*
    - lib/*/libnghttp2.so*
    - lib/*/libpsl.so*
    - lib/*/librabbitmq.so*
    - lib/*/librados.so*
    - lib/*/librbd.so*
    - lib/*/librdmacm.so*
    - lib/*/libroken.so*
    - lib/*/librtmp.so*
    - lib/*/libsasl2.so*
    - lib/*/libsnappy.so*
    - lib/*/libssh.so*
    - lib/*/libwind.so*
    - lib/liboath.so*
    - lib/python3
    source: snapcraft/empty
    stage-packages:
    - ceph-common
  criu:
    build-attributes:
    - core22-step-dependencies
    build-packages:
    - asciidoc
    - libcap-dev
    - libnet1-dev
    - libnl-3-dev
    - libprotobuf-c-dev
    - libprotobuf-dev
    - protobuf-c-compiler
    - protobuf-compiler
    - xmlto
    organize:
      usr/lib/: lib/
    override-build: |
      set -ex

      [ "$(uname -m)" != "x86_64" ] && \
        [ "$(uname -m)" != "armv7l" ] && \
        [ "$(uname -m)" != "aarch64" ] && \
        [ "$(uname -m)" != "s390x" ] && \
        [ "$(uname -m)" != "ppc64le" ] && exit 0

      make
      mkdir -p "${SNAPCRAFT_PART_INSTALL}/criu/"
      cp criu/criu "${SNAPCRAFT_PART_INSTALL}/criu/"
    plugin: nil
    prime:
    - criu/*
    - lib/*/libnet*
    - lib/*/libproto*
    source: https://github.com/checkpoint-restore/criu
    source-commit: c2b48ff423aa663b3534a5ba96907366e4c1b408
    source-depth: 1
    source-type: git
    stage-packages:
    - libnet1
    - libprotobuf-c1
  dqlite:
    after:
    - sqlite
    autotools-configure-parameters:
    - --prefix=
    - --enable-build-raft
    build-attributes:
    - core22-step-dependencies
    build-packages:
    - liblz4-dev
    - libuv1-dev
    organize:
      usr/lib/: lib/
    plugin: autotools
    prime:
    - lib/libdqlite*so*
    - lib/*/libuv*
    source: https://github.com/canonical/dqlite
    source-commit: 1c3f95492dfb4c649356d5b6f2c031bcd3fd7c0f
    source-depth: 1
    source-type: git
    stage-packages:
    - liblz4-1
    - libuv1
  edk2:
    after:
    - nasm
    build-attributes:
    - core22-step-dependencies
    build-packages:
    - on amd64:
      - acpica-tools
      - uuid-dev
    - on arm64:
      - acpica-tools
      - uuid-dev
    override-build: |-
      [ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && exit 0

      # Apply patches
      patch -p1 < "${SNAPCRAFT_PROJECT_DIR}/patches/edk2-0001-force-DUID-LLT.patch"
      cp "${SNAPCRAFT_PROJECT_DIR}/patches/edk2-0002-logo.bmp" MdeModulePkg/Logo/Logo.bmp
      patch -p1 < "${SNAPCRAFT_PROJECT_DIR}/patches/edk2-0003-boot-delay.patch"
      patch -p1 < "${SNAPCRAFT_PROJECT_DIR}/patches/edk2-0004-gcc-errors.patch"

      ARCH="X64"
      PKG="OvmfPkg/OvmfPkgX64.dsc"
      FV_CODE="OVMF_CODE"
      FV_VARS="OVMF_VARS"
      if [ "$(uname -m)" = "aarch64" ]; then
          ARCH="AARCH64"
          PKG="ArmVirtPkg/ArmVirtQemu.dsc"
          FV_CODE="QEMU_EFI"
          FV_VARS="QEMU_VARS"
      fi

      # Run in a bash sub-shell as edksetup.sh requires it
      set -ex
      (
      cat << EOF
          . ./edksetup.sh
          make -C BaseTools ARCH=${ARCH}
          build -a ${ARCH} -t GCC49 -b RELEASE -p ${PKG} \
            -DSECURE_BOOT_ENABLE=TRUE \
            -DNETWORK_IP4_ENABLE=TRUE \
            -DNETWORK_IP6_ENABLE=TRUE \
            -DNETWORK_TLS_ENABLE=TRUE \
            -DNETWORK_HTTP_BOOT_ENABLE=TRUE \
            -DFD_SIZE_2MB \
            -DTPM_ENABLE=TRUE \
            -DTPM_CONFIG_ENABLE=TRUE \
            -DTPM2_ENABLE=TRUE \
            -DTPM2_CONFIG_ENABLE=TRUE
      EOF
      ) | bash -e

      mkdir -p "${SNAPCRAFT_PART_INSTALL}/share/qemu/"
      cp Build/*/*/FV/${FV_CODE}.fd "${SNAPCRAFT_PART_INSTALL}/share/qemu/OVMF_CODE.fd"
      cp Build/*/*/FV/${FV_VARS}.fd "${SNAPCRAFT_PART_INSTALL}/share/qemu/OVMF_VARS.fd"

      if [ "$(uname -m)" = "aarch64" ]; then
          truncate -s 64m "${SNAPCRAFT_PART_INSTALL}/share/qemu/OVMF_CODE.fd"
          truncate -s 64m "${SNAPCRAFT_PART_INSTALL}/share/qemu/OVMF_VARS.fd"
      fi
    override-pull: |-
      [ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && exit 0
      set -ex
      git clone https://github.com/tianocore/edk2 . -b edk2-stable202208

      # Pull submodules after switching to source-commit
      git submodule update --init --recursive

      git config user.email "noreply@lists.canonical.com"
      git config user.name "LXD snap builder"
    plugin: nil
    prime:
    - share/qemu/*
    source: https://github.com/tianocore/edk2
    source-depth: 1
    source-tag: IRRELEVANT
    source-type: git
  libmnl:
    autotools-configure-parameters:
    - --prefix=
    build-attributes:
    - core22-step-dependencies
    organize:
      usr/lib/: lib/
    plugin: autotools
    prime:
    - lib/libmnl*so*
    source: https://www.netfilter.org/projects/libmnl/files/libmnl-1.0.5.tar.bz2
    source-checksum: sha256/274b9b919ef3152bfb3da3a13c950dd60d6e2bcd54230ffeca298d03b40d0525
  libnftnl:
    after:
    - libmnl
    autotools-configure-parameters:
    - --prefix=
    build-attributes:
    - core22-step-dependencies
    organize:
      usr/lib/: lib/
    override-build: |
      snapcraftctl build

      sed -i "s# /lib/libmnl.la# ${SNAPCRAFT_STAGE}/lib/libmnl.la#g" "${SNAPCRAFT_PART_INSTALL}/lib/libnftnl.la"
    plugin: autotools
    prime:
    - lib/libnftnl*so*
    source: https://www.netfilter.org/projects/libnftnl/files/libnftnl-1.2.7.tar.xz
    source-checksum: sha256/9122774f968093d5c0bacddd67de480f31fa4073405a7fc058a34b0f387aecb3
  libseccomp:
    autotools-configure-parameters:
    - --prefix=
    build-attributes:
    - core22-step-dependencies
    build-packages:
    - gperf
    organize:
      usr/lib/: lib/
    plugin: autotools
    prime:
    - lib/libseccomp*so*
    source: https://github.com/seccomp/libseccomp
    source-commit: f0b04ab0b4fc0bc2cde6da1f407b4a487fe6d78f
    source-depth: 1
    source-type: git
  libtpms:
    autotools-configure-parameters:
    - --prefix=
    - --with-tpm2
    - --with-openssl
    build-attributes:
    - core22-step-dependencies
    organize:
      usr/lib/: lib/
    plugin: autotools
    prime:
    - lib/libtpms*so*
    source: https://github.com/stefanberger/libtpms
    source-commit: f8c2dc7e12a730dcca4220d7ac5ad86d13dfd630
    source-depth: 1
    source-type: git
  liburing:
    autotools-configure-parameters:
    - --prefix=
    build-attributes:
    - core22-step-dependencies
    organize:
      usr/lib/: lib/
    override-build: |-
      [ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && [ "$(uname -m)" != "ppc64le" ] && [ "$(uname -m)" != "s390x" ] && exit 0
      snapcraftctl build
    plugin: autotools
    prime:
    - lib/liburing*so*
    source: https://github.com/axboe/liburing
    source-commit: f4e42a515cd78c8c9cac2be14222834be5f8df2b
    source-depth: 1
    source-type: git
  libusb:
    autotools-configure-parameters:
    - --prefix=
    build-attributes:
    - core22-step-dependencies
    organize:
      usr/lib/: lib/
    plugin: autotools
    prime:
    - lib/libusb*so*
    source: https://github.com/libusb/libusb
    source-commit: d52e355daa09f17ce64819122cb067b8a2ee0d4b
    source-depth: 1
    source-type: git
  logrotate:
    build-attributes:
    - core22-step-dependencies
    organize:
      usr/bin/: bin/
      usr/lib/: lib/
      usr/sbin/: bin/
    plugin: nil
    prime:
    - bin/logrotate
    source: snapcraft/empty
    stage:
    - bin/logrotate
    stage-packages:
    - logrotate
  lvm:
    build-attributes:
    - core22-step-dependencies
    organize:
      sbin/: bin/
      usr/lib/: lib/
      usr/sbin/: bin/
    plugin: nil
    prime:
    - bin/cache_*
    - bin/dmeventd
    - bin/era_*
    - bin/lv*
    - bin/pdata_tools
    - bin/pv*
    - bin/thin_*
    - bin/vg*
    - -bin/vgimportclone
    - -bin/lvmconf
    - -bin/lvmdump
    - -bin/lvmetad
    - -bin/lvmpolld
    - etc/lvm/lvm.conf
    - lib/*/device-mapper/*
    - lib/*/libaio.so*
    - lib/*/libdevmapper*
    - lib/*/liblvm*
    - lib/*/libreadline.so*
    source: snapcraft/empty
    stage-packages:
    - dmeventd
    - lvm2
    - thin-provisioning-tools
  lxc:
    after:
    - apparmor
    - libseccomp
    build-attributes:
    - core22-step-dependencies
    build-packages:
    - libcap-dev
    - libdbus-1-dev
    - libgnutls28-dev
    - libselinux1-dev
    - pkg-config
    meson-parameters:
    - --prefix=/
    - -Dexamples=false
    - -Dman=false
    - -Dtools=false
    - -Dtests=false
    - -Dmemfd-rexec=false
    - -Dapparmor=true
    - -Dseccomp=true
    - -Dselinux=true
    - -Dcapabilities=true
    - -Drootfs-mount-path=/var/snap/lxd/common/lxc/
    - -Dlibexecdir=/snap/lxd/current/libexec/
    organize:
      share/lxc/hooks: lxc/hooks
      snap/lxd/current/libexec: libexec
      snap/lxd/current/lxc: lxc
    override-build: |
      set -ex

      cd ../src
      git config user.email "noreply@lists.canonical.com"
      git config user.name "LXD snap builder"

      cd ../build

      set +ex
      snapcraftctl build
      set -ex

      mkdir -p $SNAPCRAFT_PART_INSTALL/lxc/config/common.conf.d/
      ln -s /var/snap/lxd/common/lxc/local.conf $SNAPCRAFT_PART_INSTALL/lxc/config/common.conf.d/01-local.conf
    plugin: meson
    prime:
    - bin/lxc-checkconfig
    - lib/*/liblxc.so.1
    - lib/*/liblxc.so.1.*
    - lxc/config/common.conf.d
    - lxc/hooks/nvidia
    source: https://github.com/lxc/lxc
    source-commit: cb8e38aca27a23964941f0f011a8919aab8bebab
    source-type: git
  lxcfs:
    build-packages:
    - libfuse3-dev
    - libpam0g-dev
    - pkg-config
    - python3-jinja2
    meson-parameters:
    - --prefix=/
    - --datadir=/snap/lxd/current/
    - --localstatedir=/var/snap/lxd/common/var/
    - -Ddocs=false
    - -Dtests=false
    organize:
      lib/*/lxcfs/liblxcfs.so: lib/
      snap/lxd/current/lxc/config/common.conf.d/*: lxc/config/common.conf.d/
      snap/lxd/current/lxcfs/: lxcfs/
      usr/lib/: lib/
    override-build: |
      set -ex

      # Git cherry-picks
      cd ../src
      git config user.email "noreply@lists.canonical.com"
      git config user.name "LXD snap builder"

      set +ex
      snapcraftctl build
      set -ex

      patch -p1 $SNAPCRAFT_PART_INSTALL/snap/lxd/current/lxcfs/lxc.mount.hook < "${SNAPCRAFT_PROJECT_DIR}/patches/lxcfs-0001-hook.patch"
    plugin: meson
    prime:
    - bin/fusermount
    - bin/fusermount3
    - lib/*/libfuse3.so.*
    - bin/lxcfs
    - lib/liblxcfs.so
    - lxc/config/common.conf.d/00-lxcfs.conf
    - lxcfs/
    source: https://github.com/lxc/lxcfs
    source-commit: c1e2f51fbd97f042434f098d1d0f8e47ade5ad2a
    source-type: git
    stage-packages:
    - fuse3
  lxd:
    after:
    - lxc
    - dqlite
    - sqlite
    build-attributes:
    - core22-step-dependencies
    build-packages:
    - libacl1-dev
    - libudev-dev
    - pkg-config
    build-snaps:
    - go/1.24/stable
    organize:
      sbin/: bin/
      usr/bin/: bin/
      usr/lib/: lib/
      usr/sbin/: bin/
      usr/share/misc/: share/misc/
      var/lib/usbutils/usb.ids: share/misc/
    override-build: |
      set -ex

      # Git cherry-picks
      cd ../src
      git config user.email "noreply@lists.canonical.com"
      git config user.name "LXD snap builder"

      git cherry-pick -x 2236fb7001bec8a4dd6a9070eb59d2cc818f833c # lxd/storage: Tighten storage pool volume permissions
      git cherry-pick -x 54eca5752e47bd9443f43850ca8241074de49609 # lxd/storage/drivers/volume: Add comments explaining differences in BaseDirectories permissions
      git cherry-pick -x 693c65f114b7ab94f896e38f3deaa3b53a48c6e1 # lxd/storage/backend/lxd: Replace deprecated os.IsExist
      git cherry-pick -x 849ed20a5fbb5229efec24c98ca3caee608fd87d # lxd/patches: Re-apply storage permissions on update

      # Setup build environment
      export GOPATH=$(realpath ./.go)
      export CGO_CFLAGS="-I${SNAPCRAFT_STAGE}/include/ -I${SNAPCRAFT_STAGE}/usr/local/include/"
      export CGO_LDFLAGS="-L${SNAPCRAFT_STAGE}/lib/ -L${SNAPCRAFT_STAGE}/usr/local/lib/"
      export CGO_LDFLAGS_ALLOW="(-Wl,-wrap,pthread_create)|(-Wl,-z,now)"

      # Build the binaries
      go build -o "${SNAPCRAFT_PART_INSTALL}/bin/lxc" github.com/canonical/lxd/lxc
      go build -o "${SNAPCRAFT_PART_INSTALL}/bin/lxc-to-lxd" github.com/canonical/lxd/lxc-to-lxd
      go build -o "${SNAPCRAFT_PART_INSTALL}/bin/lxd" -tags=libsqlite3 github.com/canonical/lxd/lxd
      CGO_ENABLED=0 go build -o "${SNAPCRAFT_PART_INSTALL}/bin/lxd-agent" -tags=agent,netgo github.com/canonical/lxd/lxd-agent
      go build -o "${SNAPCRAFT_PART_INSTALL}/bin/lxd-benchmark" github.com/canonical/lxd/lxd-benchmark
      go build -o "${SNAPCRAFT_PART_INSTALL}/bin/lxd-user" github.com/canonical/lxd/lxd-user

      # Setup bash completion
      mkdir -p ${SNAPCRAFT_PART_INSTALL}/etc/bash_completion.d/
      cp scripts/bash/lxd-client ${SNAPCRAFT_PART_INSTALL}/etc/bash_completion.d/snap.lxd.lxc
    override-pull: |
      snapcraftctl pull
      set -ex

      # Setup build environment
      export GOPATH=$(realpath ./.go)
      export GOTOOLCHAIN="local"

      # Setup the GOPATH
      rm -Rf "${GOPATH}"
      mkdir -p "${GOPATH}/src/github.com/canonical"
      ln -s "$(pwd)" "${GOPATH}/src/github.com/canonical/lxd"

      # Download the dependencies
      go get -v ./...
    plugin: nil
    prime:
    - bin/dnsmasq
    - bin/getfattr
    - bin/setfattr
    - bin/iw
    - bin/pigz
    - bin/rsync
    - bin/setfacl
    - bin/sgdisk
    - bin/xdelta3
    - lib/*/libidn.so.*
    - etc/bash_completion.d/snap.lxd.lxc
    - share/misc
    - bin/lxc
    - bin/lxc-to-lxd
    - bin/lxd
    - bin/lxd-agent
    - bin/lxd-benchmark
    - bin/lxd-user
    source: https://github.com/canonical/lxd
    source-commit: 4ef455e67d5ea672dc2602f41530b1683e1ab5f1
    source-type: git
    stage-packages:
    - acl
    - attr
    - dnsmasq-base
    - gdisk
    - iw
    - netbase
    - pciutils
    - pigz
    - rsync
    - squashfs-tools
    - usbutils
    - xdelta3
  lxd-migrate:
    after:
    - lxd
    - sqlite
    build-attributes:
    - core22-step-dependencies
    build-snaps:
    - go/1.24/stable
    override-build: |
      set -ex

      # Setup build environment
      export GOPATH=$(realpath ./.go)
      export GOTOOLCHAIN="local"
      export CGO_CFLAGS="-I${SNAPCRAFT_STAGE}/include/ -I${SNAPCRAFT_STAGE}/usr/local/include/"
      export CGO_LDFLAGS="-L${SNAPCRAFT_STAGE}/lib/ -L${SNAPCRAFT_STAGE}/usr/local/lib/"

      # Build the binaries
      go build -o "${SNAPCRAFT_PART_INSTALL}/bin/lxd-migrate" -tags=libsqlite3 ./

      # Install bridge script
      mkdir -p ${SNAPCRAFT_PART_INSTALL}/bin/
      cp scripts/upgrade-bridge ${SNAPCRAFT_PART_INSTALL}/bin/upgrade-bridge
    override-pull: |
      snapcraftctl pull
      set -ex

      # Setup build environment
      export GOPATH=$(realpath ./.go)

      # Download the dependencies
      go get -d -v ./...
    plugin: nil
    prime:
    - bin/lxd-migrate
    - bin/upgrade-bridge
    source: lxd-migrate/
  lxd-ui:
    override-build: |
      [ "$(uname -m)" = "riscv64" ] && exit 0
      set -ex

      npm install yarn --global
      yarn install
      yarn build

      mkdir -p "${SNAPCRAFT_PART_INSTALL}/share"
      cp -R build/ui "${SNAPCRAFT_PART_INSTALL}/share/lxd-ui/"
    override-pull: |
      [ "$(uname -m)" = "riscv64" ] && exit 0
      snapcraftctl pull
      set -ex

      snap install node --channel=18/stable --classic || true
    plugin: nil
    prime:
    - share/lxd-ui*
    source: https://github.com/canonical/lxd-ui
    source-commit: 465283e8f63ae6636cab2fc0a5258d3c61f04d67
    source-depth: 1
    source-type: git
  nano:
    build-attributes:
    - core22-step-dependencies
    organize:
      usr/bin/: bin/
    plugin: nil
    prime:
    - bin/nano
    - etc/nanorc
    source: snapcraft/empty
    stage-packages:
    - nano
  nasm:
    autotools-configure-parameters:
    - --prefix=
    build-attributes:
    - core22-step-dependencies
    organize:
      usr/bin/: bin/
    override-build: |
      patch -p1 < "${SNAPCRAFT_PROJECT_DIR}/patches/nasm-0000-disable-manpages.patch"
      snapcraftctl build
    plugin: autotools
    prime:
    - bin/nasm
    source: https://github.com/netwide-assembler/nasm
    source-commit: 214f2d4c56925a280c480950bbf71389e2169e1a
    source-depth: 1
    source-type: git
  nftables:
    after:
    - libmnl
    - libnftnl
    autotools-configure-parameters:
    - --prefix=
    - --with-json
    build-attributes:
    - core22-step-dependencies
    build-packages:
    - libedit-dev
    - libjansson-dev
    - libreadline-dev
    organize:
      sbin/: bin/
      usr/lib/: lib/
    plugin: autotools
    prime:
    - bin/nft
    - lib/*/libjansson*so*
    - lib/libnftables*so*
    source: https://www.netfilter.org/projects/nftables/files/nftables-1.1.0.tar.xz
    source-checksum: sha256/ef3373294886c5b607ee7be82c56a25bc04e75f802f8e8adcd55aac91eb0aa24
    stage-packages:
    - libjansson4
  nvidia-container:
    after:
    - libseccomp
    build-attributes:
    - core22-step-dependencies
    build-environment:
    - GIT_TAG: 1.17.6
    build-packages:
    - bmake
    - curl
    - lsb-release
    organize:
      usr/local/bin/nvidia-container-cli: bin/nvidia-container-cli.real
      usr/local/lib: lib/
    override-build: |-
      set -ex

      [ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && exit 0

      git config user.email "noreply@lists.canonical.com"
      git config user.name "LXD snap builder"

      mkdir -p "${SNAPCRAFT_PART_INSTALL}/bin/"
      cp ${SNAPCRAFT_PROJECT_DIR}/snapcraft/wrappers/nvidia-container-cli "${SNAPCRAFT_PART_INSTALL}/bin/"

      set +ex
      snapcraftctl build
    plugin: make
    prime:
    - bin/nvidia-container-cli*
    - lib/libnvidia-container*.so*
    source: https://github.com/NVIDIA/libnvidia-container
    source-commit: a198166e1c1166f4847598438115ea97dacc7a92
    source-depth: 1
    source-type: git
  openvswitch:
    autotools-configure-parameters:
    - --enable-ssl
    - --prefix=
    build-attributes:
    - core22-step-dependencies
    organize:
      sbin/: bin/
      usr/bin/: bin/
    override-build: |
      set -ex

      git config user.email "noreply@lists.canonical.com"
      git config user.name "LXD snap builder"

      set +ex
      snapcraftctl build
      set -ex
    plugin: autotools
    prime:
    - bin/ovs-appctl
    - bin/ovs-vsctl
    - bin/ovs-vswitchd
    - bin/ovsdb-*
    - bin/uuidgen
    - share/openvswitch/
    source: https://github.com/openvswitch/ovs
    source-commit: 6c4da8cc29565506beacca16ac97645ae851009a
    source-depth: 1
    source-type: git
    stage-packages:
    - uuid-runtime
  ovn:
    after:
    - openvswitch
    autotools-configure-parameters:
    - --enable-ssl
    - --prefix=
    - --with-ovs-source=../../openvswitch/build/
    build-attributes:
    - core22-step-dependencies
    plugin: autotools
    prime:
    - bin/ovn-nbctl
    - bin/ovn-sbctl
    source: https://github.com/ovn-org/ovn
    source-commit: 41836afafd99d579bb277f638a31bffd5cf3efa3
    source-depth: 1
    source-type: git
  pull-meson-early:
    override-build: |
      # No-op
      true
    override-pull: |
      # Fetch meson early to cause all downloads at the beginning of the build.
      python3 -m pip install -U meson
    override-stage: |
      # No-op
      true
    plugin: nil
    source: snapcraft/empty
  qemu:
    after:
    - libseccomp
    - liburing
    - libusb
    - spice-protocol
    - spice-server
    autotools-configure-parameters:
    - --disable-bochs
    - --disable-cloop
    - --disable-dmg
    - --disable-docs
    - --disable-guest-agent
    - --disable-parallels
    - --disable-qed
    - --disable-slirp
    - --disable-user
    - --disable-vdi
    - --disable-vnc
    - --disable-xen
    - --enable-attr
    - --enable-cap-ng
    - --enable-kvm
    - --enable-libusb
    - --enable-usb-redir
    - --enable-linux-aio
    - --enable-linux-io-uring
    - --enable-numa
    - --enable-pie
    - --enable-rbd
    - --enable-seccomp
    - --enable-spice
    - --enable-system
    - --enable-tcg
    - --enable-tools
    - --enable-vhost-crypto
    - --enable-vhost-kernel
    - --enable-vhost-net
    - --enable-vhost-user
    - --enable-virtfs
    - --firmwarepath=/snap/lxd/current/share/qemu/
    - --localstatedir=/var/
    build-attributes:
    - core22-step-dependencies
    build-packages:
    - bison
    - flex
    - pkg-config
    - libaio-dev
    - libcap-ng-dev
    - libglib2.0-dev
    - libnuma-dev
    - libpixman-1-dev
    - librbd-dev
    - libusbredirhost-dev
    organize:
      usr/bin/: bin/
      usr/lib/: lib/
      usr/local/bin/: bin/
      usr/local/lib/: lib/
      usr/local/libexec/: bin/
      usr/local/share/: share/
    override-build: |-
      [ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && [ "$(uname -m)" != "ppc64le" ] && [ "$(uname -m)" != "s390x" ] && exit 0

      set -ex
      # Mangle the configure a bit
      QEMUARCH="$(uname -m)"
      [ "${QEMUARCH}" = "ppc64le" ] && QEMUARCH="ppc64"
      sed -i "s/^unset target_list$/target_list=\"${QEMUARCH}-softmmu\"/" configure
      sed -i 's#libseccomp_minver=".*#libseccomp_minver="0.0"#g' configure

      set +ex
      snapcraftctl build
    override-pull: |-
      [ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && [ "$(uname -m)" != "ppc64le" ] && [ "$(uname -m)" != "s390x" ] && exit 0
      set -ex
      git clone https://gitlab.com/qemu/qemu . -b v8.0.5
    plugin: autotools
    prime:
    - bin/genisoimage*
    - bin/mkisofs*
    - bin/qemu-system-*
    - bin/qemu-img*
    - bin/virtfs-proxy-helper*
    - lib/*/libatomic.so*
    - lib/*/libmagic*so*
    - lib/*/libnuma*so*
    - lib/*/libpixman*so*
    - lib/*/libusbredir*so*
    - share/qemu/keymaps*
    - share/qemu/efi-virtio.rom*
    - share/qemu/kvmvapic.bin*
    - share/qemu/s390-*.img*
    - share/qemu/slof.bin*
    - share/qemu/vgabios-*.bin*
    source: IRRELEVANT
    source-depth: 1
    source-tag: IRRELEVANT
    source-type: git
    stage-packages:
    - genisoimage
    - libatomic1
    - libmagic1
    - libnuma1
    - libpixman-1-0
    - libusbredirhost1
    - libusbredirparser1
  qemu-ovmf-secureboot:
    after:
    - edk2
    - qemu
    build-attributes:
    - core22-step-dependencies
    build-packages:
    - xorriso
    override-build: |-
      [ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && exit 0

      export ARCH="$(basename $(readlink -f ${SNAPCRAFT_STAGE}/lib/*-linux-gnu*/))"
      export LD_LIBRARY_PATH="${SNAPCRAFT_STAGE}/lib:${SNAPCRAFT_STAGE}/lib/${ARCH}"

      set -ex
      rm -Rf iso-root vfat-root shell.iso
      mkdir -p iso-root vfat-root/efi/boot
      cp ../../edk2/build/Build/*/*/*/Shell.efi vfat-root/efi/boot/bootx64.efi
      cp ../../edk2/build/Build/*/*/*/EnrollDefaultKeys.efi vfat-root/
      "${SNAPCRAFT_STAGE}/bin/qemu-img" convert --image-opts driver=vvfat,floppy=on,fat-type=12,label=UEFI_SHELL,dir=vfat-root iso-root/shell.img
      xorriso --as mkisofs -input-charset ASCII -J -rational-rock -e shell.img -no-emul-boot -o shell.iso iso-root/

      # Basic aarch64 support
      if [ "$(uname -m)" = "aarch64" ]; then
          sed -i ovmf-vars-generator \
              -e "s/'-machine', machinetype,/'-machine', 'virt', '-cpu', 'cortex-a57',/" \
              -e "/charserial1/d" \
              -e "s/ide-cd/scsi-cd/" \
              -e "s/'-device',$/'-device', 'virtio-scsi-pci,id=scsi', '-device',/"
      elif [ "$(uname -m)" = "x86_64" ]; then
          cp -f "${SNAPCRAFT_STAGE}/share/qemu/kvmvapic.bin" .
      fi

      mkdir -p "${SNAPCRAFT_PART_INSTALL}/share/qemu/"
      python3 ovmf-vars-generator \
        --qemu-binary "${SNAPCRAFT_STAGE}/bin/qemu-system-$(uname -m)" \
        --print-output --disable-smm --skip-testing \
        --oem-string "$(cat ${SNAPCRAFT_PROJECT_DIR}/snapcraft/etc/ubuntu-sb.crt)" \
        --ovmf-binary "${SNAPCRAFT_STAGE}/share/qemu/OVMF_CODE.fd" \
        --ovmf-template-vars "${SNAPCRAFT_STAGE}/share/qemu/OVMF_VARS.fd" \
        --uefi-shell-iso shell.iso \
        "${SNAPCRAFT_PART_INSTALL}/share/qemu/OVMF_VARS.ms.fd"
    plugin: nil
    prime:
    - share/qemu/*
    source: https://github.com/puiterwijk/qemu-ovmf-secureboot
    source-commit: 4da81a4cbdd6d96b7a653239865d3b1d92cc6117
    source-depth: 1
    source-type: git
  shmounts:
    build-attributes:
    - core22-step-dependencies
    plugin: make
    prime:
    - bin/setup-shmounts
    source: shmounts/
  snap-query:
    build-attributes:
    - core22-step-dependencies
    build-snaps:
    - go/1.24/stable
    override-build: |
      set -ex

      # Setup build environment
      export GOPATH=$(realpath ./.go)
      export GOTOOLCHAIN="local"

      # Build the binaries
      go build -o "${SNAPCRAFT_PART_INSTALL}/bin/snap-query" snap-query.go
    plugin: nil
    prime:
    - bin/snap-query
    source: snap-query/
  spice-protocol:
    build-attributes:
    - core22-step-dependencies
    plugin: meson
    prime: []
    source: https://gitlab.freedesktop.org/spice/spice-protocol
    source-commit: 6f453a775d87087c6ba59fc180c1a1e466631a47
    source-depth: 1
    source-type: git
  spice-server:
    after:
    - spice-protocol
    build-attributes:
    - core22-step-dependencies
    build-packages:
    - libjpeg-turbo8-dev
    - python3-pyparsing
    - python3-six
    meson-parameters:
    - --prefix=/
    - -Dgstreamer=no
    - -Dmanual=false
    - -Dlz4=false
    - -Dsasl=false
    - -Dopus=disabled
    - -Dsmartcard=disabled
    - -Dtests=false
    organize:
      sbin/: bin/
      usr/lib: lib/
      usr/local/lib/: lib/
    plugin: meson
    prime:
    - lib/*/libjpeg*so*
    - lib/*/libspice-server*so*
    - lib/*/libpixman*so*
    source: https://gitlab.freedesktop.org/spice/spice
    source-commit: 0c2c1413a8b387ea597a95b6c867470a7c56c8ab
    source-type: git
    stage-packages:
    - libjpeg-turbo8
    - libpixman-1-0
  sqlite:
    autotools-configure-parameters:
    - --prefix=
    build-attributes:
    - core22-step-dependencies
    build-packages:
    - tcl
    plugin: autotools
    prime:
    - bin/sqlite3
    - lib/libsqlite3*so*
    source: https://github.com/sqlite/sqlite
    source-commit: f3d536d37825302e31ed0eddd811c689f38f85a3
    source-depth: 1
    source-type: git
  squashfs-tools-ng:
    autotools-configure-parameters:
    - --prefix=
    build-attributes:
    - core22-step-dependencies
    build-packages:
    - liblzma-dev
    plugin: autotools
    prime:
    - bin/sqfs2tar
    - bin/tar2sqfs
    - lib/libsquashfs.so*
    source: https://github.com/AgentD/squashfs-tools-ng
    source-commit: 8f9966c8ea3ea8a854941d041e7fcb9eb4f772fb
    source-depth: 1
    source-type: git
  strip:
    after:
    - btrfs
    - ceph
    - dqlite
    - libseccomp
    - logrotate
    - lvm
    - nano
    - nvidia-container
    - openvswitch
    - ovn
    - sqlite
    - squashfs-tools-ng
    - swtpm
    - virtiofsd
    - xfs
    - xz
    - wrappers
    - xtables
    - zfs-0-6
    - zfs-0-7
    - zfs-0-8
    - zfs-2-0
    - zfs-2-1
    - zfs-2-2
    - zstd
    - lxc
    - lxcfs
    - criu
    - lxd
    - lxd-migrate
    - shmounts
    - snap-query
    build-attributes:
    - core22-step-dependencies
    override-prime: |
      set -x

      # XXX: remove unneeded files/directories
      rm -rf "${SNAPCRAFT_PRIME}/usr/local/"

      # Strip some of the heavy bits
      strip -s ${SNAPCRAFT_PRIME}/bin/lxc
      strip -s ${SNAPCRAFT_PRIME}/bin/lxd*
      strip -s ${SNAPCRAFT_PRIME}/bin/snap*
      strip -s ${SNAPCRAFT_PRIME}/lib/libdqlite*
      strip -s ${SNAPCRAFT_PRIME}/lib/libsqlite*

      # Strip binaries (excluding shell scripts)
      find "${SNAPCRAFT_PRIME}"/bin -type f \
        -not -path "${SNAPCRAFT_PRIME}/bin/ceph" \
        -not -path "${SNAPCRAFT_PRIME}/bin/editor" \
        -not -path "${SNAPCRAFT_PRIME}/bin/lxc-checkconfig" \
        -not -path "${SNAPCRAFT_PRIME}/bin/nvidia-container-cli" \
        -not -path "${SNAPCRAFT_PRIME}/bin/remote-viewer" \
        -not -path "${SNAPCRAFT_PRIME}/bin/sshfs" \
        -not -path "${SNAPCRAFT_PRIME}/bin/upgrade-bridge" \
        -not -path "${SNAPCRAFT_PRIME}/bin/xfs_admin" \
        -exec strip -s {} +

      # Strip binaries not under bin/ due to being dynamically
      # added to the path with `snap set lxd`, like `criu.enable=true`
      for binary in "${SNAPCRAFT_PRIME}/criu/criu"; do
        [ -e "${binary}" ] || continue
        strip -s "${binary}"
      done

      # Strip all versions of zfs utils
      for v in "${SNAPCRAFT_PRIME}"/zfs-*; do
        [ -d "${v}" ] || continue
        find "${v}/" -type f -exec strip -s {} +
      done

      # Strip libraries (excluding python3 scripts)
      find "${SNAPCRAFT_PRIME}"/lib -type f \
        -not -path "${SNAPCRAFT_PRIME}/lib/python3/*" \
        -exec strip -s {} +

      # XXX: look for broken symlinks indicating missing/invalid prime
      broken_symlinks="$(find "${SNAPCRAFT_PRIME}/" -xtype l \
                           -not -path "${SNAPCRAFT_PRIME}/lxc/config/common.conf.d/*")"
      if [ -n "${broken_symlinks}" ]; then
          echo "Found broken symlinks:"
          echo "${broken_symlinks}"
          exit 1
      fi

      exit 0
    plugin: nil
    source: snapcraft/empty
  swtpm:
    after:
    - libseccomp
    - libtpms
    autotools-configure-parameters:
    - --prefix=
    - --with-seccomp
    - --with-openssl
    - --without-cuse
    build-attributes:
    - core22-step-dependencies
    build-packages:
    - expect
    - gawk
    - iproute2
    - libjson-glib-dev
    - python3-cryptography
    - python3-setuptools
    - socat
    organize:
      lib/swtpm/: lib/
      usr/bin/: bin/
      usr/lib/: lib/
    plugin: autotools
    prime:
    - bin/swtpm
    - lib/libswtpm*so*
    - lib/*/libjson-glib-1.0.so*
    source: https://github.com/stefanberger/swtpm
    source-commit: f756ee8a281ddff7e09b49e1ef00d5cbb42abb63
    source-depth: 1
    source-type: git
    stage-packages:
    - libjson-glib-1.0-0
  virtiofsd:
    build-attributes:
    - core22-step-dependencies
    build-packages:
    - cargo
    - libseccomp-dev
    - rustc
    organize:
      usr/bin: bin/
    override-build: |-
      [ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && [ "$(uname -m)" != "ppc64le" ] && [ "$(uname -m)" != "s390x" ] && exit 0
      snapcraftctl build
    override-pull: |-
      [ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && [ "$(uname -m)" != "ppc64le" ] && [ "$(uname -m)" != "s390x" ] && exit 0
      snapcraftctl pull
    plugin: rust
    prime:
    - bin/virtiofsd*
    source: https://gitlab.com/virtio-fs/virtiofsd
    source-commit: d20f4d698c14ada07ea9ff5cb7050c2c4703ff66
    source-depth: 1
    source-type: git
  wrappers:
    build-attributes:
    - core22-step-dependencies
    organize:
      hooks/: snap/hooks/
      wrappers/editor: bin/
      wrappers/remote-viewer: bin/
      wrappers/sshfs: bin/
    plugin: dump
    source: snapcraft/
  xfs:
    build-attributes:
    - core22-step-dependencies
    organize:
      sbin/: bin/
      usr/sbin/: bin/
    plugin: nil
    prime:
    - bin/xfs_admin
    - bin/xfs_db
    - bin/xfs_growfs
    - bin/xfs_repair
    - bin/mkfs.xfs
    source: snapcraft/empty
    stage-packages:
    - xfsprogs
  xtables:
    build-attributes:
    - core22-step-dependencies
    organize:
      usr/lib/ebtables/: lib/
      usr/sbin/: bin/
    plugin: nil
    prime:
    - bin/arptables-legacy
    - bin/ebtables-legacy
    - etc/ethertypes
    - etc/protocols
    - lib/libebtc.so.*
    source: snapcraft/empty
    stage-packages:
    - arptables
    - ebtables
  xz:
    build-attributes:
    - core22-step-dependencies
    organize:
      usr/bin/: bin/
      usr/lib/: lib/
      usr/sbin/: bin/
    override-build: |
      snapcraftctl build

      # Include the lzma symlink
      ln -s xz "${SNAPCRAFT_PART_INSTALL}/usr/bin/lzma"
    plugin: nil
    prime:
    - bin/lzma
    - bin/xz
    - lib/*/liblzma*so*
    source: snapcraft/empty
    stage-packages:
    - xz-utils
  zfs-0-6:
    autotools-configure-parameters:
    - --prefix=/
    - --with-config=user
    build-attributes:
    - core22-step-dependencies
    build-packages:
    - uuid-dev
    - zlib1g-dev
    override-build: |
      set -ex

      [ "$(uname -m)" != "x86_64" ] && \
        [ "$(uname -m)" != "aarch64" ] && \
        [ "$(uname -m)" != "s390x" ] && \
        [ "$(uname -m)" != "ppc64le" ] && exit 0

      git config user.email "noreply@linuxcontainers.org"
      git config user.name "LXD snap builder"

      git cherry-pick fb963d33ee0dd350143ba1c9cd35d5f7d86910d2  # Fix endian build problem on ppc64el

      set +ex
      snapcraftctl build
      set -ex

      mv "${SNAPCRAFT_PART_INSTALL}" "${SNAPCRAFT_PART_INSTALL}.tmp"
      mkdir -p "${SNAPCRAFT_PART_INSTALL}/zfs-0.6/bin" "${SNAPCRAFT_PART_INSTALL}/zfs-0.6/lib"
      mv "${SNAPCRAFT_PART_INSTALL}.tmp/sbin/zfs" "${SNAPCRAFT_PART_INSTALL}/zfs-0.6/bin/"
      mv "${SNAPCRAFT_PART_INSTALL}.tmp/sbin/zpool" "${SNAPCRAFT_PART_INSTALL}/zfs-0.6/bin/"
      mv "${SNAPCRAFT_PART_INSTALL}.tmp/lib/udev/zvol_id" "${SNAPCRAFT_PART_INSTALL}/zfs-0.6/bin/"
      mv "${SNAPCRAFT_PART_INSTALL}.tmp/lib/"*so* "${SNAPCRAFT_PART_INSTALL}/zfs-0.6/lib/"
      rm -Rf "${SNAPCRAFT_PART_INSTALL}.tmp"
    plugin: autotools
    source: https://github.com/openzfs/zfs
    source-commit: 2bc71fa976bf34b41313928fd42e4d41f0c9cd1a
    source-type: git
  zfs-0-7:
    autotools-configure-parameters:
    - --prefix=/
    - --with-config=user
    build-attributes:
    - core22-step-dependencies
    build-packages:
    - libblkid-dev
    - uuid-dev
    - zlib1g-dev
    override-build: |
      set -ex

      [ "$(uname -m)" != "x86_64" ] && \
        [ "$(uname -m)" != "aarch64" ] && \
        [ "$(uname -m)" != "s390x" ] && \
        [ "$(uname -m)" != "ppc64le" ] && exit 0

      set +ex
      snapcraftctl build
      set -ex

      mv "${SNAPCRAFT_PART_INSTALL}" "${SNAPCRAFT_PART_INSTALL}.tmp"
      mkdir -p "${SNAPCRAFT_PART_INSTALL}/zfs-0.7/bin" "${SNAPCRAFT_PART_INSTALL}/zfs-0.7/lib"
      mv "${SNAPCRAFT_PART_INSTALL}.tmp/sbin/zfs" "${SNAPCRAFT_PART_INSTALL}/zfs-0.7/bin/"
      mv "${SNAPCRAFT_PART_INSTALL}.tmp/sbin/zpool" "${SNAPCRAFT_PART_INSTALL}/zfs-0.7/bin/"
      mv "${SNAPCRAFT_PART_INSTALL}.tmp/lib/udev/zvol_id" "${SNAPCRAFT_PART_INSTALL}/zfs-0.7/bin/"
      mv "${SNAPCRAFT_PART_INSTALL}.tmp/lib/"*so* "${SNAPCRAFT_PART_INSTALL}/zfs-0.7/lib/"
      rm -Rf "${SNAPCRAFT_PART_INSTALL}.tmp"
    plugin: autotools
    source: https://github.com/openzfs/zfs
    source-commit: a8c2b7ebc64d23ffe15e2b168aa0bea7a4897133
    source-depth: 1
    source-type: git
  zfs-0-8:
    autotools-configure-parameters:
    - --prefix=/
    - --with-config=user
    build-attributes:
    - core22-step-dependencies
    build-packages:
    - libblkid-dev
    - libssl-dev
    - uuid-dev
    - zlib1g-dev
    override-build: |
      set -ex

      [ "$(uname -m)" != "x86_64" ] && \
        [ "$(uname -m)" != "aarch64" ] && \
        [ "$(uname -m)" != "s390x" ] && \
        [ "$(uname -m)" != "ppc64le" ] && exit 0

      set +ex
      snapcraftctl build
      set -ex

      mv "${SNAPCRAFT_PART_INSTALL}" "${SNAPCRAFT_PART_INSTALL}.tmp"
      mkdir -p "${SNAPCRAFT_PART_INSTALL}/zfs-0.8/bin" "${SNAPCRAFT_PART_INSTALL}/zfs-0.8/lib"
      mv "${SNAPCRAFT_PART_INSTALL}.tmp/sbin/zfs" "${SNAPCRAFT_PART_INSTALL}/zfs-0.8/bin/"
      mv "${SNAPCRAFT_PART_INSTALL}.tmp/sbin/zpool" "${SNAPCRAFT_PART_INSTALL}/zfs-0.8/bin/"
      mv "${SNAPCRAFT_PART_INSTALL}.tmp/lib/udev/zvol_id" "${SNAPCRAFT_PART_INSTALL}/zfs-0.8/bin/"
      mv "${SNAPCRAFT_PART_INSTALL}.tmp/lib/"*so* "${SNAPCRAFT_PART_INSTALL}/zfs-0.8/lib/"
      rm -Rf "${SNAPCRAFT_PART_INSTALL}.tmp"
    plugin: autotools
    source: https://github.com/openzfs/zfs
    source-commit: 2bc66898b7056140108a4937a6557d9fe27cafc6
    source-depth: 1
    source-type: git
  zfs-2-0:
    autotools-configure-parameters:
    - --prefix=/
    - --with-config=user
    build-attributes:
    - core22-step-dependencies
    build-packages:
    - libblkid-dev
    - libssl-dev
    - uuid-dev
    - zlib1g-dev
    override-build: |
      set -ex

      [ "$(uname -m)" != "x86_64" ] && \
        [ "$(uname -m)" != "aarch64" ] && \
        [ "$(uname -m)" != "s390x" ] && \
        [ "$(uname -m)" != "ppc64le" ] && exit 0

      set +ex
      snapcraftctl build
      set -ex

      mv "${SNAPCRAFT_PART_INSTALL}" "${SNAPCRAFT_PART_INSTALL}.tmp"
      mkdir -p "${SNAPCRAFT_PART_INSTALL}/zfs-2.0/bin" "${SNAPCRAFT_PART_INSTALL}/zfs-2.0/lib"
      mv "${SNAPCRAFT_PART_INSTALL}.tmp/sbin/zfs" "${SNAPCRAFT_PART_INSTALL}/zfs-2.0/bin/"
      mv "${SNAPCRAFT_PART_INSTALL}.tmp/sbin/zpool" "${SNAPCRAFT_PART_INSTALL}/zfs-2.0/bin/"
      mv "${SNAPCRAFT_PART_INSTALL}.tmp/lib/udev/zvol_id" "${SNAPCRAFT_PART_INSTALL}/zfs-2.0/bin/"
      mv "${SNAPCRAFT_PART_INSTALL}.tmp/lib/"*so* "${SNAPCRAFT_PART_INSTALL}/zfs-2.0/lib/"
      rm -Rf "${SNAPCRAFT_PART_INSTALL}.tmp"
    plugin: autotools
    source: https://github.com/openzfs/zfs
    source-commit: ad81baab7779cd2113669d30de72bb925e684525
    source-depth: 1
    source-type: git
  zfs-2-1:
    autotools-configure-parameters:
    - --prefix=/
    - --with-config=user
    build-attributes:
    - core22-step-dependencies
    build-packages:
    - libblkid-dev
    - libssl-dev
    - uuid-dev
    - zlib1g-dev
    override-build: |
      set -ex

      [ "$(uname -m)" != "x86_64" ] && \
        [ "$(uname -m)" != "aarch64" ] && \
        [ "$(uname -m)" != "s390x" ] && \
        [ "$(uname -m)" != "ppc64le" ] && exit 0

      set +ex
      snapcraftctl build
      set -ex

      mv "${SNAPCRAFT_PART_INSTALL}" "${SNAPCRAFT_PART_INSTALL}.tmp"
      mkdir -p "${SNAPCRAFT_PART_INSTALL}/zfs-2.1/bin" "${SNAPCRAFT_PART_INSTALL}/zfs-2.1/lib"
      mv "${SNAPCRAFT_PART_INSTALL}.tmp/sbin/zfs" "${SNAPCRAFT_PART_INSTALL}/zfs-2.1/bin/"
      mv "${SNAPCRAFT_PART_INSTALL}.tmp/sbin/zpool" "${SNAPCRAFT_PART_INSTALL}/zfs-2.1/bin/"
      mv "${SNAPCRAFT_PART_INSTALL}.tmp/lib/udev/zvol_id" "${SNAPCRAFT_PART_INSTALL}/zfs-2.1/bin/"
      mv "${SNAPCRAFT_PART_INSTALL}.tmp/lib/"*so* "${SNAPCRAFT_PART_INSTALL}/zfs-2.1/lib/"
      rm -Rf "${SNAPCRAFT_PART_INSTALL}.tmp"
    plugin: autotools
    source: https://github.com/openzfs/zfs
    source-commit: a7186651d3306debca6b4f72797239eea61db36c
    source-depth: 1
    source-type: git
  zfs-2-2:
    autotools-configure-parameters:
    - --prefix=/
    - --with-config=user
    build-attributes:
    - core22-step-dependencies
    build-packages:
    - libblkid-dev
    - libssl-dev
    - uuid-dev
    - zlib1g-dev
    override-build: |-
      [ "$(uname -m)" != "x86_64" ] && \
        [ "$(uname -m)" != "aarch64" ] && \
        [ "$(uname -m)" != "s390x" ] && \
        [ "$(uname -m)" != "ppc64le" ] && exit 0
      snapcraftctl build
      set -ex

      ZFS_VER="2.2"

      mv "${SNAPCRAFT_PART_INSTALL}" "${SNAPCRAFT_PART_INSTALL}.tmp"
      mkdir -p "${SNAPCRAFT_PART_INSTALL}/zfs-${ZFS_VER}/bin" "${SNAPCRAFT_PART_INSTALL}/zfs-${ZFS_VER}/lib"
      mv "${SNAPCRAFT_PART_INSTALL}.tmp/sbin/zfs" "${SNAPCRAFT_PART_INSTALL}/zfs-${ZFS_VER}/bin/"
      mv "${SNAPCRAFT_PART_INSTALL}.tmp/sbin/zpool" "${SNAPCRAFT_PART_INSTALL}/zfs-${ZFS_VER}/bin/"
      mv "${SNAPCRAFT_PART_INSTALL}.tmp/lib/udev/zvol_id" "${SNAPCRAFT_PART_INSTALL}/zfs-${ZFS_VER}/bin/"
      mv "${SNAPCRAFT_PART_INSTALL}.tmp/lib/"*so* "${SNAPCRAFT_PART_INSTALL}/zfs-${ZFS_VER}/lib/"
      rm -Rf "${SNAPCRAFT_PART_INSTALL}.tmp"
    override-pull: |-
      [ "$(uname -m)" != "x86_64" ] && \
        [ "$(uname -m)" != "aarch64" ] && \
        [ "$(uname -m)" != "s390x" ] && \
        [ "$(uname -m)" != "ppc64le" ] && exit 0
      snapcraftctl pull
    plugin: autotools
    source: https://github.com/openzfs/zfs
    source-commit: 3e4a3e161c00273303cd9fa9e0dc09ead3499a8a
    source-depth: 1
    source-type: git
  zstd:
    build-attributes:
    - core22-step-dependencies
    organize:
      usr/bin/: bin/
    plugin: nil
    prime:
    - bin/pzstd
    - bin/zstd
    source: snapcraft/empty
    stage-packages:
    - zstd
source-code: https://github.com/canonical/lxd
summary: LXD - container and VM manager
version: 5.0.5-5c60378
website: https://ubuntu.com/lxd
