summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLee Duncan <lduncan@suse.com>2021-10-28 09:22:06 -0700
committerGitHub <noreply@github.com>2021-10-28 09:22:06 -0700
commit3bc752b175f47875f3f44ed60d962af0daf310a3 (patch)
treec39c0d5d67cd4522dc19aa039af4b82a0fe436d2
parentcabc3a84a26035fa4102138d305cfa7c201dd0d0 (diff)
parenta5f09ce5855d448d14148dfe46ce595bfb18cea8 (diff)
downloadopen-iscsi-3bc752b175f47875f3f44ed60d962af0daf310a3.tar.gz
Merge pull request #283 from gonzoleeman/fix-usr-merge
Finish ability to have binaries in an alternate location
-rw-r--r--Makefile22
-rw-r--r--README55
-rw-r--r--libopeniscsiusr/Makefile4
-rw-r--r--libopeniscsiusr/iface.c5
-rw-r--r--utils/50-iscsi-firmware-login.rules2
-rwxr-xr-xutils/iscsi-gen-initiatorname10
-rw-r--r--utils/iscsi_fw_login2
7 files changed, 42 insertions, 58 deletions
diff --git a/Makefile b/Makefile
index 08b9cf6..ee4746f 100644
--- a/Makefile
+++ b/Makefile
@@ -6,6 +6,8 @@
# that you want everything installed into.
DESTDIR ?=
+SED = /usr/bin/sed
+
prefix = /usr
exec_prefix = /
sbindir = $(exec_prefix)/sbin
@@ -60,7 +62,7 @@ endif
all: user
user: iscsiuio/Makefile
- $(MAKE) -C libopeniscsiusr
+ $(MAKE) -C libopeniscsiusr SBINDIR=$(sbindir) SBINDIR=$(sbindir)
$(MAKE) -C utils/sysdeps
$(MAKE) -C utils/fwparam_ibft
$(MAKE) -C usr
@@ -110,18 +112,26 @@ install_user: install_programs install_doc install_etc \
install_udev_rules:
$(INSTALL) -d $(DESTDIR)$(rulesdir)
$(INSTALL) -m 644 $(RULESFILES) $(DESTDIR)/$(rulesdir)
+ for f in $(RULESFILES); do \
+ p=$(DESTDIR)/$(rulesdir)/$${f##*/}; \
+ $(SED) -i -e 's:@SBINDIR@:$(sbindir):' $$p; \
+ done
install_systemd:
- $(INSTALL) -d $(DESTDIR)$(systemddir)
- $(INSTALL) -m 644 $(SYSTEMDFILES) $(DESTDIR)/$(systemddir)
+ $(INSTALL) -d $(DESTDIR)$(systemddir)/system
+ $(INSTALL) -m 644 $(SYSTEMDFILES) $(DESTDIR)/$(systemddir)/system
for f in $(SYSTEMDFILES); do \
p=$(DESTDIR)/$(systemddir)/system/$${f##*/}; \
- sed -i -e 's:@SBINDIR@:$(sbindir):' $$p; \
+ $(SED) -i -e 's:@SBINDIR@:$(sbindir):' $$p; \
done
-install_programs: $(PROGRAMS) $(SCRIPTS)
+install_programs: $(PROGRAMS) $(SCRIPTS)
$(INSTALL) -d $(DESTDIR)$(sbindir)
$(INSTALL) -m 755 $^ $(DESTDIR)$(sbindir)
+ for f in $(SCRIPTS); do \
+ p=$(DESTDIR)/$(sbindir)/$${f##*/}; \
+ $(SED) -i -e 's:@SBINDIR@:$(sbindir):' $$p; \
+ done
# ugh, auto-detection is evil
# Gentoo maintains their own init.d stuff
@@ -168,7 +178,7 @@ install_doc: $(MANPAGES)
install_iname:
if [ ! -f $(DESTDIR)/etc/iscsi/initiatorname.iscsi ]; then \
- echo "InitiatorName=`$(DESTDIR)/sbin/iscsi-iname`" > $(DESTDIR)/etc/iscsi/initiatorname.iscsi ; \
+ echo "InitiatorName=`$(DESTDIR)$(sbindir)/iscsi-iname`" > $(DESTDIR)/etc/iscsi/initiatorname.iscsi ; \
echo "***************************************************" ; \
echo "Setting InitiatorName to `cat $(DESTDIR)/etc/iscsi/initiatorname.iscsi`" ; \
echo "To override edit $(DESTDIR)/etc/iscsi/initiatorname.iscsi" ; \
diff --git a/README b/README
index 508c9d7..3e0459a 100644
--- a/README
+++ b/README
@@ -100,53 +100,20 @@ By default the kernel's iSCSI modules will be used. Running:
make
make install
-will install the iSCSI tools iscsiadm and iscsid to /sbin.
+will install the iSCSI tools iscsiadm and iscsid to /sbin, by default,
+though that location can be overridden by passing in "sbindir", e.g. to
+install in /usr/bin instead of /sbin:
-For 2.6.14 - 2.6.34 the modules in the kernel dir can be built and installed
-by running:
+ make sbindir="/usr/sbin"
- make kernel
-
-When building those modules the kernel source found at
- /lib/modules/`uname -r`/build
-
-will be used to compile the open-iscsi modules. To specify a different
-kernel to build against, use:
- make kernel KSRC=<kernel-src>
-
-or to use cross-compilation:
- make kernel KSRC=<kernel-src> KARCH="ARCH=um"
-
-To compile on SUSE Linux you'll have to use
-
- make kernel KSRC=/usr/src/linux \
- KBUILD_OUTPUT=/usr/src/linux-obj/<arch>/<config>
-
-where <config> is the kernel configuration to use (eg. 'smp').
-
-To install the kernel modules that were built, run:
-
- make install_kernel
-
-This will copy iscsi_tcp.ko, libiscsi_tcp.ko, libiscsi.ko and
-scsi_transport_iscsi.ko to
- /lib/modules/`uname -r`/kernel/drivers/scsi/
-overwriting existing iscsi modules.
-
-For Debian, be sure to install the linux-headers package that
-corresponds to your kernel in order to compile the kernel modules
-('aptitude install linux-headers-`uname -r`'). You may also wish to
-run 'make -C kernel/ dpkg_divert' before installing kernel modules if
-you run a Debian-provided kernel. This will use dpkg-divert(8) to
-move the packaged kernel modules out of the way, and ensure that
-future kernel upgrades will not overwrite them.
-
-Also, please be aware that the compatibility patches that enable these
-iscsi modules to run on kernels older than 2.6.25 will not update the
-ib_iser module; you may get warnings related to mismatched symbols on
-this driver, in which case you'll be unable to load ib_iser and
-open-iscsi simultaneously.
+To build and install iscsiuio, use something like:
+ cd iscsiuio
+ touch AUTHORS NEWS
+ autoreconf --install
+ ./configure [--sbindir="/usr/sbin"]
+ make
+ make install
4. Open-iSCSI daemon
====================
diff --git a/libopeniscsiusr/Makefile b/libopeniscsiusr/Makefile
index 06b09f5..ae4c364 100644
--- a/libopeniscsiusr/Makefile
+++ b/libopeniscsiusr/Makefile
@@ -11,6 +11,8 @@ endif
DESTDIR ?=
prefix ?= /usr
INSTALL ?= install
+exec_prefix = /
+sbindir = $(exec_prefix)/sbin
ifndef LIB_DIR
ifeq ($(shell test -d /lib64 && echo 1),1)
@@ -24,6 +26,7 @@ INCLUDE_DIR ?= $(prefix)/include
PKGCONF_DIR ?= $(LIB_DIR)/pkgconfig
PKG_CONFIG = /usr/bin/pkg-config
+SED = /usr/bin/sed
LIBISCSI_USR_DIR=$(TOPDIR)/libopeniscsiusr
@@ -47,6 +50,7 @@ OBJS = context.o misc.o session.o sysfs.o iface.o idbm.o node.o default.o
CFLAGS ?= -O2 -g
CFLAGS += -Wall -Werror -Wextra -fvisibility=hidden -fPIC
CFLAGS += $(shell $(PKG_CONFIG) --cflags libkmod)
+CFLAGS += -DSBINDIR=$(sbindir)
LDFLAGS += $(shell $(PKG_CONFIG) --libs libkmod)
diff --git a/libopeniscsiusr/iface.c b/libopeniscsiusr/iface.c
index 63f9c61..a8c004c 100644
--- a/libopeniscsiusr/iface.c
+++ b/libopeniscsiusr/iface.c
@@ -44,7 +44,10 @@
#include "idbm.h"
#include "default.h"
-#define ISCSIUIO_PATH "/sbin/iscsiuio"
+#ifndef SBINDIR
+#define SBINDIR "/sbin"
+#endif
+#define ISCSIUIO_PATH SBINDIR "/iscsiuio"
struct _iscsi_net_drv {
const char *net_driver_name; // Ethernet driver.
diff --git a/utils/50-iscsi-firmware-login.rules b/utils/50-iscsi-firmware-login.rules
index 47b3cf9..9fa1e7d 100644
--- a/utils/50-iscsi-firmware-login.rules
+++ b/utils/50-iscsi-firmware-login.rules
@@ -12,4 +12,4 @@
# having it as one single line avoids those problems.
#
# DO NOT WRAP THIS LINE
-SUBSYSTEM=="iscsi_boot*", ACTION=="add", DEVPATH=="*/target*", RUN+="/sbin/iscsi_fw_login"
+SUBSYSTEM=="iscsi_boot*", ACTION=="add", DEVPATH=="*/target*", RUN+="@SBINDIR@/iscsi_fw_login"
diff --git a/utils/iscsi-gen-initiatorname b/utils/iscsi-gen-initiatorname
index 88bd43b..3e30465 100755
--- a/utils/iscsi-gen-initiatorname
+++ b/utils/iscsi-gen-initiatorname
@@ -1,10 +1,10 @@
#!/bin/bash
#
-# /sbin/iscsi-gen-initiatorname
+# iscsi-gen-initiatorname
#
# Generate a default iSCSI Initiatorname for SUSE installations.
#
-# Copyright (c) 2011 Hannes Reinecke, SUSE Labs
+# Copyright (c) 2021 Hannes Reinecke, SUSE Labs
# This script is licensed under the GPL.
#
@@ -27,7 +27,7 @@ if [ -f /etc/iscsi/initiatorname.iscsi -a -z "$FORCE" ] ; then
eval $(cat /etc/iscsi/initiatorname.iscsi | sed -e '/^#/d')
if [ "$iSCSI_INITIATOR_NAME" != "$InitiatorName" ] ; then
echo "iSCSI Initiatorname from iBFT is different from the current setting."
- echo "Please call '/sbin/iscsi-gen-initiatorname -f' to update the iSCSI Initiatorname."
+ echo "Please call '@SBINDIR@/iscsi-gen-initiatorname -f' to update the iSCSI Initiatorname."
exit 1
fi
fi
@@ -45,7 +45,7 @@ if [ "$iSCSI_INITIATOR_NAME" ] ; then
## Any change here will not be reflected to the iBFT BIOS tables.
## If a different initiatorname is required please change the
## initiatorname in the BIOS setup and call
-## /sbin/iscsi-gen-initiatorname -f
+## @SBINDIR@/iscsi-gen-initiatorname -f
## to recreate an updated version of this file.
##
InitiatorName=$iSCSI_INITIATOR_NAME
@@ -66,7 +66,7 @@ if [ ! -f /etc/iscsi/initiatorname.iscsi ] ; then
## for each iSCSI initiator. Do NOT duplicate iSCSI InitiatorNames.
EOF
ISSUEDATE="1996-04"
- INAME=$(/sbin/iscsi-iname -p iqn.$ISSUEDATE.de.suse:01)
+ INAME=$(@SBINDIR@/iscsi-iname -p iqn.$ISSUEDATE.de.suse:01)
printf "InitiatorName=$INAME\n" >>/etc/iscsi/initiatorname.iscsi
chmod 0600 /etc/iscsi/initiatorname.iscsi
fi
diff --git a/utils/iscsi_fw_login b/utils/iscsi_fw_login
index 1312ed3..aae9e4c 100644
--- a/utils/iscsi_fw_login
+++ b/utils/iscsi_fw_login
@@ -7,6 +7,6 @@
#
ARGS="-m fw -l"
-ISCSIADM="/sbin/iscsiadm"
+ISCSIADM="@SBINDIR@/iscsiadm"
$ISCSIADM $ARGS