summaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-daemons/iscsi-initiator-utils
diff options
context:
space:
mode:
authorQi.Chen@windriver.com <Qi.Chen@windriver.com>2016-10-31 10:05:11 +0800
committerJoe MacDonald <joe_macdonald@mentor.com>2016-11-14 10:07:27 -0500
commit816c723aa5b4c106dcc37815a5691173f9f02af1 (patch)
treeaecf7f530059e8dfe879917d13c29ae6f802484b /meta-networking/recipes-daemons/iscsi-initiator-utils
parent06d15756bd6f77da57f527f08c9f2a3227acb3e9 (diff)
downloadmeta-openembedded-816c723aa5b4c106dcc37815a5691173f9f02af1.tar.gz
iscsi-initiator-utils: fix postinstall and systemd service file
Fix postinstall and systemd service file so that the postinstall script does not fail at rootfs time. Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
Diffstat (limited to 'meta-networking/recipes-daemons/iscsi-initiator-utils')
-rw-r--r--meta-networking/recipes-daemons/iscsi-initiator-utils/files/iscsi-initiator.service1
-rw-r--r--meta-networking/recipes-daemons/iscsi-initiator-utils/files/set_initiatorname12
-rw-r--r--meta-networking/recipes-daemons/iscsi-initiator-utils/iscsi-initiator-utils_2.0-873.bb27
3 files changed, 24 insertions, 16 deletions
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
index b1397513b..3790daebd 100644
--- a/meta-networking/recipes-daemons/iscsi-initiator-utils/files/iscsi-initiator.service
+++ b/meta-networking/recipes-daemons/iscsi-initiator-utils/files/iscsi-initiator.service
@@ -5,6 +5,7 @@ After=syslog.target
5[Service] 5[Service]
6EnvironmentFile=/etc/default/iscsi-initiator 6EnvironmentFile=/etc/default/iscsi-initiator
7ExecStartPre=/sbin/modprobe iscsi_tcp 7ExecStartPre=/sbin/modprobe iscsi_tcp
8ExecStartPre=/usr/lib/iscsi/set_initiatorname
8ExecStart=/usr/sbin/iscsid -f $OPTS_ISCSID 9ExecStart=/usr/sbin/iscsid -f $OPTS_ISCSID
9 10
10[Install] 11[Install]
diff --git a/meta-networking/recipes-daemons/iscsi-initiator-utils/files/set_initiatorname b/meta-networking/recipes-daemons/iscsi-initiator-utils/files/set_initiatorname
new file mode 100644
index 000000000..a196c6b79
--- /dev/null
+++ b/meta-networking/recipes-daemons/iscsi-initiator-utils/files/set_initiatorname
@@ -0,0 +1,12 @@
1#!/bin/sh
2if [ ! -f /etc/iscsi/initiatorname.iscsi ]; then
3 INITIATORNAME=$(iscsi-iname)
4 cat >/etc/iscsi/initiatorname.iscsi <<EOF
5## DO NOT EDIT OR REMOVE THIS FILE!
6## If you remove this file, the iSCSI daemon will not start.
7## If you change the InitiatorName, existing access control lists
8## may reject this initiator. The InitiatorName must be unique
9## for each iSCSI initiator. Do NOT duplicate iSCSI InitiatorNames.
10InitiatorName=$INITIATORNAME
11EOF
12fi
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
index 03f64594c..4b13155cd 100644
--- 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
@@ -21,6 +21,7 @@ SRC_URI = "http://www.open-iscsi.org/bits/open-iscsi-${PV}.tar.gz \
21 file://iscsi-initiator \ 21 file://iscsi-initiator \
22 file://iscsi-initiator.service \ 22 file://iscsi-initiator.service \
23 file://iscsi-initiator-targets.service \ 23 file://iscsi-initiator-targets.service \
24 file://set_initiatorname \
24" 25"
25SRC_URI[md5sum] = "8b8316d7c9469149a6cc6234478347f7" 26SRC_URI[md5sum] = "8b8316d7c9469149a6cc6234478347f7"
26SRC_URI[sha256sum] = "7dd9f2f97da417560349a8da44ea4fcfe98bfd5ef284240a2cc4ff8e88ac7cd9" 27SRC_URI[sha256sum] = "7dd9f2f97da417560349a8da44ea4fcfe98bfd5ef284240a2cc4ff8e88ac7cd9"
@@ -82,6 +83,8 @@ do_install () {
82 install -m 0644 ${WORKDIR}/iscsi-initiator.service \ 83 install -m 0644 ${WORKDIR}/iscsi-initiator.service \
83 ${WORKDIR}/iscsi-initiator-targets.service \ 84 ${WORKDIR}/iscsi-initiator-targets.service \
84 ${D}${systemd_unitdir}/system/ 85 ${D}${systemd_unitdir}/system/
86 install -d ${D}${nonarch_libdir}/iscsi
87 install -m 0755 ${WORKDIR}/set_initiatorname ${D}${nonarch_libdir}/iscsi
85 else 88 else
86 install -d ${D}/etc/default/volatiles 89 install -d ${D}/etc/default/volatiles
87 install -m 0644 ${WORKDIR}/99_iscsi-initiator-utils ${D}/etc/default/volatiles 90 install -m 0644 ${WORKDIR}/99_iscsi-initiator-utils ${D}/etc/default/volatiles
@@ -89,25 +92,17 @@ do_install () {
89} 92}
90 93
91pkg_postinst_${PN}() { 94pkg_postinst_${PN}() {
92 #default there is no initiatorname.iscsi installed 95 if [ "x$D" = "x" ]; then
93 #but it is needed or iscsid will fail 96 if [ -e /etc/init.d/populate-volatile.sh ]; then
94 97 /etc/init.d/populate-volatile.sh update
95 #will run only when postinst on target 98 elif command -v systemd-tmpfiles >/dev/null; then
96 if [ "x$D" != "x" ]; then 99 systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/iscsi.conf
97 exit 1 100 fi
98 fi
99 if [ ! -f ${sysconfdir}/iscsi/initiatorname.iscsi ]; then
100 echo "InitiatorName=$(${sbindir}/iscsi-iname)" > \
101 ${sysconfdir}/iscsi/initiatorname.iscsi
102 fi
103
104 if [ -e /etc/init.d/populate-volatile.sh ]; then
105 /etc/init.d/populate-volatile.sh update
106 elif command -v systemd-tmpfiles >/dev/null; then
107 systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/iscsi.conf
108 fi 101 fi
109} 102}
110 103
111SYSTEMD_SERVICE = " iscsi-initiator.service iscsi-initiator-targets.service " 104SYSTEMD_SERVICE = " iscsi-initiator.service iscsi-initiator-targets.service "
112INITSCRIPT_NAME = "iscsid" 105INITSCRIPT_NAME = "iscsid"
113INITSCRIPT_PARAMS = "start 30 1 2 3 4 5 . stop 70 0 1 2 3 4 5 6 ." 106INITSCRIPT_PARAMS = "start 30 1 2 3 4 5 . stop 70 0 1 2 3 4 5 6 ."
107
108FILES_${PN} += "${nonarch_libdir}/iscsi"