简体   繁体   English

在bitbake配方中运行命令,就像在实时系统上一样

[英]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. 我想在创建图像之前将我的密钥导入gpg ,因此在格式化SD卡后我不必登录系统。

I found a solution that involves specifying a post install script that runs when do_rootfs is called. 我找到了一个解决方案,涉及指定在调用do_rootfs时运行的安装后脚本。 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
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM