diff options
author | Qi.Chen@windriver.com <Qi.Chen@windriver.com> | 2016-10-31 10:05:11 +0800 |
---|---|---|
committer | Joe MacDonald <joe_macdonald@mentor.com> | 2016-11-14 10:07:27 -0500 |
commit | 816c723aa5b4c106dcc37815a5691173f9f02af1 (patch) | |
tree | aecf7f530059e8dfe879917d13c29ae6f802484b /meta-networking | |
parent | 06d15756bd6f77da57f527f08c9f2a3227acb3e9 (diff) | |
download | meta-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')
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] |
6 | EnvironmentFile=/etc/default/iscsi-initiator | 6 | EnvironmentFile=/etc/default/iscsi-initiator |
7 | ExecStartPre=/sbin/modprobe iscsi_tcp | 7 | ExecStartPre=/sbin/modprobe iscsi_tcp |
8 | ExecStartPre=/usr/lib/iscsi/set_initiatorname | ||
8 | ExecStart=/usr/sbin/iscsid -f $OPTS_ISCSID | 9 | ExecStart=/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 | ||
2 | if [ ! -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. | ||
10 | InitiatorName=$INITIATORNAME | ||
11 | EOF | ||
12 | fi | ||
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 | " |
25 | SRC_URI[md5sum] = "8b8316d7c9469149a6cc6234478347f7" | 26 | SRC_URI[md5sum] = "8b8316d7c9469149a6cc6234478347f7" |
26 | SRC_URI[sha256sum] = "7dd9f2f97da417560349a8da44ea4fcfe98bfd5ef284240a2cc4ff8e88ac7cd9" | 27 | SRC_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 | ||
91 | pkg_postinst_${PN}() { | 94 | pkg_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 | ||
111 | SYSTEMD_SERVICE = " iscsi-initiator.service iscsi-initiator-targets.service " | 104 | SYSTEMD_SERVICE = " iscsi-initiator.service iscsi-initiator-targets.service " |
112 | INITSCRIPT_NAME = "iscsid" | 105 | INITSCRIPT_NAME = "iscsid" |
113 | INITSCRIPT_PARAMS = "start 30 1 2 3 4 5 . stop 70 0 1 2 3 4 5 6 ." | 106 | INITSCRIPT_PARAMS = "start 30 1 2 3 4 5 . stop 70 0 1 2 3 4 5 6 ." |
107 | |||
108 | FILES_${PN} += "${nonarch_libdir}/iscsi" | ||