From ff2413ff5be9ff6a9447566921ed6638481f801e Mon Sep 17 00:00:00 2001 From: RJ Trujillo Date: Sat, 16 Dec 2023 10:28:05 -0700 Subject: [PATCH] systemd: Drop unit files This removes bootupd's systemd service and socket and removes their usage --- Cargo.toml | 2 +- Makefile | 12 ++---------- contrib/packaging/bootupd.spec | 13 +------------ systemd/bootupd.service | 26 -------------------------- systemd/bootupd.socket | 6 ------ tests/e2e-update/e2e-update.sh | 1 - 6 files changed, 4 insertions(+), 56 deletions(-) delete mode 100644 systemd/bootupd.service delete mode 100644 systemd/bootupd.socket diff --git a/Cargo.toml b/Cargo.toml index c6c456ef..bbfa5f3e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ authors = ["Colin Walters "] edition = "2021" rust-version = "1.70.0" -include = ["src", "LICENSE", "Makefile", "systemd"] +include = ["src", "LICENSE", "Makefile"] # See https://github.com/coreos/cargo-vendor-filterer [package.metadata.vendor-filter] diff --git a/Makefile b/Makefile index 2799f5e2..36770b73 100644 --- a/Makefile +++ b/Makefile @@ -18,10 +18,8 @@ ifeq ($(CONTAINER_RUNTIME), podman) IMAGE_PREFIX = localhost/ endif -units = $(addprefix systemd/, bootupd.service bootupd.socket) - .PHONY: all -all: $(units) +all: cargo build ${CARGO_ARGS} ln -f target/${PROFILE}/bootupd target/${PROFILE}/bootupctl @@ -33,17 +31,11 @@ create-build-container: build-in-container: create-build-container ${CONTAINER_RUNTIME} run -ti --rm -v .:/srv/bootupd:z ${IMAGE_PREFIX}${IMAGE_NAME} make -.PHONY: install-units -install-units: $(units) - for unit in $(units); do install -D -m 644 --target-directory=$(DESTDIR)$(PREFIX)/lib/systemd/system/ $$unit; done - .PHONY: install -install: install-units +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 -d "${DESTDIR}$(PREFIX)/lib/systemd/system/multi-user.target.wants" - ln -s ../bootupd.socket "${DESTDIR}$(PREFIX)/lib/systemd/system/multi-user.target.wants" install-grub-static: install -m 644 -D -t ${DESTDIR}$(PREFIX)/lib/bootupd/grub2-static src/grub2/*.cfg diff --git a/contrib/packaging/bootupd.spec b/contrib/packaging/bootupd.spec index 056658f3..dbb8794a 100644 --- a/contrib/packaging/bootupd.spec +++ b/contrib/packaging/bootupd.spec @@ -20,7 +20,6 @@ BuildRequires: cargo # For autosetup -Sgit BuildRequires: git BuildRequires: openssl-devel -BuildRequires: systemd-devel %description %{summary} @@ -30,7 +29,6 @@ BuildRequires: systemd-devel %doc README.md %{_bindir}/bootupctl %{_libexecdir}/bootupd -%{_unitdir}/* %{_prefix}/lib/bootupd/grub2-static/ %prep @@ -52,15 +50,6 @@ cargo build --release %make_install INSTALL="install -p -c" make install-grub-static DESTDIR=%{?buildroot} INSTALL="%{__install} -p" -%post -n %{crate} -%systemd_post bootupd.service bootupd.socket - -%preun -n %{crate} -%systemd_preun bootupd.service bootupd.socket - -%postun -n %{crate} -%systemd_postun bootupd.service bootupd.socket - %changelog * Tue Oct 18 2022 Colin Walters - 0.2.8-3 -- Dummy changelog \ No newline at end of file +- Dummy changelog diff --git a/systemd/bootupd.service b/systemd/bootupd.service deleted file mode 100644 index 52735bfe..00000000 --- a/systemd/bootupd.service +++ /dev/null @@ -1,26 +0,0 @@ -[Unit] -Description=bootloader update daemon -Documentation=https://github.com/coreos/bootupd -# Because the daemon currently agressively auto-exits -# and our test suite runs many requests, let's allow -# a lot of restarts before failing. -StartLimitIntervalSec=2s -StartLimitBurst=10 - -[Service] -Type=notify -Environment=BOOTUPD_VERBOSITY="-v" -ExecStart=/usr/libexec/bootupd daemon $BOOTUPD_VERBOSITY -# This way our working directory isn't writable by default. -WorkingDirectory=/usr -# Various hardening flags just on general principle. We need -# to run as root, but let's avoid accidental damage. -ProtectHome=yes -ReadOnlyPaths=/usr -PrivateTmp=yes -PrivateNetwork=yes -ProtectHostname=yes -ProtectControlGroups=yes -RestrictSUIDSGID=yes -# So we can remount /boot writable -MountFlags=slave diff --git a/systemd/bootupd.socket b/systemd/bootupd.socket deleted file mode 100644 index c3f2269b..00000000 --- a/systemd/bootupd.socket +++ /dev/null @@ -1,6 +0,0 @@ -[Socket] -ListenSequentialPacket=/run/bootupd.sock -SocketMode=0600 - -[Install] -WantedBy=sockets.target diff --git a/tests/e2e-update/e2e-update.sh b/tests/e2e-update/e2e-update.sh index 2a3a1345..5f5aee53 100755 --- a/tests/e2e-update/e2e-update.sh +++ b/tests/e2e-update/e2e-update.sh @@ -16,7 +16,6 @@ if test -z "${COSA_DIR:-}"; then fi # Validate source directory bootupd_git=$(cd ${dn} && git rev-parse --show-toplevel) -test -f ${bootupd_git}/systemd/bootupd.service testtmp=$(mktemp -d -p /var/tmp bootupd-e2e.XXXXXXX) export test_tmpdir=${testtmp}