2008-08-19 19:30:36 +00:00
|
|
|
# Installation directories.
|
2018-12-25 15:25:05 +00:00
|
|
|
LINGUAS ?= ru
|
2018-02-14 09:57:09 +00:00
|
|
|
PREFIX ?= /usr
|
2008-08-19 19:30:36 +00:00
|
|
|
BINDIR ?= $(PREFIX)/bin
|
|
|
|
MANDIR ?= $(PREFIX)/share/man
|
2018-02-14 09:57:09 +00:00
|
|
|
ETCDIR ?= /etc
|
|
|
|
LOCALEDIR = $(DESTDIR)$(PREFIX)/share/locale
|
2017-04-24 17:59:59 +00:00
|
|
|
PAMH ?= $(shell test -f /usr/include/security/pam_appl.h && echo y)
|
|
|
|
AUDITH ?= $(shell test -f /usr/include/libaudit.h && echo y)
|
2008-08-19 19:30:36 +00:00
|
|
|
# Enable capabilities to permit newrole to generate audit records.
|
|
|
|
# This will make newrole a setuid root program.
|
|
|
|
# The capabilities used are: CAP_AUDIT_WRITE.
|
|
|
|
AUDIT_LOG_PRIV ?= n
|
|
|
|
# Enable capabilities to permit newrole to utilitize the pam_namespace module.
|
|
|
|
# This will make newrole a setuid root program.
|
|
|
|
# The capabilities used are: CAP_SYS_ADMIN, CAP_CHOWN, CAP_FOWNER and
|
|
|
|
# CAP_DAC_OVERRIDE.
|
|
|
|
NAMESPACE_PRIV ?= n
|
|
|
|
# If LSPP_PRIV is y, then newrole will be made into setuid root program.
|
|
|
|
# Enabling this option will force AUDIT_LOG_PRIV and NAMESPACE_PRIV to be y.
|
|
|
|
LSPP_PRIV ?= n
|
|
|
|
VERSION = $(shell cat ../VERSION)
|
|
|
|
|
|
|
|
CFLAGS ?= -Werror -Wall -W
|
|
|
|
EXTRA_OBJS =
|
2017-04-24 17:59:56 +00:00
|
|
|
override CFLAGS += -DVERSION=\"$(VERSION)\" -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
|
2017-06-20 15:16:41 +00:00
|
|
|
override LDLIBS += -lselinux
|
2017-04-24 17:59:59 +00:00
|
|
|
ifeq ($(PAMH), y)
|
2008-08-19 19:30:36 +00:00
|
|
|
override CFLAGS += -DUSE_PAM
|
|
|
|
EXTRA_OBJS += hashtab.o
|
2017-06-20 15:16:41 +00:00
|
|
|
override LDLIBS += -lpam -lpam_misc
|
2008-08-19 19:30:36 +00:00
|
|
|
else
|
|
|
|
override CFLAGS += -D_XOPEN_SOURCE=500
|
2017-06-20 15:16:41 +00:00
|
|
|
override LDLIBS += -lcrypt
|
2008-08-19 19:30:36 +00:00
|
|
|
endif
|
2017-04-24 17:59:59 +00:00
|
|
|
ifeq ($(AUDITH), y)
|
2008-08-19 19:30:36 +00:00
|
|
|
override CFLAGS += -DUSE_AUDIT
|
2017-06-20 15:16:41 +00:00
|
|
|
override LDLIBS += -laudit
|
2008-08-19 19:30:36 +00:00
|
|
|
endif
|
2011-09-19 20:38:33 +00:00
|
|
|
ifeq ($(LSPP_PRIV),y)
|
2008-08-19 19:30:36 +00:00
|
|
|
override AUDIT_LOG_PRIV=y
|
|
|
|
override NAMESPACE_PRIV=y
|
|
|
|
endif
|
2011-09-19 20:38:33 +00:00
|
|
|
ifeq ($(AUDIT_LOG_PRIV),y)
|
2008-08-19 19:30:36 +00:00
|
|
|
override CFLAGS += -DAUDIT_LOG_PRIV
|
|
|
|
IS_SUID=y
|
|
|
|
endif
|
2011-09-19 20:38:33 +00:00
|
|
|
ifeq ($(NAMESPACE_PRIV),y)
|
2008-08-19 19:30:36 +00:00
|
|
|
override CFLAGS += -DNAMESPACE_PRIV
|
|
|
|
IS_SUID=y
|
|
|
|
endif
|
2011-09-19 20:38:33 +00:00
|
|
|
ifeq ($(IS_SUID),y)
|
2008-08-19 19:30:36 +00:00
|
|
|
MODE := 4555
|
2017-06-20 15:16:41 +00:00
|
|
|
override LDLIBS += -lcap-ng
|
2008-08-19 19:30:36 +00:00
|
|
|
else
|
|
|
|
MODE := 0555
|
|
|
|
endif
|
|
|
|
|
|
|
|
all: newrole
|
|
|
|
|
|
|
|
newrole: newrole.o $(EXTRA_OBJS)
|
|
|
|
$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
|
|
|
|
|
|
|
|
install: all
|
2018-02-14 09:57:09 +00:00
|
|
|
test -d $(DESTDIR)$(BINDIR) || install -m 755 -d $(DESTDIR)$(BINDIR)
|
|
|
|
test -d $(DESTDIR)$(ETCDIR)/pam.d || install -m 755 -d $(DESTDIR)$(ETCDIR)/pam.d
|
|
|
|
test -d $(DESTDIR)$(MANDIR)/man1 || install -m 755 -d $(DESTDIR)$(MANDIR)/man1
|
|
|
|
install -m $(MODE) newrole $(DESTDIR)$(BINDIR)
|
|
|
|
install -m 644 newrole.1 $(DESTDIR)$(MANDIR)/man1/
|
2018-12-25 15:25:05 +00:00
|
|
|
for lang in $(LINGUAS) ; do \
|
|
|
|
if [ -e $${lang} ] ; then \
|
|
|
|
test -d $(DESTDIR)$(MANDIR)/$${lang}/man1 || install -m 755 -d $(DESTDIR)$(MANDIR)/$${lang}/man1 ; \
|
|
|
|
install -m 644 $${lang}/*.1 $(DESTDIR)$(MANDIR)/$${lang}/man1/ ; \
|
|
|
|
fi ; \
|
|
|
|
done
|
2017-04-24 17:59:59 +00:00
|
|
|
ifeq ($(PAMH), y)
|
2018-02-14 09:57:09 +00:00
|
|
|
test -d $(DESTDIR)$(ETCDIR)/pam.d || install -m 755 -d $(DESTDIR)$(ETCDIR)/pam.d
|
2011-09-19 20:38:33 +00:00
|
|
|
ifeq ($(LSPP_PRIV),y)
|
2018-02-14 09:57:09 +00:00
|
|
|
install -m 644 newrole-lspp.pamd $(DESTDIR)$(ETCDIR)/pam.d/newrole
|
2008-08-19 19:30:36 +00:00
|
|
|
else
|
2018-02-14 09:57:09 +00:00
|
|
|
install -m 644 newrole.pamd $(DESTDIR)$(ETCDIR)/pam.d/newrole
|
2008-08-19 19:30:36 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f newrole *.o
|
|
|
|
|
|
|
|
indent:
|
|
|
|
../../scripts/Lindent $(wildcard *.[ch])
|
|
|
|
|
|
|
|
relabel: install
|
2018-02-14 09:57:09 +00:00
|
|
|
/sbin/restorecon $(DESTDIR)$(BINDIR)/newrole
|