greengrass: add systemd support
Since our initscript contains logic to dynamically generate the path containing the greengrass daemon (it changes depending on the version), keep it in the rootfs. Create a symlink to it inside of /etc/init.d for sysvinit images and create a systemd service wrapper that calls it on systemd images. https://jira.digi.com/browse/DEL-6510 Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
This commit is contained in:
parent
6e282ec51b
commit
65072fb04c
|
|
@ -0,0 +1,10 @@
|
|||
[Unit]
|
||||
Description=Greengrass core daemon
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
ExecStart=/etc/greengrass start
|
||||
ExecStop=/etc/greengrass stop
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
@ -74,6 +74,7 @@ LIC_FILES_CHKSUM += "file://LICENSE/${GG_LIC_FILENAME_NOSPACES};md5=7df5bf535d02
|
|||
SRC_URI = " \
|
||||
http:///not/exist/greengrass-linux-armv7l-${PV}.tar.gz \
|
||||
file://greengrass-init \
|
||||
file://greengrass.service \
|
||||
file://0001-greengrassd-remove-bashisms-in-launcher-shell-script.patch \
|
||||
"
|
||||
SRC_URI[md5sum] = "893cf23f3e645d6cfe6975ea55b8b458"
|
||||
|
|
@ -93,7 +94,7 @@ python() {
|
|||
|
||||
S = "${WORKDIR}/${BPN}"
|
||||
|
||||
inherit aws-iot update-rc.d useradd
|
||||
inherit aws-iot update-rc.d useradd systemd
|
||||
|
||||
GG_USESYSTEMD = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'yes', 'no', d)}"
|
||||
|
||||
|
|
@ -115,8 +116,13 @@ do_install() {
|
|||
|
||||
# Install wrapper bootscript to launch Greengrass core on boot
|
||||
install -d ${D}${sysconfdir}/init.d
|
||||
install -m 0755 ${WORKDIR}/greengrass-init ${D}${sysconfdir}/init.d/greengrass
|
||||
sed -i -e "s,##GG_INSTALL_DIR##,/${BPN},g" ${D}${sysconfdir}/init.d/greengrass
|
||||
install -m 0755 ${WORKDIR}/greengrass-init ${D}${sysconfdir}/greengrass
|
||||
sed -i -e "s,##GG_INSTALL_DIR##,/${BPN},g" ${D}${sysconfdir}/greengrass
|
||||
ln -sf ${sysconfdir}/greengrass ${D}${sysconfdir}/init.d/greengrass
|
||||
|
||||
# Install systemd service
|
||||
install -d ${D}${systemd_unitdir}/system/
|
||||
install -m 0644 ${WORKDIR}/greengrass.service ${D}${systemd_unitdir}/system/greengrass.service
|
||||
|
||||
# If certificates do exist, install them and update the config file
|
||||
if [ -f "${AWS_IOT_CERTS_DIR}/${AWS_GGCORE_ROOT_CA}" ] && \
|
||||
|
|
@ -179,13 +185,15 @@ pkg_postinst_ontarget_${PN}() {
|
|||
fi
|
||||
}
|
||||
|
||||
FILES_${PN} = "/${BPN} ${sysconfdir}"
|
||||
FILES_${PN} = "/${BPN} ${sysconfdir} ${systemd_unitdir}"
|
||||
|
||||
CONFFILES_${PN} += "/${BPN}/configuration/config.json"
|
||||
|
||||
INITSCRIPT_NAME = "greengrass"
|
||||
INITSCRIPT_PARAMS = "defaults 80 20"
|
||||
|
||||
SYSTEMD_SERVICE_${PN} = "greengrass.service"
|
||||
|
||||
USERADD_PACKAGES = "${PN}"
|
||||
GROUPADD_PARAM_${PN} = "-r ggc_group"
|
||||
USERADD_PARAM_${PN} = "-r -M -N -g ggc_group -s /bin/false ggc_user"
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ LIC_FILES_CHKSUM += "file://ggc/core/LICENSE/${GG_LIC_FILENAME_NOSPACES};md5=7df
|
|||
SRC_URI = " \
|
||||
http:///not/exist/greengrass-linux-armv7l-${PV}.tar.gz \
|
||||
file://greengrass-init \
|
||||
file://greengrass.service \
|
||||
file://0001-greengrassd-remove-bashisms-in-launcher-shell-script.patch \
|
||||
"
|
||||
SRC_URI[md5sum] = "6a13664c6a36e495e773f43ab92b8bdf"
|
||||
|
|
@ -95,7 +96,7 @@ python() {
|
|||
|
||||
S = "${WORKDIR}/${BPN}"
|
||||
|
||||
inherit aws-iot update-rc.d useradd
|
||||
inherit aws-iot update-rc.d useradd systemd
|
||||
|
||||
GG_USESYSTEMD = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'yes', 'no', d)}"
|
||||
|
||||
|
|
@ -117,8 +118,13 @@ do_install() {
|
|||
|
||||
# Install wrapper bootscript to launch Greengrass core on boot
|
||||
install -d ${D}${sysconfdir}/init.d
|
||||
install -m 0755 ${WORKDIR}/greengrass-init ${D}${sysconfdir}/init.d/greengrass
|
||||
sed -i -e "s,##GG_INSTALL_DIR##,/${BPN},g" ${D}${sysconfdir}/init.d/greengrass
|
||||
install -m 0755 ${WORKDIR}/greengrass-init ${D}${sysconfdir}/greengrass
|
||||
sed -i -e "s,##GG_INSTALL_DIR##,/${BPN},g" ${D}${sysconfdir}/greengrass
|
||||
ln -sf ${sysconfdir}/greengrass ${D}${sysconfdir}/init.d/greengrass
|
||||
|
||||
# Install systemd service
|
||||
install -d ${D}${systemd_unitdir}/system/
|
||||
install -m 0644 ${WORKDIR}/greengrass.service ${D}${systemd_unitdir}/system/greengrass.service
|
||||
|
||||
# If certificates do exist, install them and update the config file
|
||||
if [ -f "${AWS_IOT_CERTS_DIR}/${AWS_GGCORE_ROOT_CA}" ] && \
|
||||
|
|
@ -181,13 +187,15 @@ pkg_postinst_ontarget_${PN}() {
|
|||
fi
|
||||
}
|
||||
|
||||
FILES_${PN} = "/${BPN} ${sysconfdir}"
|
||||
FILES_${PN} = "/${BPN} ${sysconfdir} ${systemd_unitdir}"
|
||||
|
||||
CONFFILES_${PN} += "/${BPN}/config/config.json"
|
||||
|
||||
INITSCRIPT_NAME = "greengrass"
|
||||
INITSCRIPT_PARAMS = "defaults 80 20"
|
||||
|
||||
SYSTEMD_SERVICE_${PN} = "greengrass.service"
|
||||
|
||||
USERADD_PACKAGES = "${PN}"
|
||||
GROUPADD_PARAM_${PN} = "-r ggc_group"
|
||||
USERADD_PARAM_${PN} = "-r -M -N -g ggc_group -s /bin/false ggc_user"
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ LIC_FILES_CHKSUM += "file://ggc/core/LICENSE/${GG_LIC_FILENAME_NOSPACES};md5=7df
|
|||
SRC_URI_arm = " \
|
||||
http:///not/exist/greengrass-linux-armv7l-${PV}.tar.gz;name=arm \
|
||||
file://greengrass-init \
|
||||
file://greengrass.service \
|
||||
"
|
||||
|
||||
SRC_URI[arm.md5sum] = "93ae820af2bf2527bafdb34598d174ed"
|
||||
|
|
@ -87,6 +88,7 @@ SRC_URI[arm.sha256sum] ="8fe99ba17917df2e192b7065e400e2dc85c4a0fbf7654fa0d141642
|
|||
SRC_URI_aarch64 = " \
|
||||
http:///not/exist/greengrass-linux-aarch64-${PV}.tar.gz;name=aarch64 \
|
||||
file://greengrass-init \
|
||||
file://greengrass.service \
|
||||
"
|
||||
|
||||
# For ARCH64 we use another tarball.
|
||||
|
|
@ -107,7 +109,7 @@ python() {
|
|||
|
||||
S = "${WORKDIR}/${BPN}"
|
||||
|
||||
inherit aws-iot update-rc.d useradd
|
||||
inherit aws-iot update-rc.d useradd systemd
|
||||
|
||||
GG_USESYSTEMD = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'yes', 'no', d)}"
|
||||
|
||||
|
|
@ -129,8 +131,13 @@ do_install() {
|
|||
|
||||
# Install wrapper bootscript to launch Greengrass core on boot
|
||||
install -d ${D}${sysconfdir}/init.d
|
||||
install -m 0755 ${WORKDIR}/greengrass-init ${D}${sysconfdir}/init.d/greengrass
|
||||
sed -i -e "s,##GG_INSTALL_DIR##,/${BPN},g" ${D}${sysconfdir}/init.d/greengrass
|
||||
install -m 0755 ${WORKDIR}/greengrass-init ${D}${sysconfdir}/greengrass
|
||||
sed -i -e "s,##GG_INSTALL_DIR##,/${BPN},g" ${D}${sysconfdir}/greengrass
|
||||
ln -sf ${sysconfdir}/greengrass ${D}${sysconfdir}/init.d/greengrass
|
||||
|
||||
# Install systemd service
|
||||
install -d ${D}${systemd_unitdir}/system/
|
||||
install -m 0644 ${WORKDIR}/greengrass.service ${D}${systemd_unitdir}/system/greengrass.service
|
||||
|
||||
# If certificates do exist, install them and update the config file
|
||||
if [ -f "${AWS_IOT_CERTS_DIR}/${AWS_GGCORE_ROOT_CA}" ] && \
|
||||
|
|
@ -193,13 +200,15 @@ pkg_postinst_ontarget_${PN}() {
|
|||
fi
|
||||
}
|
||||
|
||||
FILES_${PN} = "/${BPN} ${sysconfdir}"
|
||||
FILES_${PN} = "/${BPN} ${sysconfdir} ${systemd_unitdir}"
|
||||
|
||||
CONFFILES_${PN} += "/${BPN}/config/config.json"
|
||||
|
||||
INITSCRIPT_NAME = "greengrass"
|
||||
INITSCRIPT_PARAMS = "defaults 80 20"
|
||||
|
||||
SYSTEMD_SERVICE_${PN} = "greengrass.service"
|
||||
|
||||
USERADD_PACKAGES = "${PN}"
|
||||
GROUPADD_PARAM_${PN} = "-r ggc_group"
|
||||
USERADD_PARAM_${PN} = "-r -M -N -g ggc_group -s /bin/false ggc_user"
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ LIC_FILES_CHKSUM = " \
|
|||
SRC_URI_arm = " \
|
||||
http:///not/exist/greengrass-linux-armv7l-${PV}.tar.gz;name=arm \
|
||||
file://greengrass-init \
|
||||
file://greengrass.service \
|
||||
"
|
||||
|
||||
SRC_URI[arm.md5sum] = "a7f3667ac9f24e434e7a85908d1db256"
|
||||
|
|
@ -32,6 +33,7 @@ SRC_URI[arm.sha256sum] ="339656dca947f1cff29635fbe7570b5ea04ca7256fd2177cf396711
|
|||
SRC_URI_aarch64 = " \
|
||||
http:///not/exist/greengrass-linux-aarch64-${PV}.tar.gz;name=aarch64 \
|
||||
file://greengrass-init \
|
||||
file://greengrass.service \
|
||||
"
|
||||
|
||||
# For ARCH64 we use another tarball.
|
||||
|
|
@ -52,7 +54,7 @@ python() {
|
|||
|
||||
S = "${WORKDIR}/${BPN}"
|
||||
|
||||
inherit aws-iot update-rc.d useradd
|
||||
inherit aws-iot update-rc.d useradd systemd
|
||||
|
||||
GG_USESYSTEMD = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'yes', 'no', d)}"
|
||||
|
||||
|
|
@ -67,8 +69,13 @@ do_install() {
|
|||
|
||||
# Install wrapper bootscript to launch Greengrass core on boot
|
||||
install -d ${D}${sysconfdir}/init.d
|
||||
install -m 0755 ${WORKDIR}/greengrass-init ${D}${sysconfdir}/init.d/greengrass
|
||||
sed -i -e "s,##GG_INSTALL_DIR##,/${BPN},g" ${D}${sysconfdir}/init.d/greengrass
|
||||
install -m 0755 ${WORKDIR}/greengrass-init ${D}${sysconfdir}/greengrass
|
||||
sed -i -e "s,##GG_INSTALL_DIR##,/${BPN},g" ${D}${sysconfdir}/greengrass
|
||||
ln -sf ${sysconfdir}/greengrass ${D}${sysconfdir}/init.d/greengrass
|
||||
|
||||
# Install systemd service
|
||||
install -d ${D}${systemd_unitdir}/system/
|
||||
install -m 0644 ${WORKDIR}/greengrass.service ${D}${systemd_unitdir}/system/greengrass.service
|
||||
|
||||
# If certificates do exist, install them and update the config file
|
||||
if [ -f "${AWS_IOT_CERTS_DIR}/${AWS_GGCORE_ROOT_CA}" ] && \
|
||||
|
|
@ -131,13 +138,15 @@ pkg_postinst_ontarget_${PN}() {
|
|||
fi
|
||||
}
|
||||
|
||||
FILES_${PN} = "/${BPN} ${sysconfdir}"
|
||||
FILES_${PN} = "/${BPN} ${sysconfdir} ${systemd_unitdir}"
|
||||
|
||||
CONFFILES_${PN} += "/${BPN}/config/config.json"
|
||||
|
||||
INITSCRIPT_NAME = "greengrass"
|
||||
INITSCRIPT_PARAMS = "defaults 80 20"
|
||||
|
||||
SYSTEMD_SERVICE_${PN} = "greengrass.service"
|
||||
|
||||
USERADD_PACKAGES = "${PN}"
|
||||
GROUPADD_PARAM_${PN} = "-r ggc_group"
|
||||
USERADD_PARAM_${PN} = "-r -M -N -g ggc_group -s /bin/false ggc_user"
|
||||
|
|
|
|||
Loading…
Reference in New Issue