summaryrefslogtreecommitdiff
path: root/libopeniscsiusr
diff options
context:
space:
mode:
authorLee Duncan <lduncan@suse.com>2022-03-25 07:54:18 -0700
committerLee Duncan <lduncan@suse.com>2022-03-25 07:54:18 -0700
commit9a2d2f2cf391c707a98204d488c3cb3e58cdab00 (patch)
treeb96c83ff4479e16f9032dcabf4435270f2ca6a9d /libopeniscsiusr
parent89df67cd154d43c9b8361880fbd0d94175ff65a1 (diff)
downloadopen-iscsi-9a2d2f2cf391c707a98204d488c3cb3e58cdab00.tar.gz
Make DB and ISCSIHOME directories configurable.
This commit adds two new top-level build options: one for the "home" directory for open-iscsi called "HOMEDIR", and one for the "database" directory, called "DBROOT". One can now override the defaults of "/etc/iscsi" for either or both of these directories on the make command line. The README and man pages are updated with details about these new options. Some Makefile cleanup/repair was done as well. Installation of the initiatorname.iscsi file, was moved out of the top-level Makefile into the etc subdirectory, and installation of man ages moved from the top-level Makefile to the doc subdirectory. Also, this fixes some issues from commit fd14dd8316b1 ("Clean p Makefile build system."), which incorrectly changed the DESTDIR ariable in the Makefiles. This current commit also fixes the top-level variable names for moving DBROOT and HOMEDIR.
Diffstat (limited to 'libopeniscsiusr')
-rw-r--r--libopeniscsiusr/Makefile7
-rw-r--r--libopeniscsiusr/idbm.h8
-rw-r--r--libopeniscsiusr/node.h2
3 files changed, 12 insertions, 5 deletions
diff --git a/libopeniscsiusr/Makefile b/libopeniscsiusr/Makefile
index a65155e..f6b5b5b 100644
--- a/libopeniscsiusr/Makefile
+++ b/libopeniscsiusr/Makefile
@@ -12,7 +12,9 @@ DESTDIR ?=
prefix ?= /usr
INSTALL ?= install
exec_prefix =
-sbindir = $(exec_prefix)/sbin
+etcdir = $(DESTDIR)/etc
+SBINDIR ?= $(exec_prefix)/sbin
+DBROOT ?= $(etcdir)/iscsi
ifndef LIB_DIR
ifeq ($(shell test -d /lib64 && echo 1),1)
@@ -50,7 +52,8 @@ 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)\"
+CFLAGS += -DSBINDIR=\"$(SBINDIR)\"
+CFLAGS += -DISCSI_DB_ROOT=\"$(DBROOT)\"
LDFLAGS += $(shell $(PKG_CONFIG) --libs libkmod)
diff --git a/libopeniscsiusr/idbm.h b/libopeniscsiusr/idbm.h
index cc90388..be5986f 100644
--- a/libopeniscsiusr/idbm.h
+++ b/libopeniscsiusr/idbm.h
@@ -30,8 +30,12 @@
#include "libopeniscsiusr/libopeniscsiusr_common.h"
-#define ISCSI_CONFIG_ROOT "/etc/iscsi/"
-#define IFACE_CONFIG_DIR ISCSI_CONFIG_ROOT"ifaces"
+#ifndef ISCSI_DB_ROOT
+#define ISCSI_DB_ROOT "/etc/iscsi"
+#endif
+
+#define IFACE_CONFIG_DIR ISCSI_DB_ROOT"/ifaces"
+
#define AUTH_STR_MAX_LEN 256
#define BOOT_NAME_MAXLEN 256
#define IDBM_DUMP_SIZE 8192
diff --git a/libopeniscsiusr/node.h b/libopeniscsiusr/node.h
index 39e07b3..575c5d6 100644
--- a/libopeniscsiusr/node.h
+++ b/libopeniscsiusr/node.h
@@ -44,7 +44,7 @@ struct iscsi_node {
char portal[NI_MAXHOST * 2];
};
-#define NODE_CONFIG_DIR ISCSI_CONFIG_ROOT"nodes"
+#define NODE_CONFIG_DIR ISCSI_DB_ROOT"/nodes"
/* Might be public in the future */
__DLL_LOCAL void iscsi_node_free(struct iscsi_node *node);