Browse Source

Merge pull request #72 from lluiscampos/MEN-2248-production-polling-intervals

MEN-2248: Set production/demo intervals conditionally
1.1.x
Adam Podogrocki 6 years ago
committed by GitHub
parent
commit
22edb7c785
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 33
      convert-stage-4.sh
  2. 14
      mender-convert

33
convert-stage-4.sh

@ -8,16 +8,20 @@ Mender executables, service and configuration files installer.
Usage: $0 [options]
Options: [-m|--mender-disk-image | -g|--mender-client | -a|--artifact-name |
-d|--device-type | -p|--demo-host-ip | -u| --server-url |
-t| --tenant-token]
-d|--device-type | -n|--demo | -p|--demo-host-ip | -u| --server-url |
-c|--server-cert -t| --tenant-token -k|--keep -h|--help]
--mender-disk-image - Mender raw disk image
--mender-client - Mender client binary file
--artifact-name - artifact info
--device-type - target device type identification
--demo - Configure image using demo parameters
--demo-host-ip - Mender demo server IP address
--server-url - Mender production server url
--server-cert - Mender server certificate
--tenant-token - Mender tenant token
--keep - Keep intermediate files in output directory
--help - Show help and exit
Examples:
@ -67,6 +71,16 @@ create_client_files() {
rootfspartb="/dev/hda3"
fi
# Default polling intervals for Production
local updatePollInterval="1800"
local inventPollInterval="28800"
local retryPollInterval="300"
if [ -n "${demo}" ] && [ ${demo} -eq 1 ]; then
updatePollInterval="5"
inventPollInterval="5"
retryPollInterval="30"
fi
cat <<- EOF > $mender_dir/mender.service
[Unit]
Description=Mender OTA update service
@ -87,14 +101,14 @@ create_client_files() {
cat <<- EOF > $mender_dir/mender.conf
{
"InventoryPollIntervalSeconds": 5,
"RetryPollIntervalSeconds": 30,
"InventoryPollIntervalSeconds": "$inventPollInterval",
"RetryPollIntervalSeconds": "$retryPollInterval",
"RootfsPartA": "$rootfsparta",
"RootfsPartB": "$rootfspartb",
"ServerCertificate": "/etc/mender/server.crt",
"ServerURL": "$mender_server_url",
"TenantToken": "$mender_tenant_token",
"UpdatePollIntervalSeconds": 5
"UpdatePollIntervalSeconds": "$updatePollInterval"
}
EOF
@ -258,6 +272,11 @@ do_install_mender() {
show_help
fi
if [ -n "${demo}" ] && [ ${demo} -eq 1 ] && [ -z "${demo_host_ip}" ]; then
log "Demo configuration requires demo_host_ip. Aborting."
show_help
fi
# TODO: more error checking of server types
if [ -n "${tenant_token}" ]; then
mender_tenant_token=$(echo ${tenant_token} | tr -d '\n')
@ -333,6 +352,10 @@ while (( "$#" )); do
artifact_name=$2
shift 2
;;
-n | --demo)
demo="1"
shift 1
;;
-i | --demo-host-ip)
demo_host_ip=$2
shift 2

14
mender-convert

@ -33,10 +33,10 @@ Expert commands:
related files
Options: [-r|--raw-disk-image | -m|--mender-disk-image | -s|--data-part-size-mb |
-d|--device-type | -p|--rootfs-partition-id | -i|--demo-host-ip |
-d|--device-type | -p|--rootfs-partition-id | -n|--demo | -i|--demo-host-ip |
-c|--server-cert | -u|--server-url | -t|--tenant-token |
-g|--mender-client | -b|--bootloader-toolchain | -a|--artifact-name |
-e|--storage-total-size-mb | -k|--keep | -v|--version]
-e|--storage-total-size-mb | -k|--keep | -v|--version -h|--help]
raw-disk-image - raw disk embedded Linux (Debian, Raspbian,
Ubuntu, etc.) image path
@ -47,6 +47,7 @@ Options: [-r|--raw-disk-image | -m|--mender-disk-image | -s|--data-part-size-mb
Mender image
rootfs-partition-id - selects root filesystem (primary|secondary)
as the source filesystem for an artifact
demo - Configure image using demo parameters
demo-host-ip - server demo ip used for testing purposes
server-cert - server certificate file
server-url - production server url
@ -58,6 +59,7 @@ Options: [-r|--raw-disk-image | -m|--mender-disk-image | -s|--data-part-size-mb
it is used to calculate the rootfs final size
keep - keep intermediate files in output directory
version - print the version
help - show help and exit
Note: root filesystem size used in Mender image creation can be found as
an output from 'raw-disk-image-shrink-rootfs' command or, in case
@ -460,6 +462,10 @@ do_install_mender_to_mender_disk_image() {
# mender-image-1.5.0
stage_4_args="-m $mender_disk_image -d $device_type -g ${mender_client} -a ${artifact_name}"
if [ -n "$demo" ] && [ ${demo} -eq 1 ]; then
stage_4_args="${stage_4_args} --demo"
fi
if [ -n "$demo_host_ip" ]; then
stage_4_args="${stage_4_args} -i ${demo_host_ip}"
fi
@ -733,6 +739,10 @@ while (( "$#" )); do
bootloader_toolchain=$2
shift 2
;;
-n | --demo)
demo="1"
shift 1
;;
-i | --demo-host-ip)
demo_host_ip=$2
shift 2

Loading…
Cancel
Save