diff options
author | Lee Duncan <lduncan@suse.com> | 2022-03-25 07:54:18 -0700 |
---|---|---|
committer | Lee Duncan <lduncan@suse.com> | 2022-03-25 07:54:18 -0700 |
commit | 9a2d2f2cf391c707a98204d488c3cb3e58cdab00 (patch) | |
tree | b96c83ff4479e16f9032dcabf4435270f2ca6a9d /utils | |
parent | 89df67cd154d43c9b8361880fbd0d94175ff65a1 (diff) | |
download | open-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 'utils')
-rw-r--r-- | utils/Makefile | 27 | ||||
-rw-r--r-- | utils/fwparam_ibft/Makefile | 2 | ||||
-rw-r--r-- | utils/iscsi-gen-initiatorname.sh.template | 2 |
3 files changed, 18 insertions, 13 deletions
diff --git a/utils/Makefile b/utils/Makefile index 92af01e..250b77e 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -12,33 +12,35 @@ INSTALL = install CHMOD = chmod DESTDIR ?= -SBINDIR ?= $(DESTDIR)/sbin +SBINDIR ?= /sbin +etcdir = /etc +HOMEDIR ?= $(etcdir)/iscsi -ETCDIR = $(DESTDIR)/etc +ETCDIR = /etc RULESDIR = $(ETCDIR)/udev/rules.d CFLAGS ?= -O2 -fno-inline -g CFLAGS += -Wall -Wextra -Wstrict-prototypes PROGRAMS = iscsi-iname -PROGRAMS_DEST = $(addprefix $(SBINDIR)/,$(PROGRAMS)) +PROGRAMS_DEST = $(addprefix $(DESTDIR)$(SBINDIR)/,$(PROGRAMS)) SCRIPTS_SOURCES = iscsi_discovery.sh iscsi_offload.sh SCRIPTS_TEMPLATES = iscsi_fw_login.sh.template iscsi-gen-initiatorname.sh.template SCRIPTS_GENERATED = $(SCRIPTS_TEMPLATES:.template=) -SCRIPTS_DEST = $(addprefix $(SBINDIR)/,$(basename $(SCRIPTS_GENERATED))) \ - $(addprefix $(SBINDIR)/,$(basename $(SCRIPTS_SOURCES))) +SCRIPTS_DEST = $(addprefix $(DESTDIR)$(SBINDIR)/,$(basename $(SCRIPTS_GENERATED))) \ + $(addprefix $(DESTDIR)$(SBINDIR)/,$(basename $(SCRIPTS_SOURCES))) RULESFILES_TEMPLATES = 50-iscsi-firmware-login.rules.template RULESFILES_GENERATED = $(RULESFILES_TEMPLATES:.template=) -RULESFILES_DEST = $(addprefix $(RULESDIR)/,$(RULESFILES_GENERATED)) +RULESFILES_DEST = $(addprefix $(DESTDIR)$(RULESDIR)/,$(RULESFILES_GENERATED)) OBJS = iscsi-iname.o md5.o all: $(PROGRAMS) $(SCRIPTS_GENERATED) $(RULESFILES_GENERATED) $(SCRIPTS_GENERATED): %.sh: %.sh.template - $(SED) -e 's:@SBINDIR@:$(SBINDIR):' $? > $@ + $(SED) -e 's:@SBINDIR@:$(SBINDIR):' -e 's:@HOMEDIR@:$(HOMEDIR):' $? > $@ $(CHMOD) 755 $@ $(RULESFILES_GENERATED): %.rules: %.rules.template @@ -47,20 +49,21 @@ $(RULESFILES_GENERATED): %.rules: %.rules.template iscsi-iname: $(OBJS) $(CC) $(CFLAGS) $(LDFLAGS) $^ $(DBM_LIB) -o $@ -install: $(SBINDIR) $(RULESDIR) $(PROGRAMS_DEST) $(SCRIPTS_DEST) $(RULESFILES_DEST) +install: $(DESTDIR)$(SBINDIR) $(DESTDIR)$(RULESDIR) \ + $(PROGRAMS_DEST) $(SCRIPTS_DEST) $(RULESFILES_DEST) -$(PROGRAMS_DEST): $(SBINDIR)/%: % +$(PROGRAMS_DEST): $(DESTDIR)$(SBINDIR)/%: % $(INSTALL) -m 755 $? $@ -$(SCRIPTS_DEST): $(SBINDIR)/%: %.sh +$(SCRIPTS_DEST): $(DESTDIR)$(SBINDIR)/%: %.sh $(INSTALL) -m 755 $? $@ install_udev_rules: $(RULESFILES_DEST) -$(RULESFILES_DEST): $(RULESDIR)/%: % +$(RULESFILES_DEST): $(DESTDIR)$(RULESDIR)/%: % $(INSTALL) -m 644 $? $@ -$(SBINDIR) $(RULESDIR): +$(DESTDIR)$(SBINDIR) $(DESTDIR)$(RULESDIR): [ -d $@ ] || $(INSTALL) -d $@ clean: diff --git a/utils/fwparam_ibft/Makefile b/utils/fwparam_ibft/Makefile index 1a2b4cf..c27ba40 100644 --- a/utils/fwparam_ibft/Makefile +++ b/utils/fwparam_ibft/Makefile @@ -24,6 +24,7 @@ ifeq ($(TOPDIR),) TOPDIR = ../.. endif +SBINDIR ?= $(DESTDIR)/sbin SYSDEPS_OBJS = $(sort $(wildcard ../sysdeps/*.o)) OBJS := fw_entry.o fwparam_sysfs.o $(SYSDEPS_OBJS) \ @@ -35,6 +36,7 @@ CFLAGS ?= -O2 -g WARNFLAGS ?= -Wall -Wstrict-prototypes -Wno-format-truncation CFLAGS += -fPIC $(WARNFLAGS) -I$(TOPDIR)/include -I$(TOPDIR)/usr -D_GNU_SOURCE \ -I$(TOPDIR)/libopeniscsiusr +CFLAGS += -DSBINDIR=\"$(SBINDIR)\" LDFLAGS += -L$(TOPDIR)/libopeniscsiusr -liscsiusr diff --git a/utils/iscsi-gen-initiatorname.sh.template b/utils/iscsi-gen-initiatorname.sh.template index 70ad8bf..3fa8dcc 100644 --- a/utils/iscsi-gen-initiatorname.sh.template +++ b/utils/iscsi-gen-initiatorname.sh.template @@ -9,7 +9,7 @@ # NAME="$0" -INAME_FILE="/etc/iscsi/initiatorname.iscsi" +INAME_FILE="@HOMEDIR@/initiatorname.iscsi" IQN_PREFIX="iqn.1996-04.de.suse:01" IBFT_COMMENTS="\ |