Make BINDIR/SBINDIR/USRSBINDIR definition and usage consistent.
RFC PATCH 1/1 Make BINDIR/SBINDIR/USRSBINDIR definition and usage consistent.
As reported by Nicolas Iooss, there are still some inconsistencies in Makefile variables related to bin and sbin directories. Fix them.
Before:
$ find . -name Makefile -exec cat {} + |grep '^[A-Z_]*BINDIR' |sort -u
BINDIR=$(PREFIX)/bin
BINDIR ?= $(PREFIX)/bin
BINDIR ?= $(PREFIX)/sbin
SBINDIR ?= $(DESTDIR)/sbin
SBINDIR ?= $(PREFIX)/sbin
USRSBINDIR ?= $(PREFIX)/sbinAfter:
$ find . -name Makefile -exec cat {} + | grep '^[A-Z_]*BINDIR' | sort -u
BINDIR ?= $(PREFIX)/bin
SBINDIR ?= $(PREFIX)/sbinFor systems without usrmerge, this changes the default install location for fixfiles, setfiles, restorecon, restorecon_xattr, and mcstransd from /sbin to /usr/sbin, and drops the symbolic link from /usr/sbin/load_policy to /sbin/load_policy. It also updates fixfiles with the new paths for setfiles and restorecon, and drops the absolute path for make relabel targets, just relying on PATH to be set appropriately.
Reported-by Nicolas Iooss <[email protected]>
Signed-off-by Stephen Smalley <[email protected]>
--- checkpolicy/Makefile | 4 ++-- checkpolicy/test/Makefile | 2 +- libselinux/src/Makefile | 2 +- libselinux/utils/Makefile | 6 +++--- libsemanage/src/Makefile | 2 +- libsepol/src/Makefile | 2 +- mcstrans/src/Makefile | 2 +- mcstrans/utils/Makefile | 6 +++--- policycoreutils/load_policy/Makefile | 7 ++----- policycoreutils/newrole/Makefile | 2 +- policycoreutils/run_init/Makefile | 2 +- policycoreutils/scripts/Makefile | 3 +-- policycoreutils/scripts/fixfiles | 4 ++-- policycoreutils/secon/Makefile | 2 +- policycoreutils/setfiles/Makefile | 2 +- python/chcat/Makefile | 3 +-- python/sepolicy/sepolicy/templates/script.py | 2 +- restorecond/Makefile | 2 +- 18 files changed, 25 insertions(+), 30 deletions(-)
checkpolicy/Makefile +2 -2
@@ -53,8 +53,8 @@ install: all install -m 644 checkmodule.8 $(MANDIR)/man8 relabel: install - /sbin/restorecon $(BINDIR)/checkpolicy - /sbin/restorecon $(BINDIR)/checkmodule + restorecon $(BINDIR)/checkpolicy + restorecon $(BINDIR)/checkmodule clean: -rm -f $(TARGETS) $(CHECKPOLOBJS) $(CHECKMODOBJS) y.tab.c y.tab.h lex.yy.c
checkpolicy/test/Makefile +1 -1
@@ -2,7 +2,7 @@ # Makefile for building the dispol program # PREFIX ?= $(DESTDIR)/usr -BINDIR=$(PREFIX)/bin +BINDIR ?= $(PREFIX)/bin LIBDIR ?= $(PREFIX)/lib INCLUDEDIR ?= $(PREFIX)/include LIBSEPOLA ?= $(LIBDIR)/libsepol.a
libselinux/src/Makefile +1 -1
@@ -196,7 +196,7 @@ install-rubywrap: rubywrap install -m 755 $(SWIGRUBYSO) $(RUBYINSTALL)/selinux.so relabel: - /sbin/restorecon $(SHLIBDIR)/$(LIBSO) + restorecon $(SHLIBDIR)/$(LIBSO) clean-pywrap: -rm -f $(SWIGLOBJ) $(SWIGSO) $(AUDIT2WHYLOBJ) $(AUDIT2WHYSO)
libselinux/utils/Makefile +3 -3
@@ -1,7 +1,7 @@ # Installation directories. PREFIX ?= $(DESTDIR)/usr LIBDIR ?= $(PREFIX)/lib -USRSBINDIR ?= $(PREFIX)/sbin +SBINDIR ?= $(PREFIX)/sbin INCLUDEDIR ?= $(PREFIX)/include OS ?= $(shell uname)
@@ -63,8 +63,8 @@ sefcontext_compile: sefcontext_compile.o ../src/regex.o all: $(TARGETS) install: all - -mkdir -p $(USRSBINDIR) - install -m 755 $(TARGETS) $(USRSBINDIR) + -mkdir -p $(SBINDIR) + install -m 755 $(TARGETS) $(SBINDIR) clean: rm -f $(TARGETS) *.o *~
libsemanage/src/Makefile +1 -1
@@ -155,7 +155,7 @@ install-rubywrap: rubywrap install -m 755 $(SWIGRUBYSO) $(RUBYINSTALL)/semanage.so relabel: - /sbin/restorecon $(LIBDIR)/$(LIBSO) + restorecon $(LIBDIR)/$(LIBSO) clean: -rm -f $(LIBPC) $(OBJS) $(LOBJS) $(LIBA) $(LIBSO) $(SWIGLOBJ) $(SWIGSO) $(SWIGRUBYSO) $(TARGET) conf-parse.c conf-parse.h conf-scan.c *.o *.lo *~
libsepol/src/Makefile +1 -1
@@ -89,7 +89,7 @@ install: all $(LN) -sf --relative $(SHLIBDIR)/$(LIBSO) $(LIBDIR)/$(TARGET) relabel: - /sbin/restorecon $(SHLIBDIR)/$(LIBSO) + restorecon $(SHLIBDIR)/$(LIBSO) clean: -rm -f $(LIBPC) $(LIBMAP) $(OBJS) $(LOBJS) $(LIBA) $(LIBSO) $(TARGET) $(CIL_GENERATED)
mcstrans/src/Makefile +1 -1
@@ -1,7 +1,7 @@ # Installation directories. PREFIX ?= $(DESTDIR)/usr LIBDIR ?= $(PREFIX)/lib -SBINDIR ?= $(DESTDIR)/sbin +SBINDIR ?= $(PREFIX)/sbin INITDIR ?= $(DESTDIR)/etc/rc.d/init.d SYSTEMDDIR ?= $(DESTDIR)/usr/lib/systemd
mcstrans/utils/Makefile +3 -3
@@ -1,7 +1,7 @@ # Installation directories. PREFIX ?= $(DESTDIR)/usr LIBDIR ?= $(PREFIX)/lib -BINDIR ?= $(PREFIX)/sbin +SBINDIR ?= $(PREFIX)/sbin LIBSEPOLA ?= $(LIBDIR)/libsepol.a CFLAGS ?= -Wall
@@ -15,8 +15,8 @@ all: $(TARGETS) $(TARGETS): ../src/mcstrans.o ../src/mls_level.o $(LIBSEPOLA) install: all - -mkdir -p $(BINDIR) - install -m 755 $(TARGETS) $(BINDIR) + -mkdir -p $(SBINDIR) + install -m 755 $(TARGETS) $(SBINDIR) test: ./mlstrans-test-runner.py ../test/*.test
policycoreutils/load_policy/Makefile +2 -5
@@ -1,7 +1,6 @@ # Installation directories. PREFIX ?= $(DESTDIR)/usr -SBINDIR ?= $(DESTDIR)/sbin -USRSBINDIR ?= $(PREFIX)/sbin +SBINDIR ?= $(PREFIX)/sbin MANDIR ?= $(PREFIX)/share/man LOCALEDIR ?= /usr/share/locale
@@ -18,8 +17,6 @@ install: all install -m 755 $(TARGETS) $(SBINDIR) test -d $(MANDIR)/man8 || install -m 755 -d $(MANDIR)/man8 install -m 644 load_policy.8 $(MANDIR)/man8/ - -mkdir -p $(USRSBINDIR) - -ln -sf $(SBINDIR)/load_policy $(USRSBINDIR)/load_policy clean: -rm -f $(TARGETS) *.o
@@ -28,4 +25,4 @@ indent: ../../scripts/Lindent $(wildcard *.[ch]) relabel: - /sbin/restorecon $(SBINDIR)/load_policy + restorecon $(SBINDIR)/load_policy
policycoreutils/newrole/Makefile +1 -1
@@ -82,4 +82,4 @@ indent: ../../scripts/Lindent $(wildcard *.[ch]) relabel: install - /sbin/restorecon $(BINDIR)/newrole + restorecon $(BINDIR)/newrole
policycoreutils/run_init/Makefile +1 -1
@@ -49,4 +49,4 @@ indent: ../../scripts/Lindent $(wildcard *.[ch]) relabel: install - /sbin/restorecon $(SBINDIR)/run_init $(SBINDIR)/open_init_pty + restorecon $(SBINDIR)/run_init $(SBINDIR)/open_init_pty
policycoreutils/scripts/Makefile +1 -2
@@ -1,8 +1,7 @@ # Installation directories. PREFIX ?= $(DESTDIR)/usr BINDIR ?= $(PREFIX)/bin -USRSBINDIR ?= $(PREFIX)/sbin -SBINDIR ?= $(DESTDIR)/sbin +SBINDIR ?= $(PREFIX)/sbin MANDIR ?= $(PREFIX)/share/man LOCALEDIR ?= $(PREFIX)/share/locale
policycoreutils/scripts/fixfiles +2 -2
@@ -112,8 +112,8 @@ FORCEFLAG="" RPMFILES="" PREFC="" RESTORE_MODE="DEFAULT" -SETFILES=/sbin/setfiles -RESTORECON=/sbin/restorecon +SETFILES=/usr/sbin/setfiles +RESTORECON=/usr/sbin/restorecon FILESYSTEMSRW=`get_rw_labeled_mounts` FILESYSTEMSRO=`get_ro_labeled_mounts` SELINUXTYPE="targeted"
policycoreutils/secon/Makefile +1 -1
@@ -24,7 +24,7 @@ install: all install -m 644 secon.1 $(MANDIR)/man1 relabel: - /sbin/restorecon $(BINDIR)/secon + restorecon $(BINDIR)/secon clean: rm -f *.o core* secon *~ *.bak
policycoreutils/setfiles/Makefile +1 -1
@@ -1,6 +1,6 @@ # Installation directories. PREFIX ?= $(DESTDIR)/usr -SBINDIR ?= $(DESTDIR)/sbin +SBINDIR ?= $(PREFIX)/sbin MANDIR = $(PREFIX)/share/man LIBDIR ?= $(PREFIX)/lib AUDITH ?= $(shell test -f /usr/include/libaudit.h && echo y)
python/chcat/Makefile +1 -2
@@ -1,8 +1,7 @@ # Installation directories. PREFIX ?= $(DESTDIR)/usr BINDIR ?= $(PREFIX)/bin -USRSBINDIR ?= $(PREFIX)/sbin -SBINDIR ?= $(DESTDIR)/sbin +SBINDIR ?= $(PREFIX)/sbin MANDIR ?= $(PREFIX)/share/man LOCALEDIR ?= $(PREFIX)/share/locale
python/sepolicy/sepolicy/templates/script.py +1 -1
@@ -81,7 +81,7 @@ sepolicy manpage -p . -d DOMAINTYPE_t restorecon="""\ # Fixing the file context on FILENAME -/sbin/restorecon -F -R -v FILENAME +/usr/sbin/restorecon -F -R -v FILENAME """ tcp_ports="""\
restorecond/Makefile +1 -1
@@ -55,7 +55,7 @@ install: all -mkdir -p $(SYSTEMDDIR)/system install -m 644 restorecond.service $(SYSTEMDDIR)/system/ relabel: install - /sbin/restorecon $(SBINDIR)/restorecond + restorecon $(SBINDIR)/restorecond clean: -rm -f restorecond *.o *~
Signature · 1 line
2.9.4