debian-koji/builder/Makefile
Michel Lind 18528e563c Allow overriding sbin directory
This fixes the Koji build for Fedora 42+, where on an installed system,
`/sbin` and `/usr/sbin` are symlinks to `/usr/bin`; see:
https://fedoraproject.org/wiki/Changes/Unify_bin_and_sbin

On a build root the symlink does not exist, so attempts in the spec to
manipulate binaries in `%{_sbindir}/` fail as these binaries are
installed to `%{buildroot}/usr/sbin` while the script is looking for
`%{buildroot}/usr/bin`

The default value is set to `/usr/sbin` so not passing `SBINDIR` when
installing results in the current behavior being preserved.

Signed-off-by: Michel Lind <salimma@fedoraproject.org>
2025-04-17 10:13:41 -04:00

38 lines
977 B
Makefile

PYVER_MAJOR := $(shell $(PYTHON) -c 'import sys; print(".".join(sys.version.split(".")[:1]))')
BINFILES = kojid
LIBEXECFILES = mergerepos
SBINDIR ?= /usr/sbin
SYSTEMDSYSTEMUNITDIR = $(shell pkg-config systemd --variable=systemdsystemunitdir)
_default:
@echo "nothing to make. try make install"
clean:
rm -f *.o *.so *.pyc *~ kojidc
rm -rf __pycache__
_install:
@if [ "$(DESTDIR)" = "" ]; then \
echo " "; \
echo "ERROR: A destdir is required"; \
exit 1; \
fi
mkdir -p $(DESTDIR)$(SBINDIR)
install -p -m 755 $(BINFILES) $(DESTDIR)$(SBINDIR)
@if [ "$(PYVER_MAJOR)" -lt 3 ] ; then \
mkdir -p $(DESTDIR)/usr/libexec/kojid; \
install -p -m 755 $(LIBEXECFILES) $(DESTDIR)/usr/libexec/kojid; \
fi
mkdir -p $(DESTDIR)/etc/mock/koji
mkdir -p $(DESTDIR)/etc/kojid
install -p -m 644 kojid.conf $(DESTDIR)/etc/kojid/kojid.conf
install: _install
mkdir -p $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
install -p -m 644 kojid.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)