Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions daemon/deviceupdate-agent.service
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Unit]
Description=Device Update Agent daemon.
After=network-online.target deliveryoptimization-agent.service
Wants=network-online.target deliveryoptimization-agent.service
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
Expand Down
12 changes: 0 additions & 12 deletions daemon/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@ adu_user=adu
# access to ADU resources like download sandbox folder.
adu_group=adu

# Note: DO user and group are created by deliveryoptimization-agent Debian package,
# which is one of the dependencies declared in deviceupdate-agent control file.
# We are assuming that both DO user and group currently exist at this point.

# The user that the DO Agent daemon runs as.
do_user='do'

# The sample du-config.json
sample_du_config=$(
cat << END_OF_JSON
Expand Down Expand Up @@ -91,11 +84,6 @@ add_adu_user_and_group() {
if getent group "syslog" > /dev/null; then
usermod -aG "syslog" "$adu_user"
fi

echo "Add the 'do' user to the 'adu' group." # To allow DO to write to ADU download sandbox.
if getent passwd "$do_user" > /dev/null; then
usermod -aG "$adu_group" "$do_user"
fi
}

register_daemon() {
Expand Down
8 changes: 4 additions & 4 deletions docs/agent-reference/registering-device-update-extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,18 @@ $ cat /var/lib/adu/extensions/update_content_handlers/microsoft_update-manifest_

```sh

$adu_bin_path -l 2 --extension-type contentDownloader --register-extension $adu_extensions_sources_dir/$adu_delivery_optimization_downloader_file
$adu_bin_path -l 2 --extension-type contentDownloader --register-extension $adu_extensions_sources_dir/$adu_curl_downloader_file
```

### Contents of resultant extension.json for content downloader

```sh
cat /var/lib/adu/extensions/content_downloader/extension.json
{
"fileName":"/var/lib/adu/extensions/sources/libdeliveryoptimization_content_downloader.so",
"sizeInBytes":254584,
"fileName":"/var/lib/adu/extensions/sources/libcurl_content_downloader.so",
"sizeInBytes":450616,
"hashes": {
"sha256":"0amRRIkSZ/im/AoLahg7QZwzZWo837VPEa1zedXl9BA="
"sha256":"o3S1xglbOpqFaMYMiVCA+J2w2Y1TTxJuurMbv6m7mBU="
}
}
```
Expand Down
3 changes: 1 addition & 2 deletions packages/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ set (CPACK_DEBIAN_PACKAGE_SECTION "admin")
# If remove deliveryoptimization-agent from dependencies, preinst script must be updated accordingly.

# See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
set (CPACK_DEBIAN_PACKAGE_DEPENDS "deliveryoptimization-agent (>= 1.0.0), libdeliveryoptimization (>= 1.0.0), curl")
set (CPACK_DEBIAN_PACKAGE_SUGGESTS "deliveryoptimization-plugin-apt")
set (CPACK_DEBIAN_PACKAGE_DEPENDS "curl")

# Use dpkg-shlibdeps to generate better package dependency list.
set (CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
Expand Down
20 changes: 3 additions & 17 deletions packages/debian/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ adu_swupdate_handler_2_file=libmicrosoft_swupdate_2.so

adu_example_component_enumerator_file=libcontoso_component_enumerator.so

adu_curl_downloader_file=libcurl_content_downloader.so
adu_delivery_optimization_downloader_file=libdeliveryoptimization_content_downloader.so

adu_delta_download_handler_file=libmicrosoft_delta_download_handler.so
Expand All @@ -47,7 +48,7 @@ eis_idservice_dir=/etc/aziot/identityd/config.d
# ADU Agent daemon needs to run as 'adu' user to be able to perform high-privilege tasks via adu-shell.
adu_user=adu

# The adu_group is the group that gives admins and partner users like DO user
# The adu_group is the group that gives admins and partner users
# access to ADU resources like sandbox folder.
adu_group=adu

Expand Down Expand Up @@ -230,7 +231,7 @@ register_reference_extensions() {
$adu_bin_path -l 2 --extension-type componentEnumerator --register-extension $adu_extensions_sources_dir/$adu_example_component_enumerator_file

echo "Register content downloader extension..."
$adu_bin_path -l 2 --extension-type contentDownloader --register-extension $adu_extensions_sources_dir/$adu_delivery_optimization_downloader_file
$adu_bin_path -l 2 --extension-type contentDownloader --register-extension $adu_extensions_sources_dir/$adu_curl_downloader_file

echo "Register delta download handler..."
$adu_bin_path -l 2 --extension-type downloadHandler --extension-id "microsoft/delta:1" --register-extension $adu_extensions_sources_dir/$adu_delta_download_handler_file
Expand Down Expand Up @@ -292,21 +293,6 @@ case "$1" in

register_and_enable_daemon

# Note: DO user and group are created by deliveryoptimization-agent Debian package,
# which is one of the dependencies declared in deviceupdate-agent control file.
# We are assuming that both DO user and group currently exist at this point.
# Add 'do' user to 'adu' group to allow DO to write to ADU download sandbox.
echo "Add the 'do' user to the 'adu' group and 'adu' to the 'do' group"
if getent passwd 'do' > /dev/null; then
usermod -aG 'adu' 'do'
# Note: We must add the 'adu' user to the 'do' group so that we can set the connection_string for DO
usermod -aG 'do' 'adu'

# Restart deliveryoptimization-agent service to ensure that the new 'do' user's groups take effect.
echo "Restart $ms_doclient_lite_service"
systemctl restart "$ms_doclient_lite_service"
fi

complete_migration_steps

# Do not restart the current deviceupdate-agent because we want the update workflow
Expand Down
2 changes: 1 addition & 1 deletion packages/debian/postrm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ adu_shell_bin_path=/usr/bin/adu-shell
adu_eis_conf_file=adu.toml
eis_idservice_dir=/etc/aziot/identityd/config.d

# The adu_group is the group that gives admins and partner users like DO user
# The adu_group is the group that gives admins and partner users
# access to ADU resources like sandbox folder.
adu_group=adu
# adu_user is the user that the ADU Agent daemon will run as.
Expand Down
2 changes: 1 addition & 1 deletion packages/debian/preinst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ set -e
# ADU Agent daemon needs to run as 'adu' to be able to perform high-privilege tasks via adu-shell.
adu_user=adu

# The adu_group is the group that gives partner users like DO user
# The adu_group is the group that gives partner users
# access to ADU resources like download sandbox folder.
adu_group=adu

Expand Down
2 changes: 1 addition & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ install_adu=false
work_folder=/tmp
cmake_dir_path=""
cmake_bin="cmake"
rootkeypkg_curl=false
rootkeypkg_curl=true

#
# Export the compiler settings in case VM is wonky
Expand Down
26 changes: 13 additions & 13 deletions scripts/install-du.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,16 @@ function Register-Components {
# contentDownloader
#

# curl content downlaoader not used on Windows.
# curl content downlaoader will be used on Windows.
# /var/lib/adu/extensions/content_downloader/extension.json
# $curl_content_downloader_file = 'curl_content_downloader.dll'
# & $aduciotagent_path --register-extension "$adu_extensions_sources_dir/$curl_content_downloader_file" --extension-type contentDownloader --log-level 2
$curl_content_downloader_file = "$adu_extensions_sources_dir/curl_content_downloader.dll"
& $aduciotagent_path --register-extension "$curl_content_downloader_file" --extension-type contentDownloader --log-level 2

# /var/lib/adu/extensions/content_downloader/extension.json
$do_content_downloader_file = "$adu_extensions_sources_dir/deliveryoptimization_content_downloader.dll"
& $aduciotagent_path --register-extension $do_content_downloader_file --extension-type contentDownloader --log-level 2
# $do_content_downloader_file = "$adu_extensions_sources_dir/deliveryoptimization_content_downloader.dll"
# & $aduciotagent_path --register-extension $do_content_downloader_file --extension-type contentDownloader --log-level 2
if ($LASTEXITCODE -ne 0) {
Show-Error "Registration of '$do_content_downloader_file' failed: $LASTEXITCODE"
Show-Error "Registration of '$curl_content_downloader_file' failed: $LASTEXITCODE"
}

#
Expand All @@ -126,40 +126,40 @@ function Register-Components {
$microsoft_script_1_handler_file = "$adu_extensions_sources_dir/microsoft_script_1.dll"
& $aduciotagent_path --register-extension $microsoft_script_1_handler_file --extension-type updateContentHandler --extension-id 'microsoft/script:1' --log-level 2
if ($LASTEXITCODE -ne 0) {
Show-Error "Registration of '$do_content_downloader_file' failed: $LASTEXITCODE"
Show-Error "Registration of '$microsoft_script_1_handler_file' failed: $LASTEXITCODE"
}

# /var/lib/adu/extensions/update_content_handlers/microsoft_simulator_1/content_handler.json
$microsoft_simulator_1_file = "$adu_extensions_sources_dir/microsoft_simulator_1.dll"
& $aduciotagent_path --register-extension $microsoft_simulator_1_file --extension-type updateContentHandler --extension-id 'microsoft/simulator:1'
if ($LASTEXITCODE -ne 0) {
Show-Error "Registration of '$do_content_downloader_file' failed: $LASTEXITCODE"
Show-Error "Registration of '$microsoft_simulator_1_file' failed: $LASTEXITCODE"
}

# /var/lib/adu/extensions/update_content_handlers/microsoft_steps_1/content_handler.json
$microsoft_steps_1_file = "$adu_extensions_sources_dir/microsoft_steps_1.dll"
& $aduciotagent_path --register-extension $microsoft_steps_1_file --extension-type updateContentHandler --extension-id 'microsoft/steps:1' --log-level 2
if ($LASTEXITCODE -ne 0) {
Show-Error "Registration of '$do_content_downloader_file' failed: $LASTEXITCODE"
Show-Error "Registration of '$microsoft_steps_1_file' failed: $LASTEXITCODE"
}
& $aduciotagent_path --register-extension $microsoft_steps_1_file --extension-type updateContentHandler --extension-id 'microsoft/update-manifest' --log-level 2
if ($LASTEXITCODE -ne 0) {
Show-Error "Registration of '$do_content_downloader_file' failed: $LASTEXITCODE"
Show-Error "Registration of '$microsoft_steps_1_file' failed: $LASTEXITCODE"
}
& $aduciotagent_path --register-extension $microsoft_steps_1_file --extension-type updateContentHandler --extension-id 'microsoft/update-manifest:4' --log-level 2
if ($LASTEXITCODE -ne 0) {
Show-Error "Registration of '$do_content_downloader_file' failed: $LASTEXITCODE"
Show-Error "Registration of '$microsoft_steps_1_file' failed: $LASTEXITCODE"
}
& $aduciotagent_path --register-extension $microsoft_steps_1_file --extension-type updateContentHandler --extension-id 'microsoft/update-manifest:5' --log-level 2
if ($LASTEXITCODE -ne 0) {
Show-Error "Registration of '$do_content_downloader_file' failed: $LASTEXITCODE"
Show-Error "Registration of '$microsoft_steps_1_file' failed: $LASTEXITCODE"
}

# /var/lib/adu/extensions/update_content_handlers/microsoft_wim_1/content_handler.json
$microsoft_wim_1_handler_file = "$adu_extensions_sources_dir/microsoft_wim_1.dll"
& $aduciotagent_path --register-extension $microsoft_wim_1_handler_file --extension-type updateContentHandler --extension-id 'microsoft/wim:1' --log-level 2
if ($LASTEXITCODE -ne 0) {
Show-Error "Registration of '$do_content_downloader_file' failed: $LASTEXITCODE"
Show-Error "Registration of '$microsoft_wim_1_handler_file' failed: $LASTEXITCODE"
}
''
}
Expand Down
1 change: 0 additions & 1 deletion src/extensions/content_downloaders/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required (VERSION 3.5)

add_subdirectory (curl_downloader)
add_subdirectory (deliveryoptimization_downloader)