From 28f314e6b75e01b38e64fdd42f24d4d3af4fd3fd Mon Sep 17 00:00:00 2001 From: Greg Rundlett Date: Thu, 29 Feb 2024 15:03:04 -0500 Subject: [PATCH] git repo URL and branch name as BASH variables Create Bash variables for getmeza.sh and source them from the ENVIRONMENT; so that administrators can override them at run-time; or use a default. This addresses part of issues #22 and #23 This work was performed for NASA GRC-ATF by WikiWorks per NASA Contract NNC15BA02B. --- src/scripts/getmeza.sh | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/scripts/getmeza.sh b/src/scripts/getmeza.sh index e01821b0..3ce14fbb 100644 --- a/src/scripts/getmeza.sh +++ b/src/scripts/getmeza.sh @@ -166,11 +166,24 @@ case ${distro} in ;; esac - -# if /opt/meza doesn't exist, clone into and use master branch (which is the -# default, but should we make this configurable?) +# Meza repository URL and branch can be set in your system shell as environment variables so as to work locally with +# your preferred setup and/or test changes to this file in development without needing to alter this file explicitly. +# +# Use +# export MEZA_REPOSITORY_URL='https://github.com/freephile/meza.git' +# in your shell to override the default repo URL set here +MEZA_REPOSITORY_URL="${MEZA_REPOSITORY_URL:-https://github.com/nasa/meza.git}" + +# Declare which branch in the repo to use +# +# Use +# export MEZA_BRANCH_NAME='REL1_39' +# in your shell to override the default branch name set here +MEZA_BRANCH_NAME="${MEZA_BRANCH_NAME:-main}" + +# if /opt/meza doesn't exist, clone our sources, always keeping the 'meza' name if [ ! -d "${INSTALL_DIR}/meza" ]; then - git clone https://github.com/enterprisemediawiki/meza.git ${INSTALL_DIR}/meza --branch master + git clone ${MEZA_REPOSITORY_URL} ${INSTALL_DIR}/meza --branch ${MEZA_BRANCH_NAME} "${INSTALL_DIR}/meza" fi # Make sure /opt/meza permissions are good in case git-cloned earlier