Run a command in bitbake recipe as if on live system

六月ゝ 毕业季﹏ 提交于 2019-12-23 10:14:19

问题


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.


回答1:


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
}


来源:https://stackoverflow.com/questions/28200130/run-a-command-in-bitbake-recipe-as-if-on-live-system

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!