rust-zram-generator/0001-make-test-that-the-config-variables-are-not-empty.patch

41 lines
1.6 KiB
Diff
Raw Normal View History

2021-10-26 15:32:49 +00:00
From e03d06a4a631aec0cd0d9ae88ef75d374055e45e Mon Sep 17 00:00:00 2001
2021-10-26 14:38:13 +00:00
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Tue, 26 Oct 2021 16:08:36 +0200
2021-10-26 15:32:49 +00:00
Subject: [PATCH 1/5] make: test that the config variables are not empty
2021-10-26 14:38:13 +00:00
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,
2021-10-26 15:32:49 +00:00
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.
2021-10-26 14:38:13 +00:00
---
2021-10-26 15:32:49 +00:00
Makefile | 5 +++++
1 file changed, 5 insertions(+)
2021-10-26 14:38:13 +00:00
diff --git a/Makefile b/Makefile
2021-10-26 15:32:49 +00:00
index ebbd135878..49baab926f 100644
2021-10-26 14:38:13 +00:00
--- a/Makefile
+++ b/Makefile
2021-10-26 15:32:49 +00:00
@@ -18,9 +18,11 @@ export SYSTEMD_UTIL_DIR
build: program systemd-service man
program:
+ @test -n "$(SYSTEMD_UTIL_DIR)"
2021-10-26 14:38:13 +00:00
@$(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
2021-10-26 15:32:49 +00:00
@@ -36,6 +38,9 @@ clean:
2021-10-26 14:38:13 +00:00
@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/