summaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-daemons
diff options
context:
space:
mode:
authorRoy Li <rongqing.li@windriver.com>2014-09-25 15:49:33 +0800
committerMartin Jansa <Martin.Jansa@gmail.com>2014-09-26 05:42:54 +0200
commit9ff03613176e6468d612ae95a392df583cd8f7ba (patch)
tree9a0c6ff300aa2096b7867f5da474b73bb88ce139 /meta-networking/recipes-daemons
parentc22f2d1be5b9762d6972ffe2fe258b8241571f59 (diff)
downloadmeta-openembedded-9ff03613176e6468d612ae95a392df583cd8f7ba.tar.gz
iscsi-initiator-utils: add recipe file
The package provides the server daemon for the iSCSI protocol, as well as the utility programs used to manage it. iSCSI is a protocol for distributed disk access using SCSI commands sent over Internet Protocol networks Signed-off-by: Roy Li <rongqing.li@windriver.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-networking/recipes-daemons')
-rw-r--r--meta-networking/recipes-daemons/iscsi-initiator-utils/files/99_iscsi-initiator-utils2
-rw-r--r--meta-networking/recipes-daemons/iscsi-initiator-utils/files/initd.debian119
-rw-r--r--meta-networking/recipes-daemons/iscsi-initiator-utils/files/iscsi-initiator4
-rw-r--r--meta-networking/recipes-daemons/iscsi-initiator-utils/files/iscsi-initiator-targets.service15
-rw-r--r--meta-networking/recipes-daemons/iscsi-initiator-utils/files/iscsi-initiator-utils-dont-use-static.patch21
-rw-r--r--meta-networking/recipes-daemons/iscsi-initiator-utils/files/iscsi-initiator-utils-use-var-for-config.patch240
-rw-r--r--meta-networking/recipes-daemons/iscsi-initiator-utils/files/iscsi-initiator.service12
-rw-r--r--meta-networking/recipes-daemons/iscsi-initiator-utils/iscsi-initiator-utils_2.0-873.bb111
8 files changed, 524 insertions, 0 deletions
diff --git a/meta-networking/recipes-daemons/iscsi-initiator-utils/files/99_iscsi-initiator-utils b/meta-networking/recipes-daemons/iscsi-initiator-utils/files/99_iscsi-initiator-utils
new file mode 100644
index 000000000..42fdd602f
--- /dev/null
+++ b/meta-networking/recipes-daemons/iscsi-initiator-utils/files/99_iscsi-initiator-utils
@@ -0,0 +1,2 @@
1# <type> <owner> <group> <mode> <path> <linksource>
2d root root 0755 /var/lock/iscsi none
diff --git a/meta-networking/recipes-daemons/iscsi-initiator-utils/files/initd.debian b/meta-networking/recipes-daemons/iscsi-initiator-utils/files/initd.debian
new file mode 100644
index 000000000..99a763861
--- /dev/null
+++ b/meta-networking/recipes-daemons/iscsi-initiator-utils/files/initd.debian
@@ -0,0 +1,119 @@
1#! /bin/sh
2### BEGIN INIT INFO
3# Provides:
4# Required-Start:
5# Required-Stop:
6# Default-Start:
7# Default-Stop:
8# Short-Description: Starts and stops the iSCSI initiator services and logins to default targets
9### END INIT INFO
10#set -x
11PATH=/sbin:/bin:/usr/sbin:/usr/bin
12DAEMON=/usr/sbin/iscsid
13ADM=/usr/sbin/iscsiadm
14PIDFILE=/var/run/iscsid.pid
15
16[ -x "$DAEMON" ] || exit 0
17
18if [ ! -d /sys/class/ ]; then
19 echo "Failure:" "iSCSI requires a mounted sysfs, not started."
20 exit 1
21fi
22
23nodestartup_re='s/^node\.conn\[0]\.startup[ ]*=[ ]*//p'
24
25RETVAL=0
26
27start() {
28 echo "Starting iSCSI initiator service" "iscsid"
29 modprobe -q iscsi_tcp 2>/dev/null || :
30 modprobe -q ib_iser 2>/dev/null || :
31 if [ ! -f /etc/iscsi/initiatorname.iscsi ]; then
32 INITIATORNAME=$(iscsi-iname)
33 cat >/etc/iscsi/initiatorname.iscsi <<EOF
34## DO NOT EDIT OR REMOVE THIS FILE!
35## If you remove this file, the iSCSI daemon will not start.
36## If you change the InitiatorName, existing access control lists
37## may reject this initiator. The InitiatorName must be unique
38## for each iSCSI initiator. Do NOT duplicate iSCSI InitiatorNames.
39InitiatorName=$INITIATORNAME
40EOF
41 fi
42 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON
43 RETVAL=$?
44 starttargets
45}
46
47starttargets() {
48 echo "Setting up iSCSI targets"
49 $ADM -m node --loginall=automatic
50}
51
52stoptargets() {
53 echo "Disconnecting iSCSI targets"
54 sync
55 $ADM -m node --logoutall=all
56 RETVAL=$?
57 #if RETVAL is 21, means no active sessions, consider ok
58 if [ "$RETVAL" = "21" ]; then
59 RETVAL=0
60 fi
61}
62
63stop() {
64 stoptargets
65 if [ $RETVAL -ne 0 ]; then
66 echo "Failure:" "Could not stop all targets, try again later"
67 return $RETVAL
68 fi
69
70 echo "Stopping iSCSI initiator service"
71 start-stop-daemon --stop --quiet --pidfile $PIDFILE --exec $DAEMON
72 rm -f $PIDFILE
73 status=0
74 modprobe -r ib_iser 2>/dev/null
75 if [ "$?" -ne "0" -a "$?" -ne "1" ]; then
76 status=1
77 fi
78 modprobe -r iscsi_tcp 2>/dev/null
79 if [ "$?" -ne "0" -a "$?" -ne "1" ]; then
80 status=1
81 fi
82}
83
84restart() {
85 stop
86 if [ $RETVAL -ne 0 ]; then
87 echo "Failure:" "Stopping iSCSI initiator service failed, not starting"
88 return $RETVAL
89 fi
90 start
91}
92
93restarttargets() {
94 stoptargets
95 if [ $RETVAL -ne 0 ]; then
96 echo "Failure:" "Could not stop all targets, try again later"
97 return $RETVAL
98 fi
99 starttargets
100}
101
102status() {
103 #XXX FIXME: what to do here?
104 #status iscsid
105 # list active sessions
106 echo Current active iSCSI sessions:
107 $ADM -m session
108}
109
110case "$1" in
111 start|starttargets|stop|stoptargets|restart|restarttargets|status)
112 $1
113 ;;
114 *)
115 echo "Usage: $0 {start|stop|restart|status}"
116 exit 1
117 ;;
118esac
119exit $RETVAL
diff --git a/meta-networking/recipes-daemons/iscsi-initiator-utils/files/iscsi-initiator b/meta-networking/recipes-daemons/iscsi-initiator-utils/files/iscsi-initiator
new file mode 100644
index 000000000..7fa49a2d6
--- /dev/null
+++ b/meta-networking/recipes-daemons/iscsi-initiator-utils/files/iscsi-initiator
@@ -0,0 +1,4 @@
1# default command line settings for open-iscsi's iscsid
2
3OPTS_ISCSID=""
4OPTS_ISCSIADM=""
diff --git a/meta-networking/recipes-daemons/iscsi-initiator-utils/files/iscsi-initiator-targets.service b/meta-networking/recipes-daemons/iscsi-initiator-utils/files/iscsi-initiator-targets.service
new file mode 100644
index 000000000..564b2d21d
--- /dev/null
+++ b/meta-networking/recipes-daemons/iscsi-initiator-utils/files/iscsi-initiator-targets.service
@@ -0,0 +1,15 @@
1[Unit]
2Description=Open-iSCSI initiator (i.e. client) target bindings
3After=iscsi-initiator.service
4Requires=iscsi-initiator.service
5
6[Service]
7Type=oneshot
8EnvironmentFile=/etc/default/iscsi-initiator
9ExecStart=/usr/sbin/iscsiadm -m node --loginall=automatic $OPTS_ISCSIADM
10ExecStop=/usr/sbin/iscsiadm -m node --logoutall=all $OPTS_ISCSIADM
11RemainAfterExit=yes
12
13[Install]
14WantedBy=multi-user.target
15
diff --git a/meta-networking/recipes-daemons/iscsi-initiator-utils/files/iscsi-initiator-utils-dont-use-static.patch b/meta-networking/recipes-daemons/iscsi-initiator-utils/files/iscsi-initiator-utils-dont-use-static.patch
new file mode 100644
index 000000000..ce48e2bb3
--- /dev/null
+++ b/meta-networking/recipes-daemons/iscsi-initiator-utils/files/iscsi-initiator-utils-dont-use-static.patch
@@ -0,0 +1,21 @@
1iscsi-initiator-utils not to use static
2
3Upstream-status: Backport
4This patch is from fedora17.
5
6Signed-off-by: Yao Zhao <yao.zhao@windriver.com>
7Signed-off-by: Vu Tran <vu.tran@windriver.com>
8
9diff --git a/usr/Makefile b/usr/Makefile
10index 673b7f1..fd14a10 100644
11--- a/usr/Makefile
12+++ b/usr/Makefile
13@@ -61,7 +61,7 @@ iscsiadm: $(ISCSI_LIB_SRCS) $(DISCOVERY_SRCS) iscsiadm.o session_mgmt.o
14
15 iscsistart: $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) $(FW_BOOT_SRCS) \
16 iscsistart.o statics.o
17- $(CC) $(CFLAGS) -static $^ -o $@
18+ $(CC) $(CFLAGS) $^ -o $@
19 clean:
20 rm -f *.o $(PROGRAMS) .depend $(LIBSYS)
21
diff --git a/meta-networking/recipes-daemons/iscsi-initiator-utils/files/iscsi-initiator-utils-use-var-for-config.patch b/meta-networking/recipes-daemons/iscsi-initiator-utils/files/iscsi-initiator-utils-use-var-for-config.patch
new file mode 100644
index 000000000..50227a774
--- /dev/null
+++ b/meta-networking/recipes-daemons/iscsi-initiator-utils/files/iscsi-initiator-utils-use-var-for-config.patch
@@ -0,0 +1,240 @@
1iscsi-initiator-utils to use var for config
2
3Upstream-status: Backport
4This patch is from fedora.
5
6Use /var/lib/iscsi/ instead of /etc/iscsi/ for holding
7state files.
8
9Signed-off-by: Yao Zhao <yao.zhao@windriver.com>
10Signed-off-by: Vu Tran <vu.tran@windriver.com>
11
12diff --git a/README b/README
13index 7364b2d..5e8bff8 100644
14--- a/README
15+++ b/README
16@@ -164,10 +164,10 @@ available on all Linux installations.
17
18 The database contains two tables:
19
20-- Discovery table (/etc/iscsi/send_targets);
21-- Node table (/etc/iscsi/nodes).
22+- Discovery table (/var/lib/iscsi/send_targets);
23+- Node table (/var/lib/iscsi/nodes).
24
25-The regular place for iSCSI database files: /etc/iscsi/nodes
26+The regular place for iSCSI database files: /var/lib/iscsi/nodes
27
28 The iscsiadm utility is a command-line tool to manage (update, delete,
29 insert, query) the persistent database.
30@@ -444,7 +444,7 @@ a scsi_host per HBA port).
31 To manage both types of initiator stacks, iscsiadm uses the interface (iface)
32 structure. For each HBA port or for software iscsi for each network
33 device (ethX) or NIC, that you wish to bind sessions to you must create
34-a iface config /etc/iscsi/ifaces.
35+a iface config /var/lib/iscsi/ifaces.
36
37 Prep:
38
39@@ -478,29 +478,29 @@ Running:
40 iface0 qla4xxx,00:c0:dd:08:63:e8,20.15.0.7,default,iqn.2005-06.com.redhat:madmax
41 iface1 qla4xxx,00:c0:dd:08:63:ea,20.15.0.9,default,iqn.2005-06.com.redhat:madmax
42
43-Will report iface configurations that are setup in /etc/iscsi/ifaces.
44+Will report iface configurations that are setup in /var/lib/iscsi/ifaces.
45 The format is:
46
47 iface_name transport_name,hwaddress,ipaddress,net_ifacename,initiatorname
48
49 For software iscsi, you can create the iface configs by hand, but it is
50 reccomended that you use iscsiadm's iface mode. There is a iface.example in
51-/etc/iscsi/ifaces which can be used as a template for the daring.
52+/var/lib/iscsi/ifaces which can be used as a template for the daring.
53
54 For each network object you wish to bind a session to you must create
55-a seperate iface config in /etc/iscsi/ifaces and each iface config file
56+a seperate iface config in /var/lib/iscsi/ifaces and each iface config file
57 must have a unique name which is less than or equal to 64 characters.
58
59 Example:
60
61 If you have NIC1 with MAC address 00:0F:1F:92:6B:BF and NIC2 with
62 MAC address 00:C0:DD:08:63:E7 and you wanted to do software iscsi over
63-TCP/IP. Then in /etc/iscsi/ifaces/iface0 you would enter:
64+TCP/IP. Then in /var/lib/iscsi/ifaces/iface0 you would enter:
65
66 iface.transport_name = tcp
67 iface.hwaddress = 00:0F:1F:92:6B:BF
68
69-and in /etc/iscsi/ifaces/iface1 you would enter:
70+and in /var/lib/iscsi/ifaces/iface1 you would enter:
71
72 iface.transport_name = tcp
73 iface.hwaddress = 00:C0:DD:08:63:E7
74@@ -550,7 +550,7 @@ cxgb3i.00:07:43:05:97:07 cxgb3i,00:07:43:05:97:07,<empty>,<empty>,<empty>
75 qla4xxx.00:0e:1e:04:8b:2e qla4xxx,00:0e:1e:04:8b:2e,<empty>,<empty>,<empty>
76
77
78-Will report iface configurations that are setup in /etc/iscsi/ifaces.
79+Will report iface configurations that are setup in /var/lib/iscsi/ifaces.
80 The format is:
81
82 iface_name transport_name,hwaddress,ipaddress,net_ifacename,initiatorname
83@@ -636,7 +636,7 @@ need a seperate network connection to the target for discovery purposes.
84 *This will be fixed in the next version of open-iscsi*
85
86 For compatibility reasons, when you run iscsiadm to do discovery, it
87-will check for interfaces in /etc/iscsi/iscsi/ifaces that are using
88+will check for interfaces in /var/lib/iscsi/iscsi/ifaces that are using
89 tcp for the iface.transport and it will bind the portals that are discovered
90 so that they will be logged in through those ifaces. This behavior can also
91 be overriden by passing in the interfaces you want to use. For the case
92@@ -654,7 +654,7 @@ we do not bind a session to a iface, then you can use the special iface
93
94 iscsiadm -m discoverydb -t st -p ip:port -I default --discover -P 1
95
96-And if you did not define any interfaces in /etc/iscsi/ifaces and do
97+And if you did not define any interfaces in /var/lib/iscsi/ifaces and do
98 not pass anything into iscsiadm, running iscsiadm will do the default
99 behavior, where we allow the network subsystem to decide which
100 device to use.
101@@ -696,7 +696,7 @@ To now log into targets it is the same as with sofware iscsi. See section
102
103 ./iscsiadm -m discoverydb -t st -p 192.168.1.1:3260 --discover
104
105- This will search /etc/iscsi/send_targets for a record with the
106+ This will search /var/lib/iscsi/send_targets for a record with the
107 ID [portal = 192.168.1.1:3260 and type = sendtargets. If found it
108 will perform discovery using the settings stored in the record.
109 If a record does not exist, it will be created using the iscsid.conf
110@@ -705,7 +705,7 @@ To now log into targets it is the same as with sofware iscsi. See section
111 The argument to -p may also be a hostname instead of an address.
112 ./iscsiadm -m discoverydb -t st -p smoehost --discover
113
114- For the ifaces, iscsiadm will first search /etc/iscsi/ifaces for
115+ For the ifaces, iscsiadm will first search /var/lib/iscsi/ifaces for
116 interfaces using software iscsi. If any are found then nodes found
117 during discovery will be setup so that they can logged in through
118 those interfaces. To specify a specific iface, pass the
119@@ -761,7 +761,7 @@ To now log into targets it is the same as with sofware iscsi. See section
120 This command will perform discovery, but not manipulate the node DB.
121
122 - SendTargets iSCSI Discovery with a specific interface. If you
123- wish to only use a subset of the interfaces in /etc/iscsi/ifaces
124+ wish to only use a subset of the interfaces in /var/lib/iscsi/ifaces
125 then you can pass them in during discovery:
126
127 ./iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 \
128@@ -1072,8 +1072,8 @@ where targetname is the name of the target and ip_address:port is the address
129 and port of the portal. tpgt, is the portal group tag of
130 the portal, and is not used in iscsiadm commands except for static
131 record creation. And iface name is the name of the iscsi interface
132-defined in /etc/iscsi/ifaces. If no interface was defined in
133-/etc/iscsi/ifaces or passed in, the default behavior is used.
134+defined in /var/lib/iscsi/ifaces. If no interface was defined in
135+/var/lib/iscsi/ifaces or passed in, the default behavior is used.
136 Default here is iscsi_tcp/tcp to be used over which ever NIC the
137 network layer decides is best.
138
139@@ -1188,7 +1188,7 @@ If set, iscsid will perform discovery to the address every
140 discovery.isns.discoveryd_poll_inval or
141 discovery.sendtargets.discoveryd_poll_inval seconds,
142 and it will log into any portals found from the discovery source using
143-the ifaces in /etc/iscsi/ifaces.
144+the ifaces in /var/lib/iscsi/ifaces.
145
146 Note that for iSNS the poll_interval does not have to be set. If not set,
147 iscsid will only perform rediscovery when it gets a SCN from the server.
148diff --git a/doc/iscsiadm.8 b/doc/iscsiadm.8
149index 7c209f6..e94cca0 100644
150--- a/doc/iscsiadm.8
151+++ b/doc/iscsiadm.8
152@@ -89,7 +89,7 @@ This option is only valid for ping submode.
153 .TP
154 \fB\-I\fR, \fB\-\-interface=\fI[iface]\fR
155 The interface argument specifies the iSCSI interface to use for the operation.
156-iSCSI interfaces (iface) are defined in /etc/iscsi/ifaces. For hardware
157+iSCSI interfaces (iface) are defined in /var/lib/iscsi/ifaces. For hardware
158 iSCSI (qla4xxx) the iface config must have the hardware address
159 (iface.hwaddress = port's MAC address)
160 and the driver/transport_name (iface.transport_name). The iface's name is
161@@ -166,7 +166,7 @@ If no other options are specified: for \fIdiscoverydb\fR and \fInode\fR, all
162 of their respective records are displayed; for \fIsession\fR, all active
163 sessions and connections are displayed; for \fIfw\fR, all boot firmware
164 values are displayed; for \fIhost\fR, all iSCSI hosts are displayed; and
165-for \fIiface\fR, all ifaces setup in /etc/iscsi/ifaces are displayed.
166+for \fIiface\fR, all ifaces setup in /var/lib/iscsi/ifaces are displayed.
167
168 .TP
169 \fB\-n\fR, \fB\-\-name=\fIname\fR
170@@ -535,10 +535,10 @@ The configuration file read by \fBiscsid\fR and \fBiscsiadm\fR on startup.
171 The file containing the iSCSI InitiatorName and InitiatorAlias read by
172 \fBiscsid\fR and \fBiscsiadm\fR on startup.
173 .TP
174-/etc/iscsi/nodes/
175+/var/lib/iscsi/nodes/
176 This directory contains the nodes with their targets.
177 .TP
178-/etc/iscsi/send_targets
179+/var/lib/iscsi/send_targets
180 This directory contains the portals.
181
182 .SH "SEE ALSO"
183diff --git a/usr/idbm.c b/usr/idbm.c
184index 4d30aa9..316e54f 100644
185--- a/usr/idbm.c
186+++ b/usr/idbm.c
187@@ -2468,9 +2468,9 @@ free_info:
188 int idbm_init(idbm_get_config_file_fn *fn)
189 {
190 /* make sure root db dir is there */
191- if (access(ISCSI_CONFIG_ROOT, F_OK) != 0) {
192- if (mkdir(ISCSI_CONFIG_ROOT, 0660) != 0) {
193- log_error("Could not make %s %d\n", ISCSI_CONFIG_ROOT,
194+ if (access(ISCSIVAR, F_OK) != 0) {
195+ if (mkdir(ISCSIVAR, 0660) != 0) {
196+ log_error("Could not make %s %d\n", ISCSIVAR,
197 errno);
198 return errno;
199 }
200diff --git a/usr/idbm.h b/usr/idbm.h
201index 245f046..f45e86e 100644
202--- a/usr/idbm.h
203+++ b/usr/idbm.h
204@@ -28,12 +28,16 @@
205 #include "config.h"
206 #include "list.h"
207
208-#define NODE_CONFIG_DIR ISCSI_CONFIG_ROOT"nodes"
209-#define SLP_CONFIG_DIR ISCSI_CONFIG_ROOT"slp"
210-#define ISNS_CONFIG_DIR ISCSI_CONFIG_ROOT"isns"
211-#define STATIC_CONFIG_DIR ISCSI_CONFIG_ROOT"static"
212-#define FW_CONFIG_DIR ISCSI_CONFIG_ROOT"fw"
213-#define ST_CONFIG_DIR ISCSI_CONFIG_ROOT"send_targets"
214+#define ISCSIVAR "/var/lib/iscsi/"
215+
216+#define NODE_CONFIG_DIR ISCSIVAR"nodes"
217+#define SLP_CONFIG_DIR ISCSIVAR"slp"
218+#define ISNS_CONFIG_DIR ISCSIVAR"isns"
219+#define STATIC_CONFIG_DIR ISCSIVAR"static"
220+#define FW_CONFIG_DIR ISCSIVAR"fw"
221+#define ST_CONFIG_DIR ISCSIVAR"send_targets"
222+
223+
224 #define ST_CONFIG_NAME "st_config"
225 #define ISNS_CONFIG_NAME "isns_config"
226
227diff --git a/usr/iface.h b/usr/iface.h
228index 01f7074..2c6ef72 100644
229--- a/usr/iface.h
230+++ b/usr/iface.h
231@@ -20,7 +20,8 @@
232 #ifndef ISCSI_IFACE_H
233 #define ISCSI_IFACE_H
234
235-#define IFACE_CONFIG_DIR ISCSI_CONFIG_ROOT"ifaces"
236+#include "idbm.h"
237+#define IFACE_CONFIG_DIR ISCSIVAR"ifaces"
238
239 struct iface_rec;
240 struct list_head;
diff --git a/meta-networking/recipes-daemons/iscsi-initiator-utils/files/iscsi-initiator.service b/meta-networking/recipes-daemons/iscsi-initiator-utils/files/iscsi-initiator.service
new file mode 100644
index 000000000..b1397513b
--- /dev/null
+++ b/meta-networking/recipes-daemons/iscsi-initiator-utils/files/iscsi-initiator.service
@@ -0,0 +1,12 @@
1[Unit]
2Description=Open-iSCSI initiator (i.e. client) service
3After=syslog.target
4
5[Service]
6EnvironmentFile=/etc/default/iscsi-initiator
7ExecStartPre=/sbin/modprobe iscsi_tcp
8ExecStart=/usr/sbin/iscsid -f $OPTS_ISCSID
9
10[Install]
11WantedBy=multi-user.target
12
diff --git a/meta-networking/recipes-daemons/iscsi-initiator-utils/iscsi-initiator-utils_2.0-873.bb b/meta-networking/recipes-daemons/iscsi-initiator-utils/iscsi-initiator-utils_2.0-873.bb
new file mode 100644
index 000000000..d48cf24eb
--- /dev/null
+++ b/meta-networking/recipes-daemons/iscsi-initiator-utils/iscsi-initiator-utils_2.0-873.bb
@@ -0,0 +1,111 @@
1SUMMARY = "iSCSI daemon and utility programs"
2DESCRIPTION = "Open-iSCSI project is a high performance, transport \
3independent, multi-platform implementation of RFC3720. The iscsi package \
4provides the server daemon for the iSCSI protocol, as well as the utility \
5programs used to manage it. iSCSI is a protocol for distributed \
6disk access using SCSI commands sent over Internet Protocol networks."
7HOMEPAGE = "http://www.open-iscsi.org/"
8LICENSE = "GPLv2 & LGPLv2.1"
9SECTION = "console/network"
10DEPENDS = "openssl flex-native bison-native"
11
12LIC_FILES_CHKSUM = \
13 "file://COPYING;md5=393a5ca445f6965873eca0259a17f833 \
14 file://utils/open-isns/COPYING;md5=7fbc338309ac38fefcd64b04bb903e34"
15
16SRC_URI = "http://www.open-iscsi.org/bits/open-iscsi-${PV}.tar.gz \
17 file://iscsi-initiator-utils-use-var-for-config.patch \
18 file://iscsi-initiator-utils-dont-use-static.patch \
19 file://initd.debian \
20 file://99_iscsi-initiator-utils \
21 file://iscsi-initiator \
22 file://iscsi-initiator.service \
23 file://iscsi-initiator-targets.service \
24"
25SRC_URI[md5sum] = "8b8316d7c9469149a6cc6234478347f7"
26SRC_URI[sha256sum] = "7dd9f2f97da417560349a8da44ea4fcfe98bfd5ef284240a2cc4ff8e88ac7cd9"
27
28S = "${WORKDIR}/open-iscsi-${PV}"
29
30inherit update-rc.d systemd
31
32TARGET_CC_ARCH += "${LDFLAGS}"
33do_configure () {
34 #need to support cross-compiling in open-isns only
35 (cd utils/open-isns; gnu-configize; \
36 ./configure --host=${TARGET_SYS} --build=${BUILD_SYS} --with-security=no )
37}
38
39do_compile () {
40 #make iscsistart one of PROGRAMS if install_user in do_install
41 #sed -i -e '/^PROGRAMS = /s;$; usr/iscsistart;' Makefile
42
43 #fix the ar used in open-isns
44 sed -i -e 's:ar cr :$(AR) cr :' ${S}/utils/open-isns/Makefile
45 oe_runmake user
46}
47
48do_install () {
49 #completely override the install_user as bugs in Makefile
50 #oe_runmake DESTDIR="${D}" install_user
51
52 #install necessary directories
53 install -d ${D}${sbindir} \
54 ${D}${sysconfdir}/init.d \
55 ${D}${sysconfdir}/iscsi \
56 ${D}${localstatedir}/lib/iscsi/nodes \
57 ${D}${localstatedir}/lib/iscsi/send_targets \
58 ${D}${localstatedir}/lib/iscsi/static \
59 ${D}${localstatedir}/lib/iscsi/isns \
60 ${D}${localstatedir}/lib/iscsi/slp \
61 ${D}${localstatedir}/lib/iscsi/ifaces \
62 ${D}/${mandir}/man8
63
64 install -p -m 755 ${S}/usr/iscsid ${S}/usr/iscsiadm \
65 ${S}/utils/iscsi-iname \
66 ${S}/usr/iscsistart ${D}/${sbindir}
67
68 install -p -m 644 ${S}/doc/iscsiadm.8 ${S}/doc/iscsid.8 ${D}/${mandir}/man8
69 install -p -m 644 ${S}/etc/iscsid.conf ${D}${sysconfdir}/iscsi
70 install -p -m 755 ${WORKDIR}/initd.debian ${D}${sysconfdir}/init.d/iscsid
71
72 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
73 install -d ${D}${sysconfdir}/tmpfiles.d
74 echo "d /run/${BPN}/lock - - - -" \
75 > ${D}${sysconfdir}/tmpfiles.d/iscsi.conf
76 install -d ${D}/etc/default/
77 install -p -m 755 ${WORKDIR}/iscsi-initiator ${D}${sysconfdir}/default/
78
79 install -d ${D}${systemd_unitdir}/system/
80 install -m 0644 ${WORKDIR}/iscsi-initiator.service \
81 ${WORKDIR}/iscsi-initiator-targets.service \
82 ${D}${systemd_unitdir}/system/
83 else
84 install -d ${D}/etc/default/volatiles
85 install -m 0644 ${WORKDIR}/99_iscsi-initiator-utils ${D}/etc/default/volatiles
86 fi
87}
88
89pkg_postinst_${PN}() {
90 #default there is no initiatorname.iscsi installed
91 #but it is needed or iscsid will fail
92
93 #will run only when postinst on target
94 if [ "x$D" != "x" ]; then
95 exit 1
96 fi
97 if [ ! -f ${sysconfdir}/iscsi/initiatorname.iscsi ]; then
98 echo "InitiatorName=$(${sbindir}/iscsi-iname)" > \
99 ${sysconfdir}/iscsi/initiatorname.iscsi
100 fi
101
102 if [ -e /etc/init.d/populate-volatile.sh ]; then
103 /etc/init.d/populate-volatile.sh update
104 elif command -v systemd-tmpfiles >/dev/null; then
105 systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/iscsi.conf
106 fi
107}
108
109SYSTEMD_SERVICE = " iscsi-initiator.service iscsi-initiator-targets.service "
110INITSCRIPT_NAME = "iscsid"
111INITSCRIPT_PARAMS = "start 30 1 2 3 4 5 . stop 70 0 1 2 3 4 5 6 ."