36 lines
1.4 KiB
Diff
36 lines
1.4 KiB
Diff
From 590bbc4941716658901709a42658962d665b06ad Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
Date: Tue, 26 Oct 2021 16:08:36 +0200
|
|
Subject: [PATCH 1/2] make: test that the config variables are not empty
|
|
|
|
If the user does something like "make SYSTEMD_SYSTEM_GENERATOR_DIR=", we
|
|
would put things in /. I actually did something like this in an rpm build,
|
|
where SYSTEMD_SYSTEM_GENERATOR_DIR is set using rpm macros, and not read
|
|
from pkgconfig. We can easily catch this.
|
|
---
|
|
Makefile | 4 ++++
|
|
1 file changed, 4 insertions(+)
|
|
|
|
diff --git a/Makefile b/Makefile
|
|
index ebbd135878..a15b95f483 100644
|
|
--- a/Makefile
|
|
+++ b/Makefile
|
|
@@ -21,6 +21,7 @@ program:
|
|
@$(CARGO) build --release $(CARGOFLAGS)
|
|
|
|
systemd-service:
|
|
+ @test -n "$(SYSTEMD_SYSTEM_GENERATOR_DIR)"
|
|
@sed -e 's,@SYSTEMD_SYSTEM_GENERATOR_DIR@,$(SYSTEMD_SYSTEM_GENERATOR_DIR),' \
|
|
< units/systemd-zram-setup@.service.in \
|
|
> units/systemd-zram-setup@.service
|
|
@@ -36,6 +37,9 @@ clean:
|
|
@rm -f units/systemd-zram-setup@.service
|
|
|
|
install: build
|
|
+ @test -n "$(SYSTEMD_SYSTEM_GENERATOR_DIR)"
|
|
+ @test -n "$(SYSTEMD_SYSTEM_UNIT_DIR)"
|
|
+ @test -n "$(PREFIX)"
|
|
$(INSTALL) -Dpm755 target/release/zram-generator -t $(DESTDIR)$(SYSTEMD_SYSTEM_GENERATOR_DIR)/
|
|
$(INSTALL) -Dpm644 units/systemd-zram-setup@.service -t $(DESTDIR)$(SYSTEMD_SYSTEM_UNIT_DIR)/
|
|
$(INSTALL) -Dpm644 zram-generator.conf.example -t $(DESTDIR)$(PREFIX)/share/doc/zram-generator/
|