Merge pull request #2261 from flatcar/chewi/open-iscsi

sys-block/open-iscsi: Migrate coreos-stable to portage-stable, 2.1.10
This commit is contained in:
James Le Cuirot 2024-09-03 13:41:05 +01:00 committed by GitHub
commit 2fc3b2df62
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 491 additions and 206 deletions

View File

@ -594,6 +594,7 @@ sys-apps/util-linux
sys-apps/which
sys-apps/zram-generator
sys-block/open-iscsi
sys-block/open-isns
sys-block/parted
sys-block/thin-provisioning-tools

View File

@ -0,0 +1 @@
- Open-iSCSI ([2.1.10](https://github.com/open-iscsi/open-iscsi/releases/tag/2.1.10))

View File

@ -0,0 +1,18 @@
cros_post_src_install_tmpfiles() {
keepdir /var/lib/iscsi/ifaces
dosym ../flatcar/etc/iscsi/iscsid.conf /usr/share/iscsi/iscsid.conf
insinto /usr/share/flatcar/etc/iscsi
newins - iscsid.conf
systemd_install_dropin iscsi-init.service - <<-EOF
[Unit]
After=systemd-tmpfiles-setup.service
EOF
}
# Masking initiatorname.iscsi.example prevents initiatorname.iscsi from being
# generated and installed. We want the systemd unit to do this at runtime so
# that we don't bake the value into Flatcar images.
INSTALL_MASK+=" ${EPREFIX}/etc/iscsi/initiatorname.iscsi*"
PKG_INSTALL_MASK+=" ${EPREFIX}/etc/iscsi/initiatorname.iscsi*"

View File

@ -0,0 +1,3 @@
We want nodes to start automatically.
See: https://github.com/flatcar/scripts/commit/8fb48ff69f29e64da3df6a197662904f60af25f5

View File

@ -0,0 +1,12 @@
diff -Naur a/etc/iscsid.conf b/etc/iscsid.conf
--- a/etc/iscsid.conf 2024-05-31 18:25:54.000000000 +0100
+++ b/etc/iscsid.conf 2024-08-23 17:57:43.556060413 +0100
@@ -51,7 +51,7 @@
# node.startup = automatic
#
# To manually startup the session, use "manual". The default is manual.
-node.startup = manual
+node.startup = automatic
# For "automatic" startup nodes, setting this to "Yes" will try logins on each
# available iface until one succeeds, and then stop. The default "No" will try

View File

@ -1,4 +0,0 @@
DIST open-iscsi-2.0-873.tar.gz 667069 BLAKE2B edb427f8483c31499cdde644bbf8d658952952fa8d52a232537e7e6ec71d2d237dcd4e8759de21b65cac757678c7d71c22bd2fe71ed1e7ac152ae8396f080061 SHA512 4e67116cb7dd49381c9279645e5a661f05596ae6be3b832772089828b3764ca2d04b5dea1bcc337071efb52c3c75a6fb943136c659ee59500f3a198ed0dcea6b
DIST open-iscsi-2.0.875.tar.gz 635121 BLAKE2B 34a7083087c53ed0e59d293d26efe166b09c5ea18b6022869cc9ff3d2edb2fb8b69e2c1ce6c9011bd20fc590b02dafd6d7c13d8bfa1eae6408c4bace13992e5e SHA512 1709011d7d12d3dd9278a0d775af064d5f7da37357f35d6d5c5b3aa8ec16385c28b201b1261f4581dbbbbca3d815015ed8696e1694aa19f3231132f90d1e5b36
DIST open-iscsi-2.1.3.tar.gz 619746 BLAKE2B 884e24ae6e16578f3cbd8ccea2557e820d4bf4d20c7f88890100ca93f48df88dc7284cc4eca19d93187516fd21a2c5b71eb53f0d8fe395d2ce42fd202dc355d6 SHA512 0de417dc45b765458c5a1f09029b5df9b5c18d45d7a8fb6b38d539b7013f512a3c8731d5046f554611eccc77b93fea0df30fe4932d79cea44776ac944c398a52
DIST open-iscsi-2.1.4.tar.gz 621247 BLAKE2B 043a999b2f397a6c740d61654079d7ab966caee6cf6cfb244ddd70eae4f5201045b371ce5fbe244216a2a210a5379c92e8c3fbe62d33707cf05e7a4a20a13a91 SHA512 ae0663a964d86e6a4c19203598b859173c93ecce550f9bc9855ff735dd51a3c45822f2bc1cc99e6891c56ef1d16c42223803f07a961558fe6e38ead2164faef3

View File

@ -1,9 +0,0 @@
[Unit]
Description=One time configuration for iscsi.service
After=systemd-tmpfiles-setup.service
ConditionPathExists=!/etc/iscsi/initiatorname.iscsi
[Service]
Type=oneshot
RemainAfterExit=no
ExecStart=/usr/bin/sh -c 'echo "InitiatorName=$(/usr/sbin/iscsi-iname)" > /etc/iscsi/initiatorname.iscsi'

View File

@ -1,78 +0,0 @@
--- a/libopeniscsiusr/Makefile
+++ b/libopeniscsiusr/Makefile
@@ -44,7 +44,7 @@ EXTRA_MAN_FILES = libopeniscsiusr.h.3
OBJS = context.o misc.o session.o sysfs.o iface.o idbm.o node.o default.o
CFLAGS ?= -O2 -g
-CFLAGS += -Wall -Werror -Wextra -fvisibility=hidden -fPIC
+CFLAGS += -Wall -Wextra -fvisibility=hidden -fPIC
CFLAGS += $(shell $(PKG_CONFIG) --cflags libkmod)
LDFLAGS += $(shell $(PKG_CONFIG) --libs libkmod)
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -35,7 +35,7 @@ endif
PKG_CONFIG = /usr/bin/pkg-config
CFLAGS ?= -O2 -g
-WARNFLAGS ?= -Wall -Wextra -Werror -Wstrict-prototypes -fno-common
+WARNFLAGS ?= -Wall -Wextra -Wstrict-prototypes -fno-common
CFLAGS += $(WARNFLAGS) -I../include -I. -D_GNU_SOURCE \
-I$(TOPDIR)/libopeniscsiusr
CFLAGS += $(shell $(PKG_CONFIG) --cflags libkmod)
@@ -76,9 +76,9 @@ iscsistart: $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) $(FW_BOOT_SRCS) \
iscsistart.o statics.o
$(CC) $(CFLAGS) $^ -o $@ -lcrypto -lrt $(LDFLAGS) $(ISCSI_LIB)
clean:
- rm -f *.o $(PROGRAMS) .depend $(LIBSYS)
+ $(RM) *.o $(PROGRAMS) .depend $(LIBSYS)
depend:
- gcc $(CFLAGS) -M `ls *.c` > .depend
+ $(CC) $(CFLAGS) -M `ls *.c` > .depend
-include .depend
--- a/utils/Makefile
+++ b/utils/Makefile
@@ -10,9 +10,9 @@ iscsi-iname: md5.o iscsi-iname.o
$(CC) $(CFLAGS) $(LDFLAGS) $^ $(DBM_LIB) -o $@
clean:
- rm -f *.o $(PROGRAMS) .depend
+ $(RM) *.o $(PROGRAMS) .depend
depend:
- gcc $(CFLAGS) -M `ls *.c` > .depend
+ $(CC) $(CFLAGS) -M `ls *.c` > .depend
-include .depend
--- a/utils/fwparam_ibft/Makefile
+++ b/utils/fwparam_ibft/Makefile
@@ -41,11 +41,11 @@ LDFLAGS += -L$(TOPDIR)/libopeniscsiusr -liscsiusr
all: $(OBJS)
clean:
- rm -f *.o $(CLEANFILES) .depend
+ $(RM) *.o $(CLEANFILES) .depend
$(OBJS): prom_parse.tab.h prom_parse.h fwparam_ibft.h
depend:
- gcc $(CFLAGS) -M `ls *.c` > .depend
+ $(CC) $(CFLAGS) -M `ls *.c` > .depend
-include .depend
--- a/utils/sysdeps/Makefile
+++ b/utils/sysdeps/Makefile
@@ -8,9 +8,9 @@ SYSDEPS_OBJS=sysdeps.o
all: $(SYSDEPS_OBJS)
clean:
- rm -f *.o .depend
+ $(RM) *.o .depend
depend:
- gcc $(CFLAGS) -M `ls *.c` > .depend
+ $(CC) $(CFLAGS) -M `ls *.c` > .depend
-include .depend

View File

@ -1,2 +0,0 @@
d /var/db/iscsi 0700 root root - -
C /etc/iscsi - - - - /usr/share/iscsi

View File

@ -1,112 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
TMPFILES_OPTIONAL=1
inherit autotools linux-info flag-o-matic toolchain-funcs udev systemd tmpfiles
DESCRIPTION="A performant, transport independent, multi-platform implementation of RFC3720"
HOMEPAGE="http://www.open-iscsi.com/"
SRC_URI="https://github.com/${PN}/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0/0.2"
KEYWORDS="~alpha amd64 arm arm64 ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
IUSE="debug infiniband libressl +tcp rdma systemd"
DEPEND="
sys-apps/kmod
sys-block/open-isns:=
sys-kernel/linux-headers
infiniband? ( sys-fabric/ofed )
!libressl? ( dev-libs/openssl:0= )
libressl? ( dev-libs/libressl:0= )
systemd? ( sys-apps/systemd )
"
RDEPEND="${DEPEND}
sys-fs/lsscsi
sys-apps/util-linux"
BDEPEND="virtual/pkgconfig"
REQUIRED_USE="infiniband? ( rdma ) || ( rdma tcp )"
PATCHES=(
"${FILESDIR}/${PN}-2.1.1-Makefiles.patch"
)
pkg_setup() {
linux-info_pkg_setup
# Flatcar: use ewarn instead of die
if kernel_is -lt 2 6 16; then
ewarn "Sorry, your kernel must be 2.6.16-rc5 or newer!"
fi
# Needs to be done, as iscsid currently only starts, when having the iSCSI
# support loaded as module. Kernel builtin options don't work. See this for
# more information:
# https://groups.google.com/group/open-iscsi/browse_thread/thread/cc10498655b40507/fd6a4ba0c8e91966
# If there's a new release, check whether this is still valid!
CONFIG_MODULES="SCSI_ISCSI_ATTRS ISCSI_TCP"
if linux_config_exists; then
for module in ${CONFIG_CHECK_MODULES}; do
linux_chkconfig_module ${module} || ewarn "${module} needs to be built as module (builtin doesn't work)"
done
fi
}
src_prepare() {
sed -e 's:^\(iscsid.startup\)\s*=.*:\1 = /usr/sbin/iscsid:' \
-i etc/iscsid.conf || die
sed -e 's:^node.startup = manual:node.startup = automatic:' \
-i etc/iscsid.conf || die
default
pushd iscsiuio >/dev/null || die
eautoreconf
popd >/dev/null || die
}
src_configure() {
use debug && append-cppflags -DDEBUG_TCP -DDEBUG_SCSI
append-lfs-flags
}
src_compile() {
use debug && append-flags -DDEBUG_TCP -DDEBUG_SCSI
CFLAGS="" \
emake \
OPTFLAGS="${CFLAGS} ${CPPFLAGS} $(usex systemd '' -DNO_SYSTEMD)" \
AR="$(tc-getAR)" CC="$(tc-getCC)" \
$(usex systemd '' NO_SYSTEMD=1) \
user
}
src_install() {
emake DESTDIR="${D}" sbindir="/usr/sbin" install
# Upstream make is not deterministic, per bug #601514
rm -f "${D}"/etc/initiatorname.iscsi
dodoc README THANKS
docinto test/
dodoc $(find test -maxdepth 1 -type f ! -name ".*")
local unit
local units=(
iscsi.service
iscsid.{service,socket}
iscsiuio.{service,socket}
)
for unit in ${units[@]} ; do
systemd_dounit etc/systemd/${unit}
done
systemd_dounit "${FILESDIR}"/iscsi-init.service
dotmpfiles "${FILESDIR}"/open-iscsi.conf
fperms 600 /etc/iscsi/iscsid.conf
rm "${D}"/etc/iscsi/initiatorname.iscsi
mv "${D}"/etc/iscsi "${D}"/usr/share/iscsi
}

View File

@ -0,0 +1,3 @@
DIST open-iscsi-2.1.10.tar.gz 645825 BLAKE2B 6a2e279e2dcf77e8d340c025eb59168121ee0c50bd013d0b5d9dac2fbc7116cc54904b4206eea192bd3888e3bcf3da42caeae1e428268edc6c2f7184958b6b04 SHA512 18b92d3e9a85d8de66734d95e9ca74a8acc5167a98830134c18ad5e226b29a00d358f952edfab67b643c454ec63c0a382c7ab7e7e76970f7574b46cea0d5c82d
DIST open-iscsi-2.1.8.tar.gz 638346 BLAKE2B 1e85b6bd75ac31e5aaa65ea8869c2e6e13190786e28e473ab8bd1ea3edb0ef835624194e2ba53718fb2a49c25af53bff9035f5109e1a569155244f03a7dccdc0 SHA512 168ce68dc495cc8b2f217ad0373851d681f9274036b8ec562ece513de493adfdbba55f2038518f246f5244f6405102b2e096a9cce15e73fce9654f06790002c1
DIST open-iscsi-2.1.9.tar.gz 641974 BLAKE2B 87570329dd5902bf96f1c11786c7a814892c851eabb63148f35b85494242f7379db1770a93549dcb871bafa148d37b320b389a98eed2ac46b7252ed22187ecd1 SHA512 25c28da5918b775ca54d3e55591eca0b4f7b5be33d803cad28fce1e9b2334b43cee1423a4e1819497b322e0f420dcd8d74226f442ca432233d1753565b11a5bb

View File

@ -0,0 +1,52 @@
From 0a6432de1a2186449d5e6557f75a9f30e487471d Mon Sep 17 00:00:00 2001
From: Matthias Maier <tamiko@43-1.org>
Date: Thu, 2 Jun 2022 13:12:43 -0500
Subject: [PATCH] Use __bitwise instead of __bitwise__
The iscsi_proto.h header goes into great length ensuring that the
__bitwise macro is defined:
#if !defined(__bitwise)
/*
* If running svn modules we may need to define these.
* This should not go upstream since this is already properly defined there
*/
#ifdef __CHECKER__
#define __bitwise__ __attribute__((bitwise))
#else
#define __bitwise__
#endif
#ifdef __CHECK_ENDIAN__
#define __bitwise __bitwise__
#else
#define __bitwise
#endif
#endif
But then uses the __bitwise__ macro instead:
typedef uint32_t __bitwise__ itt_t;
(This is the only occurence where the __bitwise__ (or __bitwise) macro
is actually used). This seems to be a typo, changing this to __bitwise
fixes compilation with gcc-11 onwards.
---
include/iscsi_proto.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/iscsi_proto.h b/include/iscsi_proto.h
index 1d14b89..3fe9018 100644
--- a/include/iscsi_proto.h
+++ b/include/iscsi_proto.h
@@ -63,7 +63,7 @@
#endif
/* initiator tags; opaque for target */
-typedef uint32_t __bitwise__ itt_t;
+typedef uint32_t __bitwise itt_t;
/* below makes sense only for initiator that created this tag */
#define build_itt(itt, age) ((__force itt_t)\
((itt) | ((age) << ISCSI_AGE_SHIFT)))
--
2.35.1

View File

@ -0,0 +1,43 @@
https://github.com/open-iscsi/open-iscsi/commit/11bdc17938ba648c81a853355a6bbddad69a9fc7
https://bugs.gentoo.org/908587
From 11bdc17938ba648c81a853355a6bbddad69a9fc7 Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Wed, 4 Oct 2023 23:18:20 +0200
Subject: [PATCH] usr/idbm.c: fix musl build (#426)
Fix the following musl build failure raised since version 2.1.9 and
https://github.com/open-iscsi/open-iscsi/commit/7b571d76d6937a78c141630fc38c3c57c532466c:
../usr/idbm.c: In function 'idbm_rec_write_old':
../usr/idbm.c:2230:27: error: 'GLOB_ONLYDIR' undeclared (first use in this function)
2230 | rc = glob(portal, GLOB_ONLYDIR, NULL, &globbuf);
| ^~~~~~~~~~~~
Fixes:
- http://autobuild.buildroot.org/results/14fc1c139f055b5b1eaa6e04e327863c06176a7b
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
usr/idbm.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/usr/idbm.c b/usr/idbm.c
index ca4a4ec..c39abb6 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -45,6 +45,11 @@
#include "fw_context.h"
#include "iscsi_err.h"
+// GLOB_ONLYDIR is not defined under musl
+#ifndef GLOB_ONLYDIR
+#define GLOB_ONLYDIR 0x100
+#endif
+
#define IDBM_HIDE 0 /* Hide parameter when print. */
#define IDBM_SHOW 1 /* Show parameter when print. */
#define IDBM_MASKED 2 /* Show "stars" instead of real value when print */
--
2.41.0

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="project">
<email>base-system@gentoo.org</email>
@ -11,5 +11,6 @@
</use>
<upstream>
<remote-id type="github">open-iscsi/open-iscsi</remote-id>
<remote-id type="cpe">cpe:/a:open-iscsi_project:open-iscsi</remote-id>
</upstream>
</pkgmetadata>

View File

@ -0,0 +1,119 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit flag-o-matic linux-info meson systemd udev
DESCRIPTION="A performant, transport independent, multi-platform implementation of RFC3720"
HOMEPAGE="https://www.open-iscsi.com/"
SRC_URI="https://github.com/${PN}/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="LGPL-3+ GPL-2+"
SLOT="0/0.2"
KEYWORDS="~alpha amd64 arm arm64 ~ia64 ~mips ppc ppc64 ~riscv sparc x86"
IUSE="debug infiniband +tcp rdma systemd"
REQUIRED_USE="infiniband? ( rdma ) || ( rdma tcp )"
# Tries to write to /run/lock/iscsi etc
RESTRICT="test"
DEPEND="
dev-libs/openssl:=
sys-apps/kmod
sys-block/open-isns:=
sys-kernel/linux-headers
infiniband? ( sys-cluster/rdma-core )
systemd? ( sys-apps/systemd:= )
"
RDEPEND="
${DEPEND}
sys-fs/lsscsi
sys-apps/util-linux
"
BDEPEND="virtual/pkgconfig"
PATCHES=(
"${FILESDIR}"/${PN}-2.1.7-fix_bitwise.patch
)
pkg_setup() {
linux-info_pkg_setup
if kernel_is -lt 2 6 16; then
die "Sorry, your kernel must be 2.6.16-rc5 or newer!"
fi
# Needs to be done, as iscsid currently only starts, when having the iSCSI
# support loaded as module. Kernel builtin options don't work. See this for
# more information:
# https://groups.google.com/group/open-iscsi/browse_thread/thread/cc10498655b40507/fd6a4ba0c8e91966
# If there's a new release, check whether this is still valid!
TCP_MODULES="SCSI_ISCSI_ATTRS ISCSI_TCP"
RDMA_MODULES="INFINIBAND_ISER"
INFINIBAND_MODULES="INFINIBAND_IPOIB INIBAND_USER_MAD INFINIBAND_USER_ACCESS"
CONFIG_CHECK_MODULES="tcp? ( ${TCP_MODULES} ) rdma? ( ${RDMA_MODULES} ) infiniband? ( ${INFINIBAND_MODULES} )"
if linux_config_exists; then
if use tcp; then
for module in ${TCP_MODULES}; do
linux_chkconfig_module ${module} || ewarn "${module} needs to be built as module (builtin doesn't work)"
done
fi
if use infiniband; then
for module in ${INFINIBAND_MODULES}; do
linux_chkconfig_module ${module} || ewarn "${module} needs to be built as module (builtin doesn't work)"
done
fi
if use rdma; then
for module in ${RDMA_MODULES}; do
linux_chkconfig_module ${module} || ewarn "${module} needs to be built as module (builtin doesn't work)"$
done
fi
fi
}
src_configure() {
use debug && append-cppflags -DDEBUG_TCP -DDEBUG_SCSI
# TODO: Make sys-block/open-isns optional if useful? There's an upstream
# build system option for this already as of 2.1.9.
local emesonargs=(
-Dsystemddir="$(systemd_get_utildir)"
-Drulesdir="$(get_udevdir)"/rules.d
$(meson_use !systemd no_systemd)
)
meson_src_configure
}
src_install() {
meson_src_install
# Upstream make is not deterministic, per bug #601514
rm -f "${ED}"/etc/initiatorname.iscsi
docinto test/
dodoc $(find test -maxdepth 1 -type f ! -name ".*")
insinto /etc/iscsi
newins "${FILESDIR}"/initiatorname.iscsi initiatorname.iscsi.example
newconfd "${FILESDIR}"/iscsid-conf.d iscsid
newinitd "${FILESDIR}"/iscsid-init.d iscsid
keepdir /var/db/iscsi
fperms 700 /var/db/iscsi
fperms 600 /etc/iscsi/iscsid.conf
}
pkg_postinst() {
in='/etc/iscsi/initiatorname.iscsi'
if [[ ! -f "${EROOT}${in}" ]] && [[ -f "${EROOT}${in}.example" ]] ; then
{
cat "${EROOT}${in}.example"
echo "# InitiatorName generated by ${CATEGORY}/${PF} at $(date -uR)"
echo "InitiatorName=$(${ROOT}/usr/sbin/iscsi-iname)"
} >> "${EROOT}${in}.tmp" && mv -f "${EROOT}${in}.tmp" "${EROOT}${in}"
fi
udev_reload
}

View File

@ -0,0 +1,117 @@
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit flag-o-matic linux-info meson systemd udev
DESCRIPTION="A performant, transport independent, multi-platform implementation of RFC3720"
HOMEPAGE="https://www.open-iscsi.com/"
SRC_URI="https://github.com/${PN}/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0/0.2"
KEYWORDS="~alpha amd64 arm arm64 ~ia64 ~mips ppc ppc64 ~riscv sparc x86"
IUSE="debug infiniband +tcp rdma systemd"
REQUIRED_USE="infiniband? ( rdma ) || ( rdma tcp )"
# Tries to write to /run/lock/iscsi etc
RESTRICT="test"
DEPEND="
dev-libs/openssl:=
sys-apps/kmod
sys-block/open-isns:=
sys-kernel/linux-headers
infiniband? ( sys-cluster/rdma-core )
systemd? ( sys-apps/systemd:= )
"
RDEPEND="
${DEPEND}
sys-fs/lsscsi
sys-apps/util-linux
"
BDEPEND="virtual/pkgconfig"
PATCHES=(
"${FILESDIR}"/${PN}-2.1.7-fix_bitwise.patch
)
pkg_setup() {
linux-info_pkg_setup
if kernel_is -lt 2 6 16; then
die "Sorry, your kernel must be 2.6.16-rc5 or newer!"
fi
# Needs to be done, as iscsid currently only starts, when having the iSCSI
# support loaded as module. Kernel builtin options don't work. See this for
# more information:
# https://groups.google.com/group/open-iscsi/browse_thread/thread/cc10498655b40507/fd6a4ba0c8e91966
# If there's a new release, check whether this is still valid!
TCP_MODULES="SCSI_ISCSI_ATTRS ISCSI_TCP"
RDMA_MODULES="INFINIBAND_ISER"
INFINIBAND_MODULES="INFINIBAND_IPOIB INIBAND_USER_MAD INFINIBAND_USER_ACCESS"
CONFIG_CHECK_MODULES="tcp? ( ${TCP_MODULES} ) rdma? ( ${RDMA_MODULES} ) infiniband? ( ${INFINIBAND_MODULES} )"
if linux_config_exists; then
if use tcp; then
for module in ${TCP_MODULES}; do
linux_chkconfig_module ${module} || ewarn "${module} needs to be built as module (builtin doesn't work)"
done
fi
if use infiniband; then
for module in ${INFINIBAND_MODULES}; do
linux_chkconfig_module ${module} || ewarn "${module} needs to be built as module (builtin doesn't work)"
done
fi
if use rdma; then
for module in ${RDMA_MODULES}; do
linux_chkconfig_module ${module} || ewarn "${module} needs to be built as module (builtin doesn't work)"$
done
fi
fi
}
src_configure() {
use debug && append-cppflags -DDEBUG_TCP -DDEBUG_SCSI
local emesonargs=(
-Dsystemddir="$(systemd_get_utildir)"
-Drulesdir="$(get_udevdir)"/rules.d
$(meson_use !systemd no_systemd)
)
meson_src_configure
}
src_install() {
meson_src_install
# Upstream make is not deterministic, per bug #601514
rm -f "${ED}"/etc/initiatorname.iscsi
docinto test/
dodoc $(find test -maxdepth 1 -type f ! -name ".*")
insinto /etc/iscsi
newins "${FILESDIR}"/initiatorname.iscsi initiatorname.iscsi.example
newconfd "${FILESDIR}"/iscsid-conf.d iscsid
newinitd "${FILESDIR}"/iscsid-init.d iscsid
keepdir /var/db/iscsi
fperms 700 /var/db/iscsi
fperms 600 /etc/iscsi/iscsid.conf
}
pkg_postinst() {
in='/etc/iscsi/initiatorname.iscsi'
if [[ ! -f "${EROOT}${in}" ]] && [[ -f "${EROOT}${in}.example" ]] ; then
{
cat "${EROOT}${in}.example"
echo "# InitiatorName generated by ${CATEGORY}/${PF} at $(date -uR)"
echo "InitiatorName=$(${ROOT}/usr/sbin/iscsi-iname)"
} >> "${EROOT}${in}.tmp" && mv -f "${EROOT}${in}.tmp" "${EROOT}${in}"
fi
udev_reload
}

View File

@ -0,0 +1,120 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit flag-o-matic linux-info meson systemd udev
DESCRIPTION="A performant, transport independent, multi-platform implementation of RFC3720"
HOMEPAGE="https://www.open-iscsi.com/"
SRC_URI="https://github.com/${PN}/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="LGPL-3+ GPL-2+"
SLOT="0/0.2"
KEYWORDS="~alpha amd64 arm arm64 ~ia64 ~mips ppc ppc64 ~riscv sparc x86"
IUSE="debug infiniband +tcp rdma systemd"
REQUIRED_USE="infiniband? ( rdma ) || ( rdma tcp )"
# Tries to write to /run/lock/iscsi etc
RESTRICT="test"
DEPEND="
dev-libs/openssl:=
sys-apps/kmod
sys-block/open-isns:=
sys-kernel/linux-headers
infiniband? ( sys-cluster/rdma-core )
systemd? ( sys-apps/systemd:= )
"
RDEPEND="
${DEPEND}
sys-fs/lsscsi
sys-apps/util-linux
"
BDEPEND="virtual/pkgconfig"
PATCHES=(
"${FILESDIR}"/${PN}-2.1.7-fix_bitwise.patch
"${FILESDIR}"/${P}-usr-idbm.c-fix-musl-build-426.patch
)
pkg_setup() {
linux-info_pkg_setup
if kernel_is -lt 2 6 16; then
die "Sorry, your kernel must be 2.6.16-rc5 or newer!"
fi
# Needs to be done, as iscsid currently only starts, when having the iSCSI
# support loaded as module. Kernel builtin options don't work. See this for
# more information:
# https://groups.google.com/group/open-iscsi/browse_thread/thread/cc10498655b40507/fd6a4ba0c8e91966
# If there's a new release, check whether this is still valid!
TCP_MODULES="SCSI_ISCSI_ATTRS ISCSI_TCP"
RDMA_MODULES="INFINIBAND_ISER"
INFINIBAND_MODULES="INFINIBAND_IPOIB INIBAND_USER_MAD INFINIBAND_USER_ACCESS"
CONFIG_CHECK_MODULES="tcp? ( ${TCP_MODULES} ) rdma? ( ${RDMA_MODULES} ) infiniband? ( ${INFINIBAND_MODULES} )"
if linux_config_exists; then
if use tcp; then
for module in ${TCP_MODULES}; do
linux_chkconfig_module ${module} || ewarn "${module} needs to be built as module (builtin doesn't work)"
done
fi
if use infiniband; then
for module in ${INFINIBAND_MODULES}; do
linux_chkconfig_module ${module} || ewarn "${module} needs to be built as module (builtin doesn't work)"
done
fi
if use rdma; then
for module in ${RDMA_MODULES}; do
linux_chkconfig_module ${module} || ewarn "${module} needs to be built as module (builtin doesn't work)"$
done
fi
fi
}
src_configure() {
use debug && append-cppflags -DDEBUG_TCP -DDEBUG_SCSI
# TODO: Make sys-block/open-isns optional if useful? There's an upstream
# build system option for this already as of 2.1.9.
local emesonargs=(
-Dsystemddir="$(systemd_get_utildir)"
-Drulesdir="$(get_udevdir)"/rules.d
$(meson_use !systemd no_systemd)
)
meson_src_configure
}
src_install() {
meson_src_install
# Upstream make is not deterministic, per bug #601514
rm -f "${ED}"/etc/initiatorname.iscsi
docinto test/
dodoc $(find test -maxdepth 1 -type f ! -name ".*")
insinto /etc/iscsi
newins "${FILESDIR}"/initiatorname.iscsi initiatorname.iscsi.example
newconfd "${FILESDIR}"/iscsid-conf.d iscsid
newinitd "${FILESDIR}"/iscsid-init.d iscsid
keepdir /var/db/iscsi
fperms 700 /var/db/iscsi
fperms 600 /etc/iscsi/iscsid.conf
}
pkg_postinst() {
in='/etc/iscsi/initiatorname.iscsi'
if [[ ! -f "${EROOT}${in}" ]] && [[ -f "${EROOT}${in}.example" ]] ; then
{
cat "${EROOT}${in}.example"
echo "# InitiatorName generated by ${CATEGORY}/${PF} at $(date -uR)"
echo "InitiatorName=$(${ROOT}/usr/sbin/iscsi-iname)"
} >> "${EROOT}${in}.tmp" && mv -f "${EROOT}${in}.tmp" "${EROOT}${in}"
fi
udev_reload
}