Package install section not executed again

Hi,

I have a custom package that has a configuration option CONFIG_ENABLE_FOO:

define Package/foobar/install
	$(CP) ./files/* $(1)/
	$(SED) "s/enable_foo=.*/enable_foo=$(CONFIG_ENABLE_FOO)/" $(1)/etc/uci-defaults/zzz_setup
endef

When I have build the package once, then the install section is executed. But now when I change the setting CONFIG_ENABLE_FOO and build again, then the install section is not executed again. This leaves the variable in zzz_setup unchanged.

How can I make the change to that zzz_setup script every time the package is build?

Not sure if that kind of sed action belongs to the install section at all.
To me it sounds more like prepare, configure or compile section stuff.

Additionally, have you declared a package build config dependency on that item in Makefile so that the build system noticed the need to rebuild after the change? Might be that the rebuild need goes unnoticed.

Example

1 Like

The same is happening for busybody. Could you give more information on the project so we might find a cleaner solution?

Thank you for the help. I got it working. But it looks more complicated then it needs to be.
Here is the solution so far, including the Config.in:

Config.in:

menu "Configuration"
	depends on PACKAGE_foobar

config ENABLE_FOO
	bool "Enable Foo."
	default n

endmenu

Makefile:

[...]

define Package/foobar/config
	source "$(SOURCE)/Config.in"
endef


ifeq ($(CONFIG_ENABLE_FOO),y)
	ENABLE_FOO=y
else
	ENABLE_FOO=n
endif

PKG_CONFIG_DEPENDS:= ENABLE_FOO

define Package/foobar/install
	$(CP) ./files/* $(1)/
	$(SED) "s/enable_foo=.*/enable_foo=$(ENABLE_FOO)/" $(1)/etc/uci-defaults/zzz_setup
endef

[...]

It is a weird that I cannot use $(CONFIG_ENABLE_FOO) in the sed line, but have to use an intermediate variable ENABLE_FOO.

ok, I have found a nicer solution:

[...]

define Package/foobar/config
	source "$(SOURCE)/Config.in"
endef

PKG_CONFIG_DEPENDS:= CONFIG_ENABLE_FOO

define Package/foobar/install
	$(CP) ./files/* $(1)/
	$(SED) "s/enable_foo=.*/enable_foo=$(if $(CONFIG_ENABLE_FOO),y,n)/" $(1)/etc/uci-defaults/zzz_setup
endef

[...]