Modify

Opened 2 years ago

Last modified 2 years ago

#21394 new defect

preinst postinst Makefile defines does not work in some cases

Reported by: Damian Kaczkowski Owned by: developers
Priority: highest Milestone:
Component: packages Version: Chaos Calmer 15.05
Keywords: Cc:

Description

Hello.

I spot that preinst/postinst Makefile defines does not work when you select some packages in menuconfig and compile firmware with such packages build-in. After flashing such firmware preinst/postinst defines are not executed.

On the other hand when you opkg reinstall such packages then the preinst/postinst defines are executed properly.

Is this expected behavior? Imo it's bugged behavior cause packages "installed via buildroot" behaves differently than those installed via opkg.

Please look into this.

Tested on ar71xx. Newest cc head.

Attachments (0)

Change History (2)

comment:1 in reply to: ↑ description ; follow-up: Changed 2 years ago by hnyman

Replying to Damian Kaczkowski:

I spot that preinst/postinst Makefile defines does not work when you select some packages in menuconfig and compile firmware with such packages build-in.

Can you provide a concrete example. A package where you see a failing action.

After flashing such firmware preinst/postinst defines are not executed.

Do you mean that something should happen after the actual flashing? I might be wrong, but I thought that the preinst/postinst actions are done at the package installation step, which happens during the firmware image preparation, not after the flash. To my knowledge, nothing is executed after the flash. For that purpose there are the uci-defaults scripts. When you install packages via opkg in a live router, then naturally the postinst action is executed.

comment:2 in reply to: ↑ 1 Changed 2 years ago by Damian Kaczkowski

Replying to hnyman:

Replying to Damian Kaczkowski:

I spot that preinst/postinst Makefile defines does not work when you select some packages in menuconfig and compile firmware with such packages build-in.

Can you provide a concrete example. A package where you see a failing action.

For example setting crontab after install based on mac address of the device.

There is even the example on the wiki how to check if you are on live system and execute commands only on live system or only on buildroot.

After flashing such firmware preinst/postinst defines are not executed.

Do you mean that something should happen after the actual flashing? I might be wrong, but I thought that the preinst/postinst actions are done at the package installation step, which happens during the firmware image preparation, not after the flash. To my knowledge, nothing is executed after the flash. For that purpose there are the uci-defaults scripts. When you install packages via opkg in a live router, then naturally the postinst action is executed.

Yes I know that. I have workaround that by uci-default script already. The problem is that the behavior is inconsistent. If you prepare image with packages to save space you might get different results than using default image and installing packages manually. In worst case you might get non working package.

Maybe the simplest solution to this inconsistency could be to auto create uci-default scripts from preinst , postinit defines and install them on the resulting image when compiling (=y) packages on buildroot. This way those defines will always be executed regardless the installation method. It's not perfect but should work. If those defines are executed twice when installing packages via opkg (first time on package creation on buildroot, second time on opkg install), then such autogenerated uci-default scripts for packages packaged into image during manual compilation should just give the same results as when installing those packages via opkg.

Add Comment

Modify Ticket

Action
as new .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.