Skip to content

Commit

Permalink
greengrass-bin, greengrass-bin-demo: Switch away from S = WORKDIR
Browse files Browse the repository at this point in the history
Make it dependent on UNPACKDIR instead
  • Loading branch information
thomas-roos committed May 17, 2024
1 parent 24849ad commit e079ffb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
11 changes: 6 additions & 5 deletions recipes-iot/aws-iot-greengrass/greengrass-bin-demo.bb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ SRC_URI[license.sha256sum] = "09e8a9bcec8067104652c168685ab0931e7868f9c8284b66f5

UPSTREAM_VERSION_UNKNOWN = "1"

S = "${WORKDIR}"
S = "${WORKDIR}/sources"
UNPACKDIR = "${S}"

FILES:${PN} += "/${GG_BASENAME}"

Expand All @@ -39,11 +40,11 @@ do_compile[noexec] = "1"
do_install() {
install -d ${GG_ROOT}/auth
install -d ${GG_ROOT}/config
install -m 0440 ${WORKDIR}/demo.pkey.pem ${GG_ROOT}/auth
install -m 0440 ${WORKDIR}/demo.cert.pem ${GG_ROOT}/auth
install -m 0440 ${WORKDIR}/demo.root.pem ${GG_ROOT}/auth
install -m 0440 ${UNPACKDIR}/demo.pkey.pem ${GG_ROOT}/auth
install -m 0440 ${UNPACKDIR}/demo.cert.pem ${GG_ROOT}/auth
install -m 0440 ${UNPACKDIR}/demo.root.pem ${GG_ROOT}/auth

install -m 0640 ${WORKDIR}/greengrassv2-init.yaml ${GG_ROOT}/config/config.yaml
install -m 0640 ${UNPACKDIR}/greengrassv2-init.yaml ${GG_ROOT}/config/config.yaml

sed -i -e "s,##private_key##,/${GG_BASENAME}/auth/demo.pkey.pem,g" ${GG_ROOT}/config/config.yaml
sed -i -e "s,##certificate_path##,/${GG_BASENAME}/auth/demo.cert.pem,g" ${GG_ROOT}/config/config.yaml
Expand Down
23 changes: 12 additions & 11 deletions recipes-iot/aws-iot-greengrass/greengrass-bin_2.12.5.bb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ GG_ROOT = "${D}/${GG_BASENAME}"
GGV2_FLEETPROVISIONING_VERSION ?= "latest"
GGV2_FLEET_PROVISIONING_TEMPLATE_NAME ?= "GreengrassFleetProvisioningTemplate"

LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=34400b68072d710fecd0a2940a0d1658"
LIC_FILES_CHKSUM = "file://${UNPACKDIR}/LICENSE;md5=34400b68072d710fecd0a2940a0d1658"

DEPENDS += "gettext-native"

Expand Down Expand Up @@ -42,7 +42,8 @@ UPSTREAM_CHECK_URI = "https://github.com/aws-greengrass/aws-greengrass-nucleus/t

GG_USESYSTEMD = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'yes', 'no', d)}"

S = "${WORKDIR}"
S = "${WORKDIR}/sources"
UNPACKDIR = "${S}"

inherit systemd useradd ptest pkgconfig

Expand Down Expand Up @@ -93,18 +94,18 @@ do_install() {
install -d ${GG_ROOT}/claim-certs
install -d ${GG_ROOT}/plugins
install -d ${GG_ROOT}/plugins/trusted
install -m 0440 ${WORKDIR}/claim.pkey.pem ${GG_ROOT}/claim-certs
install -m 0440 ${WORKDIR}/claim.cert.pem ${GG_ROOT}/claim-certs
install -m 0440 ${WORKDIR}/claim.root.pem ${GG_ROOT}/claim-certs
install -m 0440 ${UNPACKDIR}/claim.pkey.pem ${GG_ROOT}/claim-certs
install -m 0440 ${UNPACKDIR}/claim.cert.pem ${GG_ROOT}/claim-certs
install -m 0440 ${UNPACKDIR}/claim.root.pem ${GG_ROOT}/claim-certs

install -m 0740 ${WORKDIR}/fleetprovisioningbyclaim-${GGV2_FLEETPROVISIONING_VERSION}.jar ${GG_ROOT}/plugins/trusted/aws.greengrass.FleetProvisioningByClaim.jar
install -m 0740 ${UNPACKDIR}/fleetprovisioningbyclaim-${GGV2_FLEETPROVISIONING_VERSION}.jar ${GG_ROOT}/plugins/trusted/aws.greengrass.FleetProvisioningByClaim.jar

install -m 0755 ${WORKDIR}/replace_board_id.sh ${GG_ROOT}/config/
install -m 0755 ${UNPACKDIR}/replace_board_id.sh ${GG_ROOT}/config/

patch ${GG_ROOT}/alts/init/distro/bin/loader -p1 < ${WORKDIR}/loader.diff
patch ${D}${systemd_unitdir}/system/greengrass.service -p1 < ${WORKDIR}/greengrass.service.diff
patch ${GG_ROOT}/alts/init/distro/bin/loader -p1 < ${UNPACKDIR}/loader.diff
patch ${D}${systemd_unitdir}/system/greengrass.service -p1 < ${UNPACKDIR}/greengrass.service.diff

install -m 0640 ${WORKDIR}/config.yaml.template ${GG_ROOT}/config/config.yaml
install -m 0640 ${UNPACKDIR}/config.yaml.template ${GG_ROOT}/config/config.yaml

AWS_DEFAULT_REGION=${GGV2_REGION} \
PROXY_USER=ggc_user:ggc_group \
Expand All @@ -117,7 +118,7 @@ do_install() {
ROOT_CA_PATH=/${GG_BASENAME}/claim-certs/claim.root.pem \
THING_NAME=${GGV2_THING_NAME} \
THING_GROUP_NAME=${GGV2_THING_GROUP} \
envsubst < ${WORKDIR}/config.yaml.template > ${GG_ROOT}/config/config.yaml
envsubst < ${UNPACKDIR}/config.yaml.template > ${GG_ROOT}/config/config.yaml
fi
}

Expand Down

0 comments on commit e079ffb

Please sign in to comment.