You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.5 KiB
35 lines
1.5 KiB
# Install all the add-on's by default
|
|
MENDER_ADDON_CONNECT_INSTALL="y"
|
|
MENDER_ADDON_CONFIGURE_INSTALL="y"
|
|
|
|
enable_demo_configuration_in_file() {
|
|
|
|
log_info "Modifying mender.conf to follow a demo setup"
|
|
|
|
run_and_log_cmd "mkdir -p work/rootfs/etc/mender"
|
|
|
|
if [ ! -f work/rootfs/etc/mender/mender.conf ]; then
|
|
log_error 'No Mender configuration file found in the work folder. Either run a bootstrap script and pass the output directory as an overlay to mender-convert, or pass your own overlay with an $OVERLAY/etc/mender/mender.conf file.'
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -f work/rootfs/etc/mender/mender-connect.conf ]; then
|
|
log_info "Installing the mender-connect.conf file"
|
|
cat <<- EOF > work/rootfs/etc/mender/mender-connect.conf
|
|
{
|
|
"ShellCommand": "/bin/sh",
|
|
"User": "root"
|
|
}
|
|
EOF
|
|
run_and_log_cmd "sudo chmod 0600 work/rootfs/etc/mender/mender-connect.conf"
|
|
fi
|
|
|
|
log_info "Adding the demo configuration to the Mender client"
|
|
tmpfile=work/mender.conf.bak
|
|
run_and_log_cmd "cat work/rootfs/etc/mender/mender.conf | jq '.InventoryPollIntervalSeconds=5 | .RetryPollIntervalSeconds=30 | .UpdatePollIntervalSeconds=5' > ${tmpfile}"
|
|
run_and_log_cmd "cp ${tmpfile} work/rootfs/etc/mender/mender.conf"
|
|
run_and_log_cmd "sudo chmod 0600 work/rootfs/etc/mender/mender.conf"
|
|
log_warn "New mender.conf contents: $(cat work/rootfs/etc/mender/mender.conf)"
|
|
|
|
}
|
|
OVERLAY_MODIFY_HOOKS+=(enable_demo_configuration_in_file)
|
|
|