summaryrefslogtreecommitdiff
blob: 68a9ae741004fe0f19f5a80c44a29c40ba5ca8b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From 1475ea762deee61f4be8c33a0915039ff1fc9b5c Mon Sep 17 00:00:00 2001
From: David Seifert <soap@gentoo.org>
Date: Fri, 4 Jun 2021 12:09:30 +0200
Subject: [PATCH] respect `DESTDIR`

* Without `DESTDIR`, `make install` will try to delete files from the live filesystem.
* Also, do not change `libdir`, create a separate prefix for the pam plugin instead.
---
 Makefile.am | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 896c3ff..560145a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -11,9 +11,8 @@ ACLOCAL_AMFLAGS = -I m4
 AM_CFLAGS = $(CWFLAGS) $(CSFLAGS)
 AM_CPPFLAGS = $(LIBFIDO2_CFLAGS) $(LIBCRYPTO_CFLAGS)
 
-libdir = $(PAMDIR)
-
-lib_LTLIBRARIES = pam_u2f.la
+pampluginexecdir = $(PAMDIR)
+pampluginexec_LTLIBRARIES = pam_u2f.la
 
 pam_u2f_la_SOURCES = pam-u2f.c
 pam_u2f_la_SOURCES += util.c util.h
@@ -43,8 +42,8 @@ endif
 # Release
 
 install-exec-hook:
-	rm -f $(PAMDIR)/pam_u2f.la
-	chmod -f 644 $(PAMDIR)/pam_u2f.so || true
+	rm -f $(DESTDIR)$(pampluginexecdir)/pam_u2f.la
+	chmod -f 644 $(DESTDIR)$(pampluginexecdir)/pam_u2f.so || true
 
 indent:
 	clang-format -i *.c *.h pamu2fcfg/*.c pamu2fcfg/*.h