Skip to content
This repository has been archived by the owner on Feb 15, 2023. It is now read-only.

Commit

Permalink
Updated files to release 0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonSimCity committed Feb 18, 2022
1 parent 6209dab commit 7b237fa
Show file tree
Hide file tree
Showing 14 changed files with 220 additions and 22 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,9 @@ IMAGE_INSTALL_append = " \
packagegroup-core-full-cmdline \
openssh connman connman-client \
parted fw-env-conf \
binutils \
adu-agent-service \
register-adu-extensions \
"
export IMAGE_BASENAME = "adu-base-image"
Expand Down
2 changes: 1 addition & 1 deletion conf/layer.conf
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ INHERIT += "extrausers"
# groupadd, userdel, groupdel, usermod and groupmod.
EXTRA_USERS_PARAMS = "groupadd --gid 800 adu ; \
groupadd -r --gid 801 do ; \
useradd --uid 800 -p '' -r -g adu --no-create-home --shell /bin/false adu ; \
useradd --uid 800 -p '' -r -g adu -G do --no-create-home --shell /bin/false adu ; \
useradd --uid 801 -p '' -r -g do -G adu --no-create-home --shell /bin/false do ; \
"
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Build and install the azure-blob-storage-file-upload-utility

DESCRIPTION = "Microsoft Azure Blob Storage File Upload Utility"
AUTHOR = "Microsoft Corporation"
HOMEPAGE = "https://github.com/Azure/azure-blob-storage-file-upload-utility"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=d4a904ca135bb7bc912156fee12726f0"

FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"

SRC_URI = "gitsm://github.com/Azure/azure-blob-storage-file-upload-utility.git;branch=main"

SRCREV = "${AUTOREV}"
PV = "1.0+git${SRCPV}"

S = "${WORKDIR}/git"

# util-linux for uuid-dev
# libxml2 for libxml2-dev
DEPENDS = "util-linux azure-iot-sdk-c azure-sdk-for-cpp curl openssl libxml2"

inherit cmake

sysroot_stage_all_append () {
sysroot_stage_dir ${D}${exec_prefix}/cmake ${SYSROOT_DESTDIR}${exec_prefix}/cmake
}

FILES_${PN}-dev += "${exec_prefix}/cmake"

BBCLASSEXTEND = "native nativesdk"
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
[Unit]
Description=ADU Client service.
After=network-online.target
Wants=deliveryoptimization-agent.service
Description=Device Update Agent daemon.
After=network-online.target deliveryoptimization-agent.service
Wants=network-online.target deliveryoptimization-agent.service

[Service]
Type=simple
Restart=on-failure
RestartSec=1
Restart=always
RestartSec=5
User=adu
# If /adu/adu-conf.txt does not exist, systemd will try to start the ADU executable
# 5 times and then give up.
Group=adu
# systemd will try to start the ADU executable 5 times and then give up.
# We can check logs with journalctl -f -u adu-agent.service
# Set log verbosity level to 'Debug' and enable IoT Hub tracing.
ExecStart=/usr/bin/AducIotAgent -l 0 -e

[Install]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Unit]
Description=Register Device Update extensions upon first boot

[Service]
Type=simple
ExecStart=/bin/sh -c 'sleep 5 ; /usr/sbin/register-adu-extensions.sh'

[Install]
WantedBy=multi-user.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/sh

AGENT="AducIotAgent"
STATFILE="/adu/default-extensions-registered"

logger "Start initializing Device Update extensions"

# Register a default update manifest handler.
/usr/bin/${AGENT} --update-type "microsoft/update-manifest" -C /var/lib/adu/extensions/sources/libmicrosoft_steps_1.so

# Register an update manifest v4 handler.
/usr/bin/${AGENT} --update-type "microsoft/update-manifest:4" -C /var/lib/adu/extensions/sources/libmicrosoft_steps_1.so

# Register swupdate content handler.
logger "Register an update content handler for 'microsoft/swupdate:1"

/usr/bin/${AGENT} --update-type "microsoft/script:1" -C /var/lib/adu/extensions/sources/libmicrosoft_script_1.so
/usr/bin/${AGENT} --update-type "microsoft/steps:1" -C /var/lib/adu/extensions/sources/libmicrosoft_steps_1.so
/usr/bin/${AGENT} --update-type "microsoft/swupdate:1" -C /var/lib/adu/extensions/sources/libmicrosoft_swupdate_1.so
/usr/bin/${AGENT} --update-type "microsoft/update-manifest" -C /var/lib/adu/extensions/sources/libmicrosoft_steps_1.so
/usr/bin/${AGENT} --update-type "microsoft/update-manifest:4" -C /var/lib/adu/extensions/sources/libmicrosoft_steps_1.so

# Register a script handler.
/usr/bin/${AGENT} --update-type "microsoft/script:1" -C /var/lib/adu/extensions/sources/libmicrosoft_script_1.so

# Register Delivery Optimization content downloader extension.
logger "Register a content downloader (Delivery Optimization agent)"
/usr/bin/${AGENT} -D /var/lib/adu/extensions/sources/libdeliveryoptimization-content-downloader.so

logger "Device Update extensions registration completed"

# Job done, remove it from systemd services
systemctl disable register-adu-extensions.service

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
SUMMARY = "Register Device Update extensions upon first boot"
DESCRIPTION = "Perform first boot initialization, started as a systemd service which removes itself once finished"
LICENSE = "CLOSED"

SRC_URI = " \
file://register-adu-extensions.sh \
file://register-adu-extensions.service \
"

do_compile () {
}

do_install () {
install -d ${D}/${sbindir}
install -m 0755 ${WORKDIR}/register-adu-extensions.sh ${D}/${sbindir}

install -d ${D}${systemd_unitdir}/system/
install -m 0644 ${WORKDIR}/register-adu-extensions.service ${D}${systemd_unitdir}/system
}

DEPENDS_${PN} += "azure-device-update"

RDEPENDS_${PN} += "azure-device-update"

NATIVE_SYSTEMD_SUPPORT = "1"
SYSTEMD_PACKAGES = "${PN}"
SYSTEMD_SERVICE_${PN} = "register-adu-extensions.service"

inherit allarch systemd
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ python () {
d.setVar('S', d.getVar('WORKDIR') + "/adu-linux-client")
}

# ADUC depends on azure-iot-sdk-c and DO Agent SDK
DEPENDS = "azure-iot-sdk-c deliveryoptimization-agent curl deliveryoptimization-sdk"
# ADUC depends on azure-iot-sdk-c, azure-blob-storage-file-upload-utility, DO Agent SDK, and curl
DEPENDS = "azure-iot-sdk-c azure-blob-storage-file-upload-utility deliveryoptimization-agent deliveryoptimization-sdk curl"

inherit cmake useradd

Expand Down Expand Up @@ -69,11 +69,19 @@ EXTRA_OECMAKE += "-DDOSDK_INCLUDE_DIR=${WORKDIR}/recipe-sysroot/usr/include"
# adu-hw-compat - to install the hardware compatibility file used by swupdate.
# adu-log-dir - to create the temporary log directory in the image.
# deliveryoptimization-agent-service - to install the delivery optimization agent for downloads.
RDEPENDS_${PN} += "bash swupdate adu-pub-key adu-device-info-files adu-hw-compat adu-log-dir deliveryoptimization-agent-service"
# curl - for running the diagnostics component
RDEPENDS_${PN} += "bash swupdate adu-pub-key adu-device-info-files adu-hw-compat adu-log-dir deliveryoptimization-agent-service curl"

INSANE_SKIP_${PN} += "installed-vs-shipped"

ADUC_DATA_DIR = "/var/lib/adu"
ADUC_EXTENSIONS_DIR = "${ADUC_DATA_DIR}/extensions"
ADUC_EXTENSIONS_INSTALL_DIR = "${ADUC_EXTENSIONS_DIR}/sources"
ADUC_COMPONENT_ENUMERATOR_EXTENSION_DIR = "${ADUC_EXTENSIONS_DIR}/component_enumerator"
ADUC_CONTENT_DOWNLOADER_EXTENSION_DIR = "${ADUC_EXTENSIONS_DIR}/content_downloader"
ADUC_UPDATE_CONTENT_HANDLER_EXTENSION_DIR = "${ADUC_EXTENSIONS_DIR}/update_content_handlers"
ADUC_DOWNLOADS_DIR = "${ADUC_DATA_DIR}/downloads"

ADUC_LOG_DIR = "/adu/logs"
ADUC_CONF_DIR = "/adu"

Expand All @@ -93,34 +101,71 @@ GROUPADD_PARAM_${PN}-adu = "\

# USERADD_PARAM specifies command line options to pass to the
# useradd command. Multiple users can be created by separating
# the commands with a semicolon. Here we'll create adu user:
# the commands with a semicolon.
# Here we'll create 'adu' user, and 'do' user.
# To download the update payload file, 'adu' user must be a member of 'do' group.
# To save downloaded file into 'adu' downloads directory, 'do' user must be a member of 'adu' group.
USERADD_PARAM_${PN}-adu = "\
--uid 800 --system -g ${ADUGROUP} --home-dir /home/${ADUUSER} --no-create-home --shell /bin/false ${ADUUSER} ; \
--uid 800 --system -g ${ADUGROUP} -G ${DOGROUP} --home-dir /home/${ADUUSER} --no-create-home --shell /bin/false ${ADUUSER} ; \
--uid 801 --system -g ${DOGROUP} -G ${ADUGROUP} --home-dir /home/${DOUSER} --no-create-home --shell /bin/false ${DOUSER} ; \
"
do_install_append() {
#create ADUC_DATA_DIR
install -d ${D}${ADUC_DATA_DIR}
chgrp ${ADUGROUP} ${D}${ADUC_DATA_DIR}
chown ${ADUUSER}:${ADUGROUP} ${D}${ADUC_DATA_DIR}
chmod 0770 ${D}${ADUC_DATA_DIR}
#create ADUC_EXTENSIONS_DIR
install -d ${D}${ADUC_EXTENSIONS_DIR}
chgrp ${ADUGROUP} ${D}${ADUC_EXTENSIONS_DIR}
chmod 0770 ${D}${ADUC_EXTENSIONS_DIR}
#create ADUC_EXTENSIONS_INSTALL_DIR
install -d ${D}${ADUC_EXTENSIONS_INSTALL_DIR}
chgrp ${ADUGROUP} ${D}${ADUC_EXTENSIONS_INSTALL_DIR}
chmod 0770 ${D}${ADUC_EXTENSIONS_INSTALL_DIR}
#create ADUC_COMPONENT_ENUMERATOR_EXTENSION_DIR
install -d ${D}${ADUC_COMPONENT_ENUMERATOR_EXTENSION_DIR}
chgrp ${ADUGROUP} ${D}${ADUC_COMPONENT_ENUMERATOR_EXTENSION_DIR}
chmod 0770 ${D}${ADUC_COMPONENT_ENUMERATOR_EXTENSION_DIR}
#create ADUC_CONTENT_DOWNLOADER_EXTENSION_DIR
install -d ${D}${ADUC_CONTENT_DOWNLOADER_EXTENSION_DIR}
chgrp ${ADUGROUP} ${D}${ADUC_CONTENT_DOWNLOADER_EXTENSION_DIR}
chmod 0770 ${D}${ADUC_CONTENT_DOWNLOADER_EXTENSION_DIR}
#create ADUC_UPDATE_CONTENT_HANDLER_EXTENSION_DIR
install -d ${D}${ADUC_UPDATE_CONTENT_HANDLER_EXTENSION_DIR}
chgrp ${ADUGROUP} ${D}${ADUC_UPDATE_CONTENT_HANDLER_EXTENSION_DIR}
chmod 0770 ${D}${ADUC_UPDATE_CONTENT_HANDLER_EXTENSION_DIR}
#create ADUC_DOWNLOADS_DIR
install -d ${D}${ADUC_DOWNLOADS_DIR}
chown ${ADUUSER}:${ADUGROUP} ${D}${ADUC_DOWNLOADS_DIR}
chmod 0770 ${D}${ADUC_DOWNLOADS_DIR}
#create ADUC_CONF_DIR
install -d ${D}${ADUC_CONF_DIR}
chgrp ${ADUGROUP} ${D}${ADUC_CONF_DIR}
chgrp root ${D}${ADUC_CONF_DIR}
chown root:${ADUGROUP} ${D}${ADUC_CONF_DIR}
chmod 0774 ${D}${ADUC_CONF_DIR}
#create ADUC_LOG_DIR
install -d ${D}${ADUC_LOG_DIR}
chgrp ${ADUGROUP} ${D}${ADUC_LOG_DIR}
chown ${ADUUSER}:${ADUGROUP} ${D}${ADUC_DOWNLOADS_DIR}
chmod 0774 ${D}${ADUC_LOG_DIR}
#install adu-shell to /usr/lib/adu directory.
install -d ${D}${libdir}/adu
install -m 0550 ${S}/src/adu-shell/scripts/adu-swupdate.sh ${D}${libdir}/adu
chown ${ADUUSER}:${ADUGROUP} ${D}${libdir}/adu
#set owner for adu-shell
chmod 0550 ${D}${libdir}/adu/adu-shell
chown root:${ADUGROUP} ${D}${libdir}/adu/adu-shell
#set S UID for adu-shell
Expand All @@ -129,4 +174,7 @@ do_install_append() {
FILES_${PN} += "${bindir}/AducIotAgent"
FILES_${PN} += "${libdir}/adu/* ${ADUC_DATA_DIR}/* ${ADUC_LOG_DIR}/* ${ADUC_CONF_DIR}/*"
FILES_${PN} += "${ADUC_EXTENSIONS_DIR}/* ${ADUC_EXTENSIONS_INSTALL_DIR}/* ${ADUC_DOWNLOADS_DIR}/*"
FILES_${PN} += "${ADUC_COMPONENT_ENUMERATOR_EXTENSION_DIR}/* ${ADUC_CONTENT_DOWNLOADER_EXTENSION_DIR}/* ${ADUC_UPDATE_CONTENT_HANDLER_EXTENSION_DIR}/*"
FILES_${PN}-adu += "/home/${ADUUSER}/* /home/$(DOUSER)/*"
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ python () {
d.setVar('S', d.getVar('WORKDIR') + "/do-client")
}

DEPENDS = "boost cpprest libproxy msft-gsl"
DEPENDS = "boost curl libproxy msft-gsl"

inherit cmake

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ python () {
d.setVar('S', d.getVar('WORKDIR') + "/do-client")
}

DEPENDS = "boost cpprest libproxy msft-gsl"
DEPENDS = "boost curl libproxy msft-gsl"

inherit cmake

Expand Down
7 changes: 4 additions & 3 deletions recipes-azure-iot/azure-iot-sdk-c/azure-iot-sdk-c_git.bb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ HOMEPAGE = "https://github.com/Azure/azure-iot-sdk-c"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=4283671594edec4c13aeb073c219237a"

# We pull from master branch in order to get PnP APIs
SRC_URI = "gitsm://github.com/Azure/azure-iot-sdk-c.git;branch=master"
# We pull from main branch in order to get PnP APIs
SRC_URI = "gitsm://github.com/Azure/azure-iot-sdk-c.git;branch=main"

SRCREV = "${AUTOREV}"
PV = "1.0+git${SRCPV}"
Expand All @@ -21,7 +21,8 @@ inherit cmake

# Do not use amqp since it is deprecated.
# Do not build sample code to save build time.
EXTRA_OECMAKE += "-Duse_amqp:BOOL=OFF -Duse_http:BOOL=ON -Duse_mqtt:BOOL=ON -Dskip_samples:BOOL=ON -Dbuild_service_client:BOOL=OFF -Dbuild_provisioning_service_client:BOOL=OFF"
# use_http: required uhttp for eis_utils
EXTRA_OECMAKE += "-Duse_amqp:BOOL=OFF -Duse_http:BOOL=ON -Duse_mqtt:BOOL=ON -Ddont_use_uploadtoblob:BOOL=ON -Dskip_samples:BOOL=ON -Dbuild_service_client:BOOL=OFF -Dbuild_provisioning_service_client:BOOL=OFF"

sysroot_stage_all_append () {
sysroot_stage_dir ${D}${exec_prefix}/cmake ${SYSROOT_DESTDIR}${exec_prefix}/cmake
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Build and install the azure-blob-storage-file-upload-utility

DESCRIPTION = "Microsoft Azure SD for CPP"
AUTHOR = "Microsoft Corporation"
HOMEPAGE = "https://github.com/Azure/azure-sdk-for-cpp"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=e74f78882cab57fd1cc4c5482b9a214a"

FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"

SRC_URI = "gitsm://github.com/Azure/azure-sdk-for-cpp.git;branch=main"

SRCREV = "${AUTOREV}"
PV = "1.0+git${SRCPV}"

S = "${WORKDIR}/git"

# util-linux for uuid-dev
# libxml2 for libxml2-dev
DEPENDS = "util-linux curl openssl libxml2"

inherit cmake

sysroot_stage_all_append () {
sysroot_stage_dir ${D}${exec_prefix}/cmake ${SYSROOT_DESTDIR}${exec_prefix}/cmake
}

FILES_${PN}-dev += "${exec_prefix}/cmake"

FILES_${PN} = "/usr/share/azure-storage-blobs-cpp \
/usr/share/azure-storage-queues-cpp \
/usr/share/azure-storage-common-cpp \
/usr/share/azure-storage-files-shares-cpp \
/usr/share/azure-security-keyvault-secrets-cpp \
/usr/share/azure-security-keyvault-certificates-cpp \
/usr/share/azure-security-keyvault-keys-cpp \
/usr/share/azure-identity-cpp \
/usr/share/azure-template-cpp \
/usr/share/azure-core-cpp \
/usr/share/azure-storage-files-datalake-cpp"

BBCLASSEXTEND = "native nativesdk"
2 changes: 2 additions & 0 deletions recipes-core/images/adu-base-image.bb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ IMAGE_INSTALL_append = " \
packagegroup-core-full-cmdline \
openssh connman connman-client \
parted fw-env-conf \
binutils \
adu-agent-service \
register-adu-extensions \
"

export IMAGE_BASENAME = "adu-base-image"
Expand Down
2 changes: 1 addition & 1 deletion recipes-msft-gsl/msft-gsl/msft-gsl_git.bb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=363055e71e77071107ba2bb9a54bd9a7"

# We snap to public-preview-pnp for the latest and greates pnp changes.
SRC_URI = "gitsm://github.com/microsoft/GSL.git;branch=master"
SRC_URI = "gitsm://github.com/microsoft/GSL.git;branch=main"

# tag v2.0.0
SRCREV = "1995e86d1ad70519465374fb4876c6ef7c9f8c61"
Expand Down

0 comments on commit 7b237fa

Please sign in to comment.