Browse Source
This moves the device configuration to a config script in configs/, from the previous setup in the bootstrap scripts. It does so by creating a new resources/ folder in the top-level directory, which is then populated with the configuration file, and the server parameters only. When the conversion is run with the demo configuration configs/mender_convert_demo_config the conversion will install all the add-on's available, and modify the configuration file in resources to align with our regular Mender demo configuration. Changelog: Add a demo configuration in configs/mender_convert_demo_config which when added at run time creates a Mender demo setup in the converted image. This includes short polling intervals, and all add-on's installed by default. Signed-off-by: Ole Petter <ole.orhagen@northern.tech>2.5.x
Ole Petter
4 years ago
6 changed files with 62 additions and 41 deletions
@ -0,0 +1,35 @@ |
|||
# 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." |
|||
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)" |
|||
|
|||
} |
|||
PLATFORM_MODIFY_HOOKS+=(enable_demo_configuration_in_file) |
Loading…
Reference in new issue