#yocto - mongodb files missing
Hello Everyone,
I have built mongodb on zeus. It seems the mongod.service and mongod.conf files are missing. Can anyone show me the procedure to build a .bbappend file to add those.
Thanks and Regards,
-=Srijan Nandi
Hi,
Here's an example of mongodb_%.bbappend file:
-----------------------------------------------------------------------------FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += "file://mongod.conf file://mongod.service"
inherit systemd
do_install_append() {
# config
install -d ${D}${sysconfdir}
install -m 0644 ${WORKDIR}/mongod.conf ${D}${sysconfdir}/
# systemd
install -d ${D}${systemd_unitdir}/system/
install -m 0644 ${WORKDIR}/mongod.service ${D}${systemd_unitdir}/system/
}SYSTEMD_SERVICE_${PN} = "mongod.service"
-----------------------------------------------------------------------------
And create a folder meta-x/recipes-dbs/mongodb/files with mongod.service and mongod.conf in it.
Best Regards,
Vincent
Quoted 7 lines · Le mar. 21 juil. 2020 à 12:11, <[email protected]> a écrit :
Hello Everyone,
I have built mongodb on zeus. It seems the mongod.service and mongod.conf files are missing. Can anyone show me the procedure to build a .bbappend file to add those.
Thanks and Regards,
-=Srijan Nandi
Thank you, Vincent.
I was finally able to make a .bbappend file and here is what I have made.
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += "file://mongod \
file://mongod.service \
file://mongod.conf \
"
inherit systemd useradd
USERADD_PACKAGES = "${PN}"GROUPADD_PACKAGES = "${PN}"
GROUPADD_PARAM_${PN} = "${PN}"
USERADD_PARAM_${PN} = " \
--system --no-create-home \
--shell /bin/false \
-g ${PN} \
${PN}"
SYSTEMD_SERVICE_${PN} = "mongod.service"SYSTEMD_AUTO_ENABLE = "enable"
do_install_append() {
install -d ${D}${sysconfdir}
install -d ${D}${localstatedir} ${D}${localstatedir}/log ${D}${localstatedir}/log/mongodb chown -R mongodb:mongodb ${D}${localstatedir}/log/mongodb
install -d ${D}${sysconfdir}/sysconfig
install -c -m 0644 ${WORKDIR}/mongod.conf ${D}${sysconfdir}
chown mongodb:mongodb ${D}${sysconfdir}/mongod.conf
install -c -m 0644 ${WORKDIR}/mongod ${D}${sysconfdir}/sysconfig
chown mongodb:mongodb ${D}${sysconfdir}/sysconfig/mongod
install -d ${D}${localstatedir} ${D}${localstatedir}/lib ${D}${localstatedir}/lib/mongodb chown -R mongodb:mongodb ${D}${localstatedir}/lib/mongodb
if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then install -d ${D}${systemd_system_unitdir}
install -c -m 0644 ${WORKDIR}/mongod.service ${D}${systemd_system_unitdir} fi
}
Thanks and Regards,
-=Srijan Nandi