From 629365ca1d91f6eb48179b64a40edaa0079875b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roni=20V=C3=A4yrynen?= Date: Sun, 30 Jan 2022 14:07:36 +0200 Subject: [PATCH] fix to prevent writing xo-proxy config to wrong users directory when xouser is set in configuration --- .editorconfig | 2 +- xo-install.sh | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.editorconfig b/.editorconfig index b9d3119..9941469 100644 --- a/.editorconfig +++ b/.editorconfig @@ -6,4 +6,4 @@ end_of_line = lf trim_trailing_whitespace = true insert_final_newline = true function_next_line = false -switch_case_indent = false +switch_case_indent = true diff --git a/xo-install.sh b/xo-install.sh index 4c054f9..72da5c4 100755 --- a/xo-install.sh +++ b/xo-install.sh @@ -30,6 +30,7 @@ AUTOUPDATE=${AUTOUPDATE:-"true"} PRESERVE=${PRESERVE:-"3"} XOUSER=${XOUSER:-"root"} CONFIGPATH=$(getent passwd "$XOUSER" | cut -d: -f6) +CONFIGPATH_PROXY=$(getent passwd root | cut -d: -f6) PLUGINS="${PLUGINS:-"none"}" ADDITIONAL_PLUGINS="${ADDITIONAL_PLUGINS:-"none"}" REPOSITORY="${REPOSITORY:-"https://github.com/vatesfr/xen-orchestra"}" @@ -947,20 +948,23 @@ EOF runcmd "/bin/systemctl daemon-reload" # if xen orchestra proxy configuration file doesn't exist or configuration update is not disabled in xo-install.cfg, we create it - if [[ ! -f "$CONFIGPATH/.config/xo-proxy/config.toml" ]]; then + + if [[ ! -f "$CONFIGPATH_PROXY/.config/xo-proxy/config.toml" ]]; then PROXY_VM_UUID="$(dmidecode -t system | grep UUID | awk '{print $NF}')" PROXY_RANDOM_UUID="$(cat /proc/sys/kernel/random/uuid)" PROXY_TOKEN="$(tr -dc A-Z-a-z0-9_-