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 39 40 41 42
|
From: Benjamin Drung <benjamin.drung@canonical.com>
Date: Tue, 5 Aug 2025 19:16:17 +0200
Subject: fix(Makefile): use install for installing files
The `cp` command will copy the file/directory permissions from the
source files. The local source files might have group write permission
set which should not be applied to the installation.
Tighten the file/directory permission by using the `install` command
with specifying the mode.
Forwarded: https://github.com/dracut-ng/dracut-ng/pull/1522
---
Makefile | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 972ac8d..73534c2 100644
--- a/Makefile
+++ b/Makefile
@@ -205,12 +205,19 @@ install: all
ln -fs dracut-functions.sh $(DESTDIR)$(pkglibdir)/dracut-functions
install -m 0755 dracut-logger.sh $(DESTDIR)$(pkglibdir)/dracut-logger.sh
install -m 0755 dracut-initramfs-restore.sh $(DESTDIR)$(pkglibdir)/dracut-initramfs-restore
- cp -arx modules.d $(DESTDIR)$(pkglibdir)
+ for module in modules.d/*; do \
+ if test -L "$$module"; then cp -d "$$module" "$(DESTDIR)$(pkglibdir)/modules.d"; continue; fi; \
+ install -m 0755 -d "$$module" "$(DESTDIR)$(pkglibdir)/$$module"; \
+ for file in "$$module"/*; do \
+ mode=0755; test -x "$$file" || mode=0644; \
+ install -m "$$mode" "$$file" "$(DESTDIR)$(pkglibdir)/$$file"; \
+ done; \
+ done
for conf in $(configs); do \
install -D -m 0644 "dracut.conf.d/$$conf" "$(DESTDIR)$(pkglibdir)/dracut.conf.d/$$conf"; \
done
for i in $(configprofile) ; do \
- cp -arx dracut.conf.d/$$i/* $(DESTDIR)$(pkglibdir)/dracut.conf.d/ ;\
+ install -m 0644 dracut.conf.d/$$i/* $(DESTDIR)$(pkglibdir)/dracut.conf.d/ ;\
done
ifeq ($(enable_test),yes)
cp -arx test $(DESTDIR)$(pkglibdir)
|