mirror of
https://github.com/uprightbass360/AzerothCore-RealmMaster.git
synced 2026-01-13 00:58:34 +00:00
refactor: reorganize scripts under bash/python
This commit is contained in:
43
setup.sh
43
setup.sh
@@ -3,13 +3,19 @@ set -e
|
||||
clear
|
||||
|
||||
# ==============================================
|
||||
# ac-compose - Interactive .env generator
|
||||
# azerothcore-rm - Interactive .env generator
|
||||
# ==============================================
|
||||
# Mirrors options from scripts/setup-server.sh but targets ac-compose/.env
|
||||
# Mirrors options from scripts/setup-server.sh but targets azerothcore-rm/.env
|
||||
|
||||
# Get script directory for template reading
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
# Default project name (can be overridden by COMPOSE_PROJECT_NAME in .env)
|
||||
ENV_FILE="$SCRIPT_DIR/.env"
|
||||
TEMPLATE_FILE="$SCRIPT_DIR/.env.template"
|
||||
source "$SCRIPT_DIR/scripts/bash/project_name.sh"
|
||||
DEFAULT_PROJECT_NAME="$(project_name::resolve "$ENV_FILE" "$TEMPLATE_FILE")"
|
||||
|
||||
# ==============================================
|
||||
# Constants (auto-loaded from .env.template)
|
||||
# ==============================================
|
||||
@@ -44,17 +50,7 @@ get_template_value() {
|
||||
}
|
||||
|
||||
sanitize_project_name(){
|
||||
local raw="$1"
|
||||
local sanitized
|
||||
sanitized="$(echo "$raw" | tr '[:upper:]' '[:lower:]')"
|
||||
sanitized="${sanitized// /-}"
|
||||
sanitized="$(echo "$sanitized" | tr -cd 'a-z0-9_-')"
|
||||
if [[ -z "$sanitized" ]]; then
|
||||
sanitized="azerothcore-realmmaster"
|
||||
elif [[ ! "$sanitized" =~ ^[a-z0-9] ]]; then
|
||||
sanitized="ac${sanitized}"
|
||||
fi
|
||||
echo "$sanitized"
|
||||
project_name::sanitize "$1"
|
||||
}
|
||||
|
||||
resolve_project_image_tag(){
|
||||
@@ -353,8 +349,8 @@ EOF
|
||||
# ==============================
|
||||
|
||||
MODULE_MANIFEST_PATH="$SCRIPT_DIR/config/module-manifest.json"
|
||||
MODULE_MANIFEST_HELPER="$SCRIPT_DIR/scripts/setup_manifest.py"
|
||||
MODULE_PROFILES_HELPER="$SCRIPT_DIR/scripts/setup_profiles.py"
|
||||
MODULE_MANIFEST_HELPER="$SCRIPT_DIR/scripts/python/setup_manifest.py"
|
||||
MODULE_PROFILES_HELPER="$SCRIPT_DIR/scripts/python/setup_profiles.py"
|
||||
ENV_TEMPLATE_FILE="$SCRIPT_DIR/.env.template"
|
||||
|
||||
declare -a MODULE_KEYS=()
|
||||
@@ -554,7 +550,7 @@ main(){
|
||||
Usage: ./setup.sh [options]
|
||||
|
||||
Description:
|
||||
Interactive wizard that generates ac-compose/.env for the
|
||||
Interactive wizard that generates azerothcore-rm/.env for the
|
||||
profiles-based compose. Prompts for deployment type, ports, storage,
|
||||
MySQL credentials, backup retention, and module presets or manual
|
||||
toggles.
|
||||
@@ -790,7 +786,7 @@ EOF
|
||||
fi
|
||||
|
||||
show_wow_header
|
||||
say INFO "This will create ac-compose/.env for compose profiles."
|
||||
say INFO "This will create azerothcore-rm/.env for compose profiles."
|
||||
|
||||
# Deployment type
|
||||
say HEADER "DEPLOYMENT TYPE"
|
||||
@@ -915,7 +911,11 @@ fi
|
||||
if [ -n "$CLI_STORAGE_PATH" ]; then
|
||||
STORAGE_PATH="$CLI_STORAGE_PATH"
|
||||
elif [ "$NON_INTERACTIVE" = "1" ]; then
|
||||
STORAGE_PATH=$DEFAULT_MOUNT_STORAGE
|
||||
if [ "$DEPLOYMENT_TYPE" = "local" ]; then
|
||||
STORAGE_PATH=$DEFAULT_LOCAL_STORAGE
|
||||
else
|
||||
STORAGE_PATH=$DEFAULT_MOUNT_STORAGE
|
||||
fi
|
||||
else
|
||||
echo "1) 💾 ./storage (local)"
|
||||
echo "2) 🌐 /nfs/azerothcore (NFS)"
|
||||
@@ -930,6 +930,7 @@ fi
|
||||
esac
|
||||
done
|
||||
fi
|
||||
say INFO "Storage path set to ${STORAGE_PATH}"
|
||||
|
||||
# Backup
|
||||
say HEADER "BACKUP CONFIGURATION"
|
||||
@@ -954,7 +955,7 @@ fi
|
||||
|
||||
echo "Choose a server configuration preset:"
|
||||
|
||||
if [ -x "$SCRIPT_DIR/scripts/parse-config-presets.py" ] && [ -d "$config_dir" ]; then
|
||||
if [ -x "$SCRIPT_DIR/scripts/python/parse-config-presets.py" ] && [ -d "$config_dir" ]; then
|
||||
while IFS=$'\t' read -r preset_key preset_name preset_desc; do
|
||||
[ -n "$preset_key" ] || continue
|
||||
CONFIG_PRESET_NAMES["$preset_key"]="$preset_name"
|
||||
@@ -963,7 +964,7 @@ fi
|
||||
echo "$menu_index) $preset_name"
|
||||
echo " $preset_desc"
|
||||
menu_index=$((menu_index + 1))
|
||||
done < <(python3 "$SCRIPT_DIR/scripts/parse-config-presets.py" list --presets-dir "$config_dir")
|
||||
done < <(python3 "$SCRIPT_DIR/scripts/python/parse-config-presets.py" list --presets-dir "$config_dir")
|
||||
else
|
||||
# Fallback if parser script not available
|
||||
CONFIG_MENU_INDEX[1]="none"
|
||||
@@ -1565,7 +1566,7 @@ fi
|
||||
|
||||
{
|
||||
cat <<EOF
|
||||
# Generated by ac-compose/setup.sh
|
||||
# Generated by azerothcore-rm/setup.sh
|
||||
|
||||
# Compose overrides (set to 1 to include matching file under compose-overrides/)
|
||||
# mysql-expose.yml -> exposes MySQL externally via COMPOSE_OVERRIDE_MYSQL_EXPOSE_ENABLED
|
||||
|
||||
Reference in New Issue
Block a user