summaryrefslogtreecommitdiff
path: root/strata/openstack-services/open-iscsi.morph
blob: 90e09a42da4b1e80a22613e17beb5b60473b0995 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: open-iscsi
kind: chunk
configure-commands:
# Non preset prefix to /usr
- sed -i -e 's|prefix = \/usr|prefix = \$\(PREFIX\)|' Makefile
# Install binaries depending on PREFIX
- sed -i -e 's|exec_prefix = \/|exec_prefix = \$\(prefix\)|' Makefile
# Include iscsistart boot tool
- sed -i -e '/^PROGRAMS = /s/$/ usr\/iscsistart/' Makefile
build-commands:
- make
install-commands:
- make DESTDIR="$DESTDIR" install
post-install-commands:
# Configure iscsi daemon
# Point the startup to the installed binary
- |
  sed -i -e "s|iscsid.startup = \/sbin\/iscsid|iscsid.startup = "$PREFIX"/sbin/iscsid|" \
            etc/iscsid.conf
# Start up a session automatically
- sed -i -e 's|node.startup = manual|node.startup = automatic|' etc/iscsid.conf
# Install config file
- install -D -m 644 etc/iscsid.conf "$DESTDIR"/etc/iscsi
# Install custom systemd unit file
- |
  install -D -m 644 /proc/self/fd/0 << 'EOF' "$DESTDIR$PREFIX"/lib/systemd/system/iscsid.service
  [Unit]
  Description=Open iSCSI Daemon
  After=network.target

  [Service]
  Type=forking
  ExecStart=/usr/sbin/iscsid

  [Install]
  WantedBy=multi-user.target
  EOF
# Install iscsi socket unit
- |
  install -D -m 644 /proc/self/fd/0 << 'EOF' "$DESTDIR$PREFIX"/lib/systemd/system/iscsid.socket
  [Unit]
  Description=Open-iSCSI iscsid Socket

  [Socket]
  ListenStream=@ISCSIADM_ABSTRACT_NAMESPACE

  [Install]
  WantedBy=sockets.target
  EOF