aboutsummaryrefslogtreecommitdiffstats
path: root/include/kernel.mk
diff options
context:
space:
mode:
authorYousong Zhou <yszhou4tech@gmail.com>2017-05-27 10:22:02 +0800
committerYousong Zhou <yszhou4tech@gmail.com>2017-05-27 11:21:55 +0800
commit546e20e8361e02e0094cc08eebc51c5c5a895682 (patch)
treedafe45c8768a74b2efa4066fb6da1fa4b1e2e892 /include/kernel.mk
parent7142cb45b4134b21b2e88cf7b22f4d306314cc36 (diff)
downloadupstream-546e20e8361e02e0094cc08eebc51c5c5a895682.tar.gz
upstream-546e20e8361e02e0094cc08eebc51c5c5a895682.tar.bz2
upstream-546e20e8361e02e0094cc08eebc51c5c5a895682.zip
build: fix possible issue with kmod package having multiple AutoLoad's
This commit contains the following changes - Use local shell var where appliable - The $(sort $$$$$$$$mods) call will have no expected effect - Avoid EEXIST when creating symlinks in /etc/modules-boot.d/ - Avoid duplicate arguments for insert_modules() in postinst-pkg Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Diffstat (limited to 'include/kernel.mk')
-rw-r--r--include/kernel.mk21
1 files changed, 12 insertions, 9 deletions
diff --git a/include/kernel.mk b/include/kernel.mk
index 7effca3832..301f24be3e 100644
--- a/include/kernel.mk
+++ b/include/kernel.mk
@@ -97,15 +97,16 @@ define ModuleAutoLoad
$(SH_FUNC) \
export modules=; \
probe_module() { \
- mods="$$$$$$$$1"; \
- boot="$$$$$$$$2"; \
+ local mods="$$$$$$$$1"; \
+ local boot="$$$$$$$$2"; \
+ local mod; \
shift 2; \
- for mod in $(sort $$$$$$$$mods); do \
+ for mod in $$$$$$$$mods; do \
mkdir -p $(2)/etc/modules.d; \
echo "$$$$$$$$mod" >> $(2)/etc/modules.d/$(1); \
done; \
if [ -e $(2)/etc/modules.d/$(1) ]; then \
- if [ "$$$$$$$$boot" = "1" ]; then \
+ if [ "$$$$$$$$boot" = "1" -a ! -e $(2)/etc/modules-boot.d/$(1) ]; then \
mkdir -p $(2)/etc/modules-boot.d; \
ln -s ../modules.d/$(1) $(2)/etc/modules-boot.d/; \
fi; \
@@ -113,16 +114,17 @@ define ModuleAutoLoad
fi; \
}; \
add_module() { \
- priority="$$$$$$$$1"; \
- mods="$$$$$$$$2"; \
- boot="$$$$$$$$3"; \
+ local priority="$$$$$$$$1"; \
+ local mods="$$$$$$$$2"; \
+ local boot="$$$$$$$$3"; \
+ local mod; \
shift 3; \
- for mod in $(sort $$$$$$$$mods); do \
+ for mod in $$$$$$$$mods; do \
mkdir -p $(2)/etc/modules.d; \
echo "$$$$$$$$mod" >> $(2)/etc/modules.d/$$$$$$$$priority-$(1); \
done; \
if [ -e $(2)/etc/modules.d/$$$$$$$$priority-$(1) ]; then \
- if [ "$$$$$$$$boot" = "1" ]; then \
+ if [ "$$$$$$$$boot" = "1" -a ! -e $(2)/etc/modules-boot.d/$$$$$$$$priority-$(1) ]; then \
mkdir -p $(2)/etc/modules-boot.d; \
ln -s ../modules.d/$$$$$$$$priority-$(1) $(2)/etc/modules-boot.d/; \
fi; \
@@ -131,6 +133,7 @@ define ModuleAutoLoad
}; \
$(3) \
if [ -n "$$$$$$$$modules" ]; then \
+ modules="$$$$$$$$(echo "$$$$$$$$modules" | tr ' ' '\n' | sort | uniq | paste -s -d' ')"; \
mkdir -p $(2)/etc/modules.d; \
mkdir -p $(2)/CONTROL; \
echo "#!/bin/sh" > $(2)/CONTROL/postinst-pkg; \