aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Crispin <john@openwrt.org>2015-04-10 20:39:44 +0000
committerJohn Crispin <john@openwrt.org>2015-04-10 20:39:44 +0000
commitbbad3f360e955403a0a38fb0919e52e7874476b9 (patch)
tree99f843e8fdc17d037d134283df8e62a61cb092ae
parentbaef360adb72a1dcab8ec4b6312ac8f513202303 (diff)
downloadupstream-bbad3f360e955403a0a38fb0919e52e7874476b9.tar.gz
upstream-bbad3f360e955403a0a38fb0919e52e7874476b9.tar.bz2
upstream-bbad3f360e955403a0a38fb0919e52e7874476b9.zip
modules: fix postinst generation for kernel modules
Fixes ticket #19352. Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com> Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 45367
-rw-r--r--include/kernel.mk12
-rwxr-xr-xpackage/base-files/files/lib/functions.sh11
2 files changed, 13 insertions, 10 deletions
diff --git a/include/kernel.mk b/include/kernel.mk
index 700736fe9a..300da0d50b 100644
--- a/include/kernel.mk
+++ b/include/kernel.mk
@@ -97,7 +97,7 @@ define ModuleAutoLoad
mkdir -p $(2)/etc/modules-boot.d; \
ln -s ../modules.d/$(1) $(2)/etc/modules-boot.d/; \
fi; \
- modules="$$$$$$$${modules:+$$$$$$$$modules}"; \
+ modules="$$$$$$$${modules:+$$$$$$$$modules }$$$$$$$$mods"; \
fi; \
}; \
add_module() { \
@@ -121,11 +121,11 @@ define ModuleAutoLoad
if [ -n "$$$$$$$$modules" ]; then \
mkdir -p $(2)/etc/modules.d; \
mkdir -p $(2)/CONTROL; \
- echo "#!/bin/sh" > $(2)/CONTROL/postinst; \
- echo "[ -z \"\$$$$$$$$IPKG_INSTROOT\" ] || exit 0" >> $(2)/CONTROL/postinst; \
- echo ". /lib/functions.sh" >> $(2)/CONTROL/postinst; \
- echo "insert_modules $$$$$$$$modules" >> $(2)/CONTROL/postinst; \
- chmod 0755 $(2)/CONTROL/postinst; \
+ echo "#!/bin/sh" > $(2)/CONTROL/postinst-pkg; \
+ echo "[ -z \"\$$$$$$$$IPKG_INSTROOT\" ] || exit 0" >> $(2)/CONTROL/postinst-pkg; \
+ echo ". /lib/functions.sh" >> $(2)/CONTROL/postinst-pkg; \
+ echo "insert_modules $$$$$$$$modules" >> $(2)/CONTROL/postinst-pkg; \
+ chmod 0755 $(2)/CONTROL/postinst-pkg; \
fi
endef
diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh
index dc3b80534b..72d954db3c 100755
--- a/package/base-files/files/lib/functions.sh
+++ b/package/base-files/files/lib/functions.sh
@@ -154,10 +154,13 @@ config_list_foreach() {
}
insert_modules() {
- [ -d /etc/modules.d ] && {
- cd /etc/modules.d
- sed 's/^[^#]/insmod &/' $* | ash 2>&- || :
- }
+ for m in $*; do
+ if [ -f /etc/modules.d/$m ]; then
+ sed 's/^[^#]/insmod &/' /etc/modules.d/$m | ash 2>&- || :
+ else
+ modprobe $m
+ fi
+ done
}
default_prerm() {