AWS Greengrass: add daemon launcher wrapper bootscript

Signed-off-by: Javier Viguera <javier.viguera@digi.com>
This commit is contained in:
Javier Viguera 2017-06-06 19:35:03 +02:00
parent f59d27e5a8
commit 8e8e7f8982
2 changed files with 42 additions and 2 deletions

View File

@ -0,0 +1,31 @@
#!/bin/sh
#
# Copyright (c) 2017, Digi International Inc.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at http://mozilla.org/MPL/2.0/.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
# Description: Wrapper bootscript for AWS Greengrass core
#
GG_INSTALL_DIR="##GG_INSTALL_DIR##"
GG_LAUNCHER="${GG_INSTALL_DIR}/greengrassd"
case "${1}" in
start | stop | restart)
${GG_LAUNCHER} ${1}
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac

View File

@ -65,6 +65,7 @@ LIC_FILES_CHKSUM = " \
SRC_URI = " \
http:///not/exist/greengrass-linux-armv6l-${PV}-release.tar.gz \
file://greengrass-init \
file://0001-greengrassd-remove-bashisms-in-launcher-shell-script.patch \
file://0002-greengrassd-wait-some-time-to-check-GG-daemon-status.patch \
"
@ -85,7 +86,7 @@ python() {
S = "${WORKDIR}/${BPN}"
inherit useradd
inherit update-rc.d useradd
GG_USESYSTEMD = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'yes', 'no', d)}"
@ -98,6 +99,11 @@ do_install() {
tar --no-same-owner --exclude='./patches' --exclude='./.pc' -cpf - -C ${S} . \
| tar --no-same-owner -xpf - -C ${D}/${BPN}
# 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
# Configure whether to use systemd or not
sed -i -e "/useSystemd/{s,\[yes|no],${GG_USESYSTEMD},g}" ${D}/${BPN}/configuration/config.json
}
@ -136,7 +142,10 @@ pkg_postinst_${PN}() {
fi
}
FILES_${PN} = "/${BPN}"
FILES_${PN} = "/${BPN} ${sysconfdir}"
INITSCRIPT_NAME = "greengrass"
INITSCRIPT_PARAMS = "defaults 80 20"
USERADD_PACKAGES = "${PN}"
GROUPADD_PARAM_${PN} = "-r ggc_group"