1*edff4923SAndrew GeisslerSUMMARY = "iSCSI daemon and utility programs"
2*edff4923SAndrew GeisslerDESCRIPTION = "Open-iSCSI project is a high performance, transport \
3*edff4923SAndrew Geisslerindependent, multi-platform implementation of RFC3720. The iscsi package \
4*edff4923SAndrew Geisslerprovides the server daemon for the iSCSI protocol, as well as the utility \
5*edff4923SAndrew Geisslerprograms used to manage it. iSCSI is a protocol for distributed \
6*edff4923SAndrew Geisslerdisk access using SCSI commands sent over Internet Protocol networks."
7*edff4923SAndrew GeisslerHOMEPAGE = "http://www.open-iscsi.com/"
8*edff4923SAndrew GeisslerLICENSE = "GPL-2.0-only & LGPL-2.1-only"
9*edff4923SAndrew GeisslerSECTION = "net"
10*edff4923SAndrew GeisslerDEPENDS = "openssl flex-native bison-native open-isns util-linux kmod"
11*edff4923SAndrew GeisslerDEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}"
12*edff4923SAndrew Geissler
13*edff4923SAndrew GeisslerLIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
14*edff4923SAndrew Geissler
15*edff4923SAndrew GeisslerSRCREV = "d0f04ae4b9bf0bc0be55fbda5f235afdfbf5dd19"
16*edff4923SAndrew Geissler
17*edff4923SAndrew GeisslerSRC_URI = "git://github.com/open-iscsi/open-iscsi;branch=master;protocol=https \
18*edff4923SAndrew Geissler           file://0001-Makefile-Do-not-set-Werror.patch \
19*edff4923SAndrew Geissler           file://initd.debian \
20*edff4923SAndrew Geissler           file://99_iscsi-initiator-utils \
21*edff4923SAndrew Geissler           file://iscsi-initiator \
22*edff4923SAndrew Geissler           file://iscsi-initiator.service \
23*edff4923SAndrew Geissler           file://iscsi-initiator-targets.service \
24*edff4923SAndrew Geissler           file://set_initiatorname \
25*edff4923SAndrew Geissler           "
26*edff4923SAndrew GeisslerS = "${WORKDIR}/git"
27*edff4923SAndrew Geissler
28*edff4923SAndrew Geisslerinherit update-rc.d systemd autotools pkgconfig
29*edff4923SAndrew Geissler
30*edff4923SAndrew GeisslerEXTRA_OECONF = " \
31*edff4923SAndrew Geissler    --target=${TARGET_SYS} \
32*edff4923SAndrew Geissler    --host=${BUILD_SYS} \
33*edff4923SAndrew Geissler"
34*edff4923SAndrew Geissler
35*edff4923SAndrew GeisslerEXTRA_OECONF += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', '--without-systemd NO_SYSTEMD=1',     d)}"
36*edff4923SAndrew Geissler
37*edff4923SAndrew GeisslerEXTRA_OEMAKE = ' \
38*edff4923SAndrew Geissler    OS="${TARGET_SYS}" \
39*edff4923SAndrew Geissler    TARGET="${TARGET_OS}" \
40*edff4923SAndrew Geissler    BASE="${prefix}" \
41*edff4923SAndrew Geissler    MANDIR="${mandir}" \
42*edff4923SAndrew Geissler    OPTFLAGS="-DNO_SYSTEMD ${CFLAGS}" \
43*edff4923SAndrew Geissler    PKG_CONFIG="${STAGING_BINDIR_NATIVE}/pkg-config" \
44*edff4923SAndrew Geissler    SED=sed \
45*edff4923SAndrew Geissler'
46*edff4923SAndrew Geissler
47*edff4923SAndrew Geissler
48*edff4923SAndrew Geisslerdo_configure () {
49*edff4923SAndrew Geissler    cd ${S}/iscsiuio ; autoreconf --install; ./configure ${EXTRA_OECONF}
50*edff4923SAndrew Geissler}
51*edff4923SAndrew Geissler
52*edff4923SAndrew Geisslerdo_compile () {
53*edff4923SAndrew Geissler    # Make sure we DO NOT regenerate prom_lex.c.
54*edff4923SAndrew Geissler    if [ -f ${S}/utils/fwparam_ibft/prom_lex.l ]; then
55*edff4923SAndrew Geissler        mv ${S}/utils/fwparam_ibft/prom_lex.l ${S}/utils/fwparam_ibft/prom_lex.l.unused
56*edff4923SAndrew Geissler    fi
57*edff4923SAndrew Geissler    oe_runmake -C ${S} ${EXTRA_OEMAKE} user
58*edff4923SAndrew Geissler}
59*edff4923SAndrew Geissler
60*edff4923SAndrew Geisslerdo_install () {
61*edff4923SAndrew Geissler    #install necessary directories
62*edff4923SAndrew Geissler    install -d ${D}${sbindir} \
63*edff4923SAndrew Geissler        ${D}${sysconfdir}/init.d \
64*edff4923SAndrew Geissler        ${D}${sysconfdir}/iscsi \
65*edff4923SAndrew Geissler        ${D}${localstatedir}/lib/iscsi/nodes \
66*edff4923SAndrew Geissler        ${D}${localstatedir}/lib/iscsi/send_targets \
67*edff4923SAndrew Geissler        ${D}${localstatedir}/lib/iscsi/static \
68*edff4923SAndrew Geissler        ${D}${localstatedir}/lib/iscsi/isns \
69*edff4923SAndrew Geissler        ${D}${localstatedir}/lib/iscsi/slp \
70*edff4923SAndrew Geissler        ${D}${localstatedir}/lib/iscsi/ifaces \
71*edff4923SAndrew Geissler        ${D}${libdir} \
72*edff4923SAndrew Geissler        ${D}${mandir}/man8
73*edff4923SAndrew Geissler
74*edff4923SAndrew Geissler    install -p -m 755 ${S}/usr/iscsid ${S}/usr/iscsiadm \
75*edff4923SAndrew Geissler        ${S}/utils/iscsi-iname \
76*edff4923SAndrew Geissler        ${S}/usr/iscsistart ${D}/${sbindir}
77*edff4923SAndrew Geissler
78*edff4923SAndrew Geissler    cp -dR ${S}/libopeniscsiusr/libopeniscsiusr.so* ${D}${libdir}
79*edff4923SAndrew Geissler    install -p -m 644 ${S}/doc/iscsiadm.8 ${S}/doc/iscsid.8 ${D}/${mandir}/man8
80*edff4923SAndrew Geissler    install -p -m 644 ${S}/etc/iscsid.conf ${D}${sysconfdir}/iscsi
81*edff4923SAndrew Geissler    install -p -m 755 ${UNPACKDIR}/initd.debian ${D}${sysconfdir}/init.d/iscsid
82*edff4923SAndrew Geissler
83*edff4923SAndrew Geissler    sed -i -e "s:= /sbin/iscsid:= ${sbindir}/iscsid:" ${D}${sysconfdir}/iscsi/iscsid.conf
84*edff4923SAndrew Geissler
85*edff4923SAndrew Geissler    if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
86*edff4923SAndrew Geissler        install -d ${D}${sysconfdir}/tmpfiles.d
87*edff4923SAndrew Geissler        echo "d /run/${BPN}/lock - - - -" \
88*edff4923SAndrew Geissler                     > ${D}${sysconfdir}/tmpfiles.d/iscsi.conf
89*edff4923SAndrew Geissler        install -d ${D}/etc/default/
90*edff4923SAndrew Geissler        install -p -m 755 ${UNPACKDIR}/iscsi-initiator ${D}${sysconfdir}/default/
91*edff4923SAndrew Geissler
92*edff4923SAndrew Geissler        install -d ${D}${systemd_unitdir}/system/
93*edff4923SAndrew Geissler        install -m 0644 ${UNPACKDIR}/iscsi-initiator.service \
94*edff4923SAndrew Geissler                        ${UNPACKDIR}/iscsi-initiator-targets.service \
95*edff4923SAndrew Geissler                        ${D}${systemd_unitdir}/system/
96*edff4923SAndrew Geissler        install -d ${D}${nonarch_libdir}/iscsi
97*edff4923SAndrew Geissler        install -m 0755 ${UNPACKDIR}/set_initiatorname ${D}${nonarch_libdir}/iscsi
98*edff4923SAndrew Geissler    else
99*edff4923SAndrew Geissler        install -d ${D}/etc/default/volatiles
100*edff4923SAndrew Geissler        install -m 0644 ${UNPACKDIR}/99_iscsi-initiator-utils ${D}/etc/default/volatiles
101*edff4923SAndrew Geissler    fi
102*edff4923SAndrew Geissler}
103*edff4923SAndrew Geissler
104*edff4923SAndrew Geisslerpkg_postinst:${PN}() {
105*edff4923SAndrew Geissler    if [ "x$D" = "x" ]; then
106*edff4923SAndrew Geissler        if [ -e /etc/init.d/populate-volatile.sh ]; then
107*edff4923SAndrew Geissler            /etc/init.d/populate-volatile.sh update
108*edff4923SAndrew Geissler        elif command -v systemd-tmpfiles >/dev/null; then
109*edff4923SAndrew Geissler            systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/iscsi.conf
110*edff4923SAndrew Geissler        fi
111*edff4923SAndrew Geissler    fi
112*edff4923SAndrew Geissler}
113*edff4923SAndrew Geissler
114*edff4923SAndrew GeisslerSYSTEMD_SERVICE = " iscsi-initiator.service iscsi-initiator-targets.service "
115*edff4923SAndrew GeisslerINITSCRIPT_NAME = "iscsid"
116*edff4923SAndrew GeisslerINITSCRIPT_PARAMS = "start 30 1 2 3 4 5 . stop 70 0 1 2 3 4 5 6 ."
117*edff4923SAndrew Geissler
118*edff4923SAndrew GeisslerFILES:${PN} += "${nonarch_libdir}/iscsi"
119