From e7c829e35d519797e703d57dc3265a723e7105c3 Mon Sep 17 00:00:00 2001 From: David Donchez Date: Mon, 19 Feb 2024 16:28:19 +0100 Subject: [PATCH] refactor(zfs): rework zfs sysext build --- .github/workflows/release.yaml | 14 +++++++------- create_zfs_sysext.sh | 15 ++++++++------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 1ef4829..1297c03 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -147,16 +147,16 @@ jobs: set -euo pipefail images=( - "zfs-2.1.12-${{ matrix.flatcarversion }}" + "zfs-${{ matrix.flatcarversion }}" ) for image in ${images[@]}; do - component="${image%%-*}" - flatcarversion="${image##*-}" - temp="${image#*-}" - version="${temp%-*}" - "./create_${component}_sysext.sh" "${version}" "${component}" "${flatcarversion}" - mv "${component}.raw" "${image}.raw" + component="${image%-*}" + flatcarversion="${image#*-}" + "./create_${component}_sysext.sh" "${component}" "${flatcarversion}" + baked_component=$(ls ${component}-*.raw) + sysext_name="${baked_component%.raw}-${flatcarversion}.raw" + mv "$baked_component" "$sysext_name" done sha256sum *.raw >> SHA256SUMS diff --git a/create_zfs_sysext.sh b/create_zfs_sysext.sh index ffbbcda..1c7c923 100755 --- a/create_zfs_sysext.sh +++ b/create_zfs_sysext.sh @@ -4,7 +4,7 @@ set -euo pipefail export ARCH="${ARCH-amd64}" SCRIPTFOLDER="$(dirname "$(readlink -f "$0")")" -if [ $# -lt 3 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then +if [ $# -lt 2 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then echo "Usage: $0 VERSION SYSEXTNAME FLATCARVERSION" echo "The script will build ZFS modules and tooling and create a sysext squashfs image with the name SYSEXTNAME.raw in the current folder." echo "A temporary directory named SYSEXTNAME in the current folder will be created and deleted again." @@ -14,9 +14,8 @@ if [ $# -lt 3 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then exit 1 fi -VERSION="$1" -SYSEXTNAME="$2" -FLATCARVERSION="$3" +SYSEXTNAME="$1" +FLATCARVERSION="$2" if [ "${ARCH}" = aarch64 ]; then ARCH=arm64 fi @@ -28,9 +27,12 @@ emerge-gitclone echo 'FEATURES="-network-sandbox -pid-sandbox -ipc-sandbox -usersandbox -sandbox"' >>/etc/portage/make.conf cp files/zfs/repos.conf /etc/portage/repos.conf/zfs.conf cp -r files/zfs/${FLATCARVERSION}/overlay/ /var/lib/portage/zfs-overlay/ +# fixme starting with 3760. Incorrect permission on some headers +chmod -R +r /usr/lib/gcc/x86_64-cros-linux-gnu/ # build zfs -echo "========== Build ZFS" +VERSION=$(emerge --search sys-fs/zfs$ | grep "Latest version available" | awk '{print $NF}') +echo "========== Build ZFS $VERSION" kernel=$(ls /lib/modules) && KBUILD_OUTPUT=/lib/modules/${kernel}/build KERNEL_DIR=/lib/modules/${kernel}/source emerge -j$(nproc) --getbinpkg --onlydeps zfs emerge -j$(nproc) --getbinpkg --buildpkgonly zfs squashfs-tools @@ -58,7 +60,6 @@ rm -rf ${SYSEXTNAME}/usr/share rm -rf ${SYSEXTNAME}/usr/src rm -rf ${SYSEXTNAME}/usr/include - - "${SCRIPTFOLDER}"/bake.sh "${SYSEXTNAME}" "${FLATCARVERSION}" +mv "${SYSEXTNAME}.raw" "${SYSEXTNAME}-${VERSION}.raw" rm -rf "${SYSEXTNAME}"