Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run a command in bitbake recipe as if on live system

Is it possible to run a command in a recipe as if it were run on the live system? If so, how? I want to import my key(s) into gpg before the image is created so I don't have to log onto the system after formatting the SD card.

like image 609
E-rich Avatar asked Jan 28 '15 18:01

E-rich


1 Answers

I found a solution that involves specifying a post install script that runs when do_rootfs is called. All I added to my recipe which installs my public key on the system is below:

pkg_postinst_${PN}() {
#!/bin/sh

if [ -n "$D" ]; then
    OPT="--homedir $D/home/root/.gnupg"
else
    OPT=""
fi

gpg $OPT --import ${D}${datadir}/mykey.gpg
}
like image 95
E-rich Avatar answered Sep 21 '22 17:09

E-rich