From c73da41be2f0699eb991ccf63eb83788bf5c5013 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Wed, 29 May 2024 09:10:59 -0600 Subject: [PATCH] image: Add hook to customize metrics server URLs Allow configuring the metrics server URLs so that 3rd parties deploy the Endless metrics stack they can build images to use them out of the box. https://phabricator.endlessm.com/T35420 --- config/defaults.ini | 7 +++++++ hooks/image/50-metrics-urls | 15 +++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 hooks/image/50-metrics-urls diff --git a/config/defaults.ini b/config/defaults.ini index ad02abb9..fd018213 100644 --- a/config/defaults.ini +++ b/config/defaults.ini @@ -116,6 +116,7 @@ hooks_add = 50-flatpak.chroot 50-language 50-locales + 50-metrics-urls 50-timezone 50-update-done-stamp 50-reclaim-swap-stamp @@ -221,6 +222,12 @@ icon_grid_add = # Brand-specific configuration for the First Boot Experience branding_fbe_config = +# Metrics server URLs. metrics_server_url sets the URL for the OS +# metrics server (azafea-metrics-proxy) while activation_server_url sets +# the URL for the activation server (eos-activation-server). +metrics_server_url = +activation_server_url = + [kolibri] app_version = 0.15.12 app_desktop_xdg_plugin_version = 1.2.0 diff --git a/hooks/image/50-metrics-urls b/hooks/image/50-metrics-urls new file mode 100644 index 00000000..72f1a4e7 --- /dev/null +++ b/hooks/image/50-metrics-urls @@ -0,0 +1,15 @@ +# Set custom metrics server URLs. + +if [ -n "${EIB_IMAGE_METRICS_SERVER_URL}" ]; then + conf_file="${OSTREE_DEPLOYMENT}"/etc/metrics/eos-metrics-permissions.conf + [ -f "${conf_file}" ] || echo "[global]" > "${conf_file}" + sed -i '/^server_url *=/d' "${conf_file}" + echo "server_url=${EIB_IMAGE_METRICS_SERVER_URL}" >> "${conf_file}" +fi + +if [ -n "${EIB_IMAGE_ACTIVATION_SERVER_URL}" ]; then + conf_file="${OSTREE_DEPLOYMENT}"/etc/eos-phone-home.conf + [ -f "${conf_file}" ] || echo "[global]" > "${conf_file}" + sed -i '/^host *=/d' "${conf_file}" + echo "host=${EIB_IMAGE_ACTIVATION_SERVER_URL}" >> "${conf_file}" +fi