WAGO / pfc-howtos

Here you will find all the example code for extensions and tools for the pfc family
Mozilla Public License 2.0
37 stars 19 forks source link

addint a postinst file #6

Closed Ekristoffe closed 4 years ago

Ekristoffe commented 4 years ago

Hello I would like to add a postinst file inside an ipk in order to have some automatism when installing an ipk. for example in order to run a command should I use: /path/script.sh or $DESTDIR/path/script.sh The first one make the compilation failed (since ptxdist can't find the file) The second one work with ptxdist but the $DESTDIR is still inside the ipk. Is this a problem ? Thanks.

Thomas-Brandt commented 4 years ago

Hi, this is quite simple: You can create a postinst script by creating a "executable" file named $PTXDIST_WORKSPACE/rules/mypackage.postinst.

A short example content of this file could be:

!/bin/sh

echo "running postinst script of mypackage" /sbin/create_a_cool_user.sh /sbin/call_some_fancy_binaries.sh exit 0

It is important, that your script always succeed (return 0).

It is called when your rootfs is assembled also this script is called by opkg when upgrading or installing this package via opkg/ipkg to your already running target.