我有图像,我需要该图像的安装程序版本。 安装程序版本中的
/etc/xdg/weston/weston.ini
以及 root 和用户的其他密码与 cumsumers 版本中的一行不同。
生成两个具有微小差异的图像的更好方法是什么?
我已经在我的图层中创建了
layer/recipes-core/images
另一个文件
image-installer.bb
如同
image-consumer.bb
并且想通过输入
bitbake image-installer(consumer)
选择版本
并且在
image-installer.bb
中我添加了用于更改密码的行:
EXTRA_USERS_PARAMS = "usermod -P user password;"
但是我该如何改变
/etc/xdg/wayland/weston.ini
?
我添加到image-installer.bb
行
do_install_append() {
install -D -p ${WORKDIR}/weston_for_installer.ini ${D}${sysconfdir}/xdg/weston/weston.ini
#or
sed -i "/\[shell\]/apanel-position=none" ${D}${sysconfdir}/xdg/weston/weston.ini
}
但这行并没有改变任何东西
首先,关于这两个图像本身的处理,我将创建一个公共类,从中继承两个图像配方,类似这样:
SUMMARY = "..."
IMAGE_INSTALL = "..."
inherit core-image
<other common stuff>
inherit custom-image-base
inherit custom-image-base
<do special action here or install additional recipe which modify the final image>
从这里开始,也许有多种解决方案,但最简单的是在 rootfs 完成创建后对其进行修改。您可以使用 ROOTFS_POSTPROCESS_COMMAND 帮助程序在图像配方中执行此操作。您还可以从此配方管理用户创建/修改:
图像安装程序.bb
inherit custom-image-base extrausers
modify_wayland_ini_file() {
if [ -f "${IMAGE_ROOTFS}${sysconfdir}/xdg/weston/weston.ini" ]; then
sed -i "/\[shell\]/apanel-position=none" ${IMAGE_ROOTFS}${sysconfdir}/xdg/weston/weston.ini
fi
}
ROOTFS_POSTPROCESS_COMMAND += "modify_wayland_ini_file;"
# printf "%q" $(mkpasswd -m sha256crypt myawesomepwd)
PWD = "\$5\$NWH15.mb3GHy61Je\$2YAfr4Nj1uGFfEokXzSQpLGreZ06b3LbEwZOya762gB"
EXTRA_USERS_PARAMS = " useradd -u 1000 admin; \
usermod -p '${PWD}' admin; \
usermod -a -G sudo admin;"