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
v19.07.3_mercusys_ac12_duma
John Crispin 9 years ago
parent baef360adb
commit bbad3f360e

@ -97,7 +97,7 @@ define ModuleAutoLoad
mkdir -p $(2)/etc/modules-boot.d; \ mkdir -p $(2)/etc/modules-boot.d; \
ln -s ../modules.d/$(1) $(2)/etc/modules-boot.d/; \ ln -s ../modules.d/$(1) $(2)/etc/modules-boot.d/; \
fi; \ fi; \
modules="$$$$$$$${modules:+$$$$$$$$modules}"; \ modules="$$$$$$$${modules:+$$$$$$$$modules }$$$$$$$$mods"; \
fi; \ fi; \
}; \ }; \
add_module() { \ add_module() { \
@ -121,11 +121,11 @@ define ModuleAutoLoad
if [ -n "$$$$$$$$modules" ]; then \ if [ -n "$$$$$$$$modules" ]; then \
mkdir -p $(2)/etc/modules.d; \ mkdir -p $(2)/etc/modules.d; \
mkdir -p $(2)/CONTROL; \ mkdir -p $(2)/CONTROL; \
echo "#!/bin/sh" > $(2)/CONTROL/postinst; \ echo "#!/bin/sh" > $(2)/CONTROL/postinst-pkg; \
echo "[ -z \"\$$$$$$$$IPKG_INSTROOT\" ] || exit 0" >> $(2)/CONTROL/postinst; \ echo "[ -z \"\$$$$$$$$IPKG_INSTROOT\" ] || exit 0" >> $(2)/CONTROL/postinst-pkg; \
echo ". /lib/functions.sh" >> $(2)/CONTROL/postinst; \ echo ". /lib/functions.sh" >> $(2)/CONTROL/postinst-pkg; \
echo "insert_modules $$$$$$$$modules" >> $(2)/CONTROL/postinst; \ echo "insert_modules $$$$$$$$modules" >> $(2)/CONTROL/postinst-pkg; \
chmod 0755 $(2)/CONTROL/postinst; \ chmod 0755 $(2)/CONTROL/postinst-pkg; \
fi fi
endef endef

@ -154,10 +154,13 @@ config_list_foreach() {
} }
insert_modules() { insert_modules() {
[ -d /etc/modules.d ] && { for m in $*; do
cd /etc/modules.d if [ -f /etc/modules.d/$m ]; then
sed 's/^[^#]/insmod &/' $* | ash 2>&- || : sed 's/^[^#]/insmod &/' /etc/modules.d/$m | ash 2>&- || :
} else
modprobe $m
fi
done
} }
default_prerm() { default_prerm() {

Loading…
Cancel
Save