Skip to content

Commit

Permalink
Merge pull request canonical#258 from simondeziel/zfs-2.2-5.0-edge
Browse files Browse the repository at this point in the history
Add `zfs` 2.2 to 5.0 snap (5.0-edge)
  • Loading branch information
tomponline authored Jan 8, 2024
2 parents 8b45772 + 1c1a809 commit db4af6f
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 2 deletions.
38 changes: 38 additions & 0 deletions snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1191,6 +1191,43 @@ parts:
mv "${SNAPCRAFT_PART_INSTALL}.tmp/lib/"*so* "${SNAPCRAFT_PART_INSTALL}/zfs-2.1/lib/"
rm -Rf "${SNAPCRAFT_PART_INSTALL}.tmp"
zfs-2-2:
source: https://github.com/openzfs/zfs
source-type: git
source-tag: zfs-2.2.2
source-depth: 1
plugin: autotools
autotools-configure-parameters:
- --prefix=/
- --with-config=user
build-packages:
- libblkid-dev
- libssl-dev
- uuid-dev
- zlib1g-dev
override-pull: |-
[ "$(uname -m)" != "x86_64" ] && \
[ "$(uname -m)" != "aarch64" ] && \
[ "$(uname -m)" != "s390x" ] && \
[ "$(uname -m)" != "ppc64le" ] && exit 0
snapcraftctl pull
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"
zstd:
build-attributes: [core22-step-dependencies]
Expand Down Expand Up @@ -1516,6 +1553,7 @@ parts:
- zfs-0-8
- zfs-2-0
- zfs-2-1
- zfs-2-2
- zstd
- lxc
- lxcfs
Expand Down
6 changes: 5 additions & 1 deletion snapcraft/commands/daemon.start
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,11 @@ else
VERSION=$(nsenter -t 1 -m modinfo -F version zfs 2>/dev/null || true)
fi

if echo "${VERSION}" | grep -q ^2\.1; then
if echo "${VERSION}" | grep -q ^2\.2; then
echo "==> Setting up ZFS (2.2)"
export LD_LIBRARY_PATH="${SNAP_CURRENT}/zfs-2.2/lib/:${LD_LIBRARY_PATH}"
export PATH="${SNAP_CURRENT}/zfs-2.2/bin:${PATH}"
elif echo "${VERSION}" | grep -q ^2\.1; then
echo "==> Setting up ZFS (2.1)"
export LD_LIBRARY_PATH="${SNAP_CURRENT}/zfs-2.1/lib/:${LD_LIBRARY_PATH}"
export PATH="${SNAP_CURRENT}/zfs-2.1/bin:${PATH}"
Expand Down
5 changes: 4 additions & 1 deletion snapcraft/commands/lxd-migrate
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ else
VERSION=$(nsenter -t 1 -m modinfo -F version zfs 2>/dev/null || true)
fi

if echo "${VERSION}" | grep -q ^2\.1; then
if echo "${VERSION}" | grep -q ^2\.2; then
export LD_LIBRARY_PATH="${SNAP_CURRENT}/zfs-2.2/lib/:${LD_LIBRARY_PATH}"
export PATH="${SNAP_CURRENT}/zfs-2.2/bin:${PATH}"
elif echo "${VERSION}" | grep -q ^2\.1; then
export LD_LIBRARY_PATH="${SNAP_CURRENT}/zfs-2.1/lib/:${LD_LIBRARY_PATH}"
export PATH="${SNAP_CURRENT}/zfs-2.1/bin:${PATH}"
elif echo "${VERSION}" | grep -q ^2\.0; then
Expand Down

0 comments on commit db4af6f

Please sign in to comment.