selinux/restorecond/Makefile

66 lines
2.3 KiB
Makefile
Raw Normal View History

PKG_CONFIG ?= pkg-config
# Installation directories.
LINGUAS ?=
PREFIX ?= /usr
SBINDIR ?= $(PREFIX)/sbin
MANDIR = $(PREFIX)/share/man
AUTOSTARTDIR = /etc/xdg/autostart
DBUSSERVICEDIR = $(PREFIX)/share/dbus-1/services
SYSTEMDSYSTEMUNITDIR ?= $(shell $(PKG_CONFIG) --variable=systemdsystemunitdir systemd)
SYSTEMDUSERUNITDIR ?= $(shell $(PKG_CONFIG) --variable=systemduserunitdir systemd)
autostart_DATA = sealertauto.desktop
INITDIR ?= /etc/rc.d/init.d
SELINUXDIR = /etc/selinux
restorecond: migrate to GDbus API provided by glib-gio https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=955940 states: dbus-glib is a deprecated D-Bus library with some significant design flaws, and is essentially unmaintained. restorecond uses dbus-glib in order to spawn as a D-Bus service on the session bus of users. This makes restorecond stays so long as the user session exists. Migrate from dbus-glib to GDbus API for the implementation of this feature. Moreover restorecond currently uses a D-Bus signal to trigger starting the service. This is quite inappropriate, as stated for example in https://dbus.freedesktop.org/doc/dbus-tutorial.html#members Methods are operations that can be invoked on an object, with optional input (aka arguments or "in parameters") and output (aka return values or "out parameters"). Signals are broadcasts from the object to any interested observers of the object; signals may contain a data payload. Implementing a method is more appropriate. It appears that all D-Bus users can implement method Ping from interface org.freedesktop.DBus.Peer (https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-peer) and that calling this method is enough to trigger the launch of the service. This can be tested in a shell by running: gdbus call --session --dest=org.selinux.Restorecond \ --object-path=/ --method=org.freedesktop.DBus.Peer.Ping As this method is automatically provided, there is no need to implement its handling in the service. Fixed: https://github.com/SELinuxProject/selinux/issues/217 Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
2020-04-13 11:59:38 +00:00
GIO_CFLAGS = -DHAVE_DBUS $(shell $(PKG_CONFIG) --cflags gio-2.0)
GIO_LIBS = $(shell $(PKG_CONFIG) --libs gio-2.0)
CFLAGS ?= -g -Werror -Wall -W
restorecond: migrate to GDbus API provided by glib-gio https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=955940 states: dbus-glib is a deprecated D-Bus library with some significant design flaws, and is essentially unmaintained. restorecond uses dbus-glib in order to spawn as a D-Bus service on the session bus of users. This makes restorecond stays so long as the user session exists. Migrate from dbus-glib to GDbus API for the implementation of this feature. Moreover restorecond currently uses a D-Bus signal to trigger starting the service. This is quite inappropriate, as stated for example in https://dbus.freedesktop.org/doc/dbus-tutorial.html#members Methods are operations that can be invoked on an object, with optional input (aka arguments or "in parameters") and output (aka return values or "out parameters"). Signals are broadcasts from the object to any interested observers of the object; signals may contain a data payload. Implementing a method is more appropriate. It appears that all D-Bus users can implement method Ping from interface org.freedesktop.DBus.Peer (https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-peer) and that calling this method is enough to trigger the launch of the service. This can be tested in a shell by running: gdbus call --session --dest=org.selinux.Restorecond \ --object-path=/ --method=org.freedesktop.DBus.Peer.Ping As this method is automatically provided, there is no need to implement its handling in the service. Fixed: https://github.com/SELinuxProject/selinux/issues/217 Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
2020-04-13 11:59:38 +00:00
override CFLAGS += $(GIO_CFLAGS)
restorecond: migrate to GDbus API provided by glib-gio https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=955940 states: dbus-glib is a deprecated D-Bus library with some significant design flaws, and is essentially unmaintained. restorecond uses dbus-glib in order to spawn as a D-Bus service on the session bus of users. This makes restorecond stays so long as the user session exists. Migrate from dbus-glib to GDbus API for the implementation of this feature. Moreover restorecond currently uses a D-Bus signal to trigger starting the service. This is quite inappropriate, as stated for example in https://dbus.freedesktop.org/doc/dbus-tutorial.html#members Methods are operations that can be invoked on an object, with optional input (aka arguments or "in parameters") and output (aka return values or "out parameters"). Signals are broadcasts from the object to any interested observers of the object; signals may contain a data payload. Implementing a method is more appropriate. It appears that all D-Bus users can implement method Ping from interface org.freedesktop.DBus.Peer (https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-peer) and that calling this method is enough to trigger the launch of the service. This can be tested in a shell by running: gdbus call --session --dest=org.selinux.Restorecond \ --object-path=/ --method=org.freedesktop.DBus.Peer.Ping As this method is automatically provided, there is no need to implement its handling in the service. Fixed: https://github.com/SELinuxProject/selinux/issues/217 Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
2020-04-13 11:59:38 +00:00
override LDLIBS += -lselinux $(GIO_LIBS)
all: restorecond
restorecond.o utmpwatcher.o stringslist.o user.o watch.o: restorecond.h
restorecond: restore.o restorecond.o utmpwatcher.o stringslist.o user.o watch.o
$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
install: all
[ -d $(DESTDIR)$(MANDIR)/man8 ] || mkdir -p $(DESTDIR)$(MANDIR)/man8
-mkdir -p $(DESTDIR)$(SBINDIR)
install -m 755 restorecond $(DESTDIR)$(SBINDIR)
install -m 644 restorecond.8 $(DESTDIR)$(MANDIR)/man8
for lang in $(LINGUAS) ; do \
if [ -e $${lang} ] ; then \
[ -d $(DESTDIR)$(MANDIR)/$${lang}/man8 ] || mkdir -p $(DESTDIR)$(MANDIR)/$${lang}/man8 ; \
install -m 644 $${lang}/*.8 $(DESTDIR)$(MANDIR)/$${lang}/man8/ ; \
fi ; \
done
-mkdir -p $(DESTDIR)$(INITDIR)
install -m 755 restorecond.init $(DESTDIR)$(INITDIR)/restorecond
-mkdir -p $(DESTDIR)$(SELINUXDIR)
install -m 644 restorecond.conf $(DESTDIR)$(SELINUXDIR)/restorecond.conf
install -m 644 restorecond_user.conf $(DESTDIR)$(SELINUXDIR)/restorecond_user.conf
-mkdir -p $(DESTDIR)$(AUTOSTARTDIR)
install -m 644 restorecond.desktop $(DESTDIR)$(AUTOSTARTDIR)/restorecond.desktop
-mkdir -p $(DESTDIR)$(DBUSSERVICEDIR)
install -m 644 org.selinux.Restorecond.service $(DESTDIR)$(DBUSSERVICEDIR)/org.selinux.Restorecond.service
-mkdir -p $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
install -m 644 restorecond.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
-mkdir -p $(DESTDIR)$(SYSTEMDUSERUNITDIR)
install -m 644 restorecond_user.service $(DESTDIR)$(SYSTEMDUSERUNITDIR)
relabel: install
/sbin/restorecon $(DESTDIR)$(SBINDIR)/restorecond
clean:
-rm -f restorecond *.o *~
indent:
../../scripts/Lindent $(wildcard *.[ch])
test: