- $(SH_FUNC) \
- export modules=; \
- probe_module() { \
- local mods="$$$$$$$$1"; \
- local boot="$$$$$$$$2"; \
- local mod; \
- shift 2; \
- 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" -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; \
- modules="$$$$$$$${modules:+$$$$$$$$modules }$$$$$$$$mods"; \
- fi; \
- }; \
- add_module() { \
- local priority="$$$$$$$$1"; \
- local mods="$$$$$$$$2"; \
- local boot="$$$$$$$$3"; \
- local mod; \
- shift 3; \
- 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" -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; \
- modules="$$$$$$$${modules:+$$$$$$$$modules }$$$$$$$$priority-$(1)"; \
- fi; \
- }; \
- $(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; \
- 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
+ $(if $(5), \
+ mkdir -p $(2)/etc/modules.d; \
+ ($(foreach mod,$(5), \
+ echo "$(mod)$(if $(MODPARAMS.$(mod)), $(MODPARAMS.$(mod)),$(if $(MODPARAMS), $(MODPARAMS)))"; )) > $(2)/etc/modules.d/$(3)$(1); \
+ $(if $(4), \
+ mkdir -p $(2)/etc/modules-boot.d; \
+ ln -sf ../modules.d/$(3)$(1) $(2)/etc/modules-boot.d/;))