From c271eb82af83a89c7290152d7c38afd5907c66f9 Mon Sep 17 00:00:00 2001 From: thetechprepper Date: Wed, 13 Aug 2025 05:10:10 -0700 Subject: [PATCH] et-api - Initial EmComm Tools API installation script --- scripts/install-et-api.sh | 43 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 scripts/install-et-api.sh diff --git a/scripts/install-et-api.sh b/scripts/install-et-api.sh new file mode 100755 index 0000000..29d517d --- /dev/null +++ b/scripts/install-et-api.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# Author : Gaston Gonzalez +# Date : 13 August 2025 +# Purpose : Install EmComm Tools API +set -e +trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG +trap 'et-log "\"${last_command}\" command failed with exit code $?."' ERR + +. ./env.sh + +APP=et-api +VERSION=1.0.0 +ET_API_JAR="emcomm-tools-api-${VERSION}-SNAPSHOT.jar" +BASE_URL="https://github.com/thetechprepper/et-api-java/releases/download/${VERSION}" + +INSTALL_DIR="/opt/emcomm-tools-api" +BIN_DIR="${INSTALL_DIR}/bin" +DATA_DIR="${INSTALL_DIR}/data" +INDEX_DIR="${INSTALL_DIR}/index" + +et-log "Installing ${APP} ${VERSION}..." + +mkdir -v -p "${BIN_DIR}" "${DATA_DIR}" "${INDEX_DIR}" + +# Download and install et-api uber JAR +URL="${BASE_URL}/${ET_API_JAR}" +et-log "Downloading ${APP}: ${URL}" +curl -s -L -o "${BIN_DIR}/${APP}" --fail ${URL} +chmod 755 "${BIN_DIR}/${APP}" + +# Download pre-built data sets +FILES=("faa.csv" "license.csv" "zip2geo.csv" "zip2geo-elevation.csv") +for file in "${FILES[@]}"; do + URL="${BASE_URL}/${file}" + + et-log "Downloading data set: ${URL}" + curl -s -L -o "${DATA_DIR}/${file}" --fail ${URL} +done + +et-log "Applying permissions..." +chgrp -v -R ${ET_GROUP} ${DATA_DIR} ${INDEX_DIR} +chmod -v 775 ${DATA_DIR} ${INDEX_DIR} +chmod -v 664 ${DATA_DIR}/*.csv