From 57409b274831100b038221717185af69e9d440b8 Mon Sep 17 00:00:00 2001 From: Jean-Michel Crepel Date: Tue, 11 Feb 2025 13:58:01 +0100 Subject: [PATCH] update add header script with work upstream --- config/scripts/add-header-webcomponent.sh | 26 ++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) mode change 100755 => 100644 config/scripts/add-header-webcomponent.sh diff --git a/config/scripts/add-header-webcomponent.sh b/config/scripts/add-header-webcomponent.sh old mode 100755 new mode 100644 index a0a5341..c048213 --- a/config/scripts/add-header-webcomponent.sh +++ b/config/scripts/add-header-webcomponent.sh @@ -1,10 +1,30 @@ #!/bin/sh -# This script needs to be executable in order to run during the initialization phase -# It might be required to `chmod +x` the file +# To be properl executed by maelstro initialization need the +x flag +# so you need to add it with chmod and commit/push it +# To be properl executed by maelstro initialization need the +x flag +# so you need to add it with chmod and commit/push it +function prop { + variable=$(grep "^${1}" /etc/georchestra/default.properties) + if [[ -z $variable ]] || [[ $variable == \#* ]] ; + then + echo ${2} + else + echo $variable | cut -d'=' -f2 + fi + #one-line version [[ -z $variable ]] || [[ $variable == \#* ]] && echo ${2} || echo $variable | cut -d'=' -f2 +} + +STYLESHEET=$(prop "georchestraStylesheet" "") +SCRIPT=$(prop "headerScript" "https://cdn.jsdelivr.net/gh/georchestra/header@dist/header.js") +HEIGHT=$(prop "headerHeight" "80") +LEGACY=$(prop "useLegacyHeader" "false") +LEGACY_URL=$(prop "headerUrl" "/header") +LOGO=$(prop "logoUrl" "https://www.georchestra.org/public/georchestra-logo.svg") +CONFIG_FILE=$(prop "headerConfigFile" "") MAELSTRO_DIR=${1:-/app} -SNIPPET="" +SNIPPET="" if grep -q "${SNIPPET}" "${MAELSTRO_DIR}/index.html"; then echo "[INFO] geOrchestra: header already present."