41 lines
1.6 KiB
Diff
41 lines
1.6 KiB
Diff
From e03d06a4a631aec0cd0d9ae88ef75d374055e45e 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/5] 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_UTIL_DIR is set using rpm macros, and not read from pkgconfig,
|
|
and the variable was defined but empty. We should catch this to avoid stupid
|
|
operator mistakes.
|
|
---
|
|
Makefile | 5 +++++
|
|
1 file changed, 5 insertions(+)
|
|
|
|
diff --git a/Makefile b/Makefile
|
|
index ebbd135878..49baab926f 100644
|
|
--- a/Makefile
|
|
+++ b/Makefile
|
|
@@ -18,9 +18,11 @@ export SYSTEMD_UTIL_DIR
|
|
build: program systemd-service man
|
|
|
|
program:
|
|
+ @test -n "$(SYSTEMD_UTIL_DIR)"
|
|
@$(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 +38,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/
|