1
0
mirror of https://github.com/containers/bootc.git synced 2026-02-06 00:45:22 +01:00
Files
bootc/Makefile
HuijingHei 261fb5e7f2 Drop systemd service
Fixes https://github.com/coreos/bootupd/issues/551

Get hints by https://github.com/coreos/bootupd/issues/551#issuecomment-2124477922,
and copy the comment here:
Basically we detect if we're running in systemd; if we're not,
we re-exec ourselves via systemd-run. Then we can just directly
run code in what is now the daemon.

I think an important aspect of this is that we retain something
like `--unit bootupd` which acts as a lock - only one unit with
that name can run at a time to avoid two concurrent invocations
breaking things.
2024-05-29 21:36:13 +08:00

48 lines
1.3 KiB
Makefile

DESTDIR ?=
PREFIX ?= /usr
LIBEXECDIR ?= ${PREFIX}/libexec
RELEASE ?= 1
CONTAINER_RUNTIME ?= podman
IMAGE_PREFIX ?=
IMAGE_NAME ?= bootupd-build
ifeq ($(RELEASE),1)
PROFILE ?= release
CARGO_ARGS = --release
else
PROFILE ?= debug
CARGO_ARGS =
endif
ifeq ($(CONTAINER_RUNTIME), podman)
IMAGE_PREFIX = localhost/
endif
.PHONY: all
all:
cargo build ${CARGO_ARGS}
ln -f target/${PROFILE}/bootupd target/${PROFILE}/bootupctl
.PHONY: create-build-container
create-build-container:
${CONTAINER_RUNTIME} build -t ${IMAGE_NAME} -f Dockerfile.build
.PHONY: build-in-container
build-in-container: create-build-container
${CONTAINER_RUNTIME} run -ti --rm -v .:/srv/bootupd:z ${IMAGE_PREFIX}${IMAGE_NAME} make
.PHONY: install
install:
mkdir -p "${DESTDIR}$(PREFIX)/bin" "${DESTDIR}$(LIBEXECDIR)"
install -D -t "${DESTDIR}$(LIBEXECDIR)" target/${PROFILE}/bootupd
ln -f ${DESTDIR}$(LIBEXECDIR)/bootupd ${DESTDIR}$(PREFIX)/bin/bootupctl
install-grub-static:
install -m 644 -D -t ${DESTDIR}$(PREFIX)/lib/bootupd/grub2-static src/grub2/*.cfg
install -m 755 -d ${DESTDIR}$(PREFIX)/lib/bootupd/grub2-static/configs.d
bin-archive:
rm target/inst -rf
$(MAKE) install install-grub-static DESTDIR=$$(pwd)/target/inst
tar -C target/inst -c --zstd -f target/bootupd.tar.zst .