feat(installer): add .lic license file initialization step during installation on Windows and Linux
This commit is contained in:
@@ -3,8 +3,42 @@ set -euo pipefail
|
||||
|
||||
INSTALL_DIR="/opt/logar-server"
|
||||
CONFIG_DIR="/etc/logar"
|
||||
LIC_FILE=""
|
||||
|
||||
# Parse command line options
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--config-dir|--data-dir)
|
||||
CONFIG_DIR="$2"
|
||||
shift 2
|
||||
;;
|
||||
--lic|--license|--import-lic)
|
||||
LIC_FILE="$2"
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
echo "============================================================"
|
||||
echo " LOGAR Server Enterprise Linux Installer"
|
||||
echo "============================================================"
|
||||
|
||||
# Interactive configuration if running in a terminal without CLI arguments
|
||||
if [ -t 0 ] && [ -z "${LIC_FILE}" ]; then
|
||||
read -r -p "Enter Data and Configuration Directory [${CONFIG_DIR}]: " USER_CFG
|
||||
if [ -n "${USER_CFG}" ]; then
|
||||
CONFIG_DIR="${USER_CFG}"
|
||||
fi
|
||||
|
||||
read -r -p "Enter path to .lic license file (press Enter to skip): " USER_LIC
|
||||
if [ -n "${USER_LIC}" ]; then
|
||||
LIC_FILE="${USER_LIC}"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "[+] Installing LOGAR Server..."
|
||||
mkdir -p "${INSTALL_DIR}" "${CONFIG_DIR}" "/var/log/logar"
|
||||
|
||||
if [ -f "dist/Server.bin" ]; then
|
||||
@@ -21,6 +55,12 @@ if [ -f "${INSTALL_DIR}/Server" ]; then
|
||||
chmod +x "${INSTALL_DIR}/Server"
|
||||
fi
|
||||
|
||||
# If license file provided, import it during setup
|
||||
if [ -n "${LIC_FILE}" ] && [ -f "${LIC_FILE}" ]; then
|
||||
echo "[*] Importing license file: ${LIC_FILE}..."
|
||||
"${INSTALL_DIR}/Server" --config "${CONFIG_DIR}/server_config.json" --import-lic "${LIC_FILE}" || echo "[!] License import returned warning. Continuing."
|
||||
fi
|
||||
|
||||
cat <<EOF > /etc/systemd/system/logar-server.service
|
||||
[Unit]
|
||||
Description=LOGAR Hub and Aggregator Engine
|
||||
|
||||
Reference in New Issue
Block a user