[LEDE-DEV] [PATCH] package-ipkg: Do not fail build without base-files

John Crispin john at phrozen.org
Thu Dec 8 23:20:13 PST 2016


Hi Florian

On 06/12/2016 23:14, Florian Fainelli wrote:
> If the base-files package is not selected, we will fail executing the
> very first postinst script:
> 
> make[3]: Leaving directory `/local/users/fainelli/openwrt/trunk'
> cp -fpR
> /local/users/fainelli/openwrt/trunk/build_dir/target-arm_xscale_musl-1.1.15_eabi/root-orion
> /local/users/fainelli/openwrt/trunk/build_dir/target-arm_xscale_musl-1.1.15_eabi/root.orig-orion
> ./usr/lib/opkg/info/busybox.postinst: line 3:
> /local/users/fainelli/openwrt/trunk/build_dir/target-arm_xscale_musl-1.1.15_eabi/root-orion/lib/functions.sh:
> No such file or directory
> ./usr/lib/opkg/info/busybox.postinst: line 4: default_postinst: command
> not found
> postinst script ./usr/lib/opkg/info/busybox.postinst has failed with
> exit code 127
> make[2]: *** [package/install] Error 1
> 
> Just create postinst/prerm scripts that return 0 to statisfy opkg's
> requirement while installing packages in the rootfs.
> 

this looks pretty hackish. the postinst hook should be modified to check
if functions.sh is present and if it is not present should bog out.
fixing this with a hack in the build system seems wrong.

not running the default postinst hooks will break several of our
features such ad uid/gid generation.

	John


> Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
> ---
>  include/package-ipkg.mk | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk
> index afd2d4ef7a21..de02a9dab480 100644
> --- a/include/package-ipkg.mk
> +++ b/include/package-ipkg.mk
> @@ -197,6 +197,9 @@ $(_endef)
>  			printf "Description: "; echo "$$$$DESCRIPTION" | sed -e 's,^[[:space:]]*, ,g'; \
>  		) > control; \
>  		chmod 644 control; \
> +	)
> +    ifneq ($(CONFIG_PACKAGE_base-files),)
> +	(cd $$(IDIR_$(1))/CONTROL; \
>  		( \
>  			echo "#!/bin/sh"; \
>  			echo "[ \"\$$$${IPKG_NO_SCRIPT}\" = \"1\" ] && exit 0"; \
> @@ -211,6 +214,20 @@ $(_endef)
>  		chmod 0755 postinst prerm; \
>  		$($(1)_COMMANDS) \
>  	)
> +    else
> +	(cd $$(IDIR_$(1))/CONTROL; \
> +		( \
> +			echo "#!/bin/sh"; \
> +			echo "exit 0"; \
> +		) > postinst; \
> +		( \
> +			echo "#!/bin/sh"; \
> +			echo "exit 0"; \
> +		) > prerm; \
> +		chmod 0755 postinst prerm; \
> +		$($(1)_COMMANDS) \
> +	)
> +    endif
>  
>      ifneq ($$(KEEP_$(1)),)
>  		@( \
> 



More information about the Lede-dev mailing list