From 824d7ee05392613151fd315f9b309e365a32c9c5 Mon Sep 17 00:00:00 2001 From: spwoodcock Date: Sun, 5 Nov 2023 11:40:21 +0000 Subject: [PATCH] build: fix install script find .env for non-root usr --- src/frontend/public/install.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/frontend/public/install.sh b/src/frontend/public/install.sh index 01e295127a..8242ae6389 100644 --- a/src/frontend/public/install.sh +++ b/src/frontend/public/install.sh @@ -443,6 +443,8 @@ check_if_test() { get_repo() { heading_echo "Getting Necessary Files" + current_dir="${PWD}" + if ! command -v git &>/dev/null; then yellow_echo "Downloading GIT." echo @@ -459,14 +461,14 @@ get_repo() { echo "Cloning repo $repo_url to dir: /tmp/${RANDOM_DIR}" echo - git clone --branch "${BRANCH_NAME}" --depth 1 "$repo_url" + git clone --branch "build/nginx-certbot" --depth 1 "$repo_url" # Check for existing .env files existing_dotenv="" - if [ ${RUN_AS_ROOT} == true ] && sudo test -f "/root/fmtm/${DOTENV_NAME}"; then + if [ "${RUN_AS_ROOT}" == true ] && sudo test -f "/root/fmtm/${DOTENV_NAME}"; then existing_dotenv="/root/fmtm/${DOTENV_NAME}" - elif [ -f "${PWD}/${DOTENV_NAME}" ]; then - existing_dotenv="${PWD}/${DOTENV_NAME}" + elif [ -f "${current_dir}/${DOTENV_NAME}" ]; then + existing_dotenv="${current_dir}/${DOTENV_NAME}" fi if [ -n "$existing_dotenv" ]; then @@ -474,7 +476,7 @@ get_repo() { echo "Found existing dotenv file." echo echo "Copying $existing_dotenv --> /tmp/${RANDOM_DIR}/fmtm/${DOTENV_NAME}" - if [ ${RUN_AS_ROOT} == true ]; then + if [ "${RUN_AS_ROOT}" == true ]; then sudo cp "$existing_dotenv" "/tmp/${RANDOM_DIR}/fmtm/" else cp "$existing_dotenv" "/tmp/${RANDOM_DIR}/fmtm/"