diff options
Diffstat (limited to 'apps/installer/includes')
| -rw-r--r-- | apps/installer/includes/config/config-main.sh | 9 | ||||
| -rw-r--r-- | apps/installer/includes/config/config.sh | 60 | ||||
| -rw-r--r-- | apps/installer/includes/functions.sh | 4 | ||||
| -rw-r--r-- | apps/installer/includes/includes.sh | 9 | ||||
| -rw-r--r-- | apps/installer/includes/modules-manager/README.md | 6 | ||||
| -rw-r--r-- | apps/installer/includes/modules-manager/modules.sh | 151 | ||||
| -rw-r--r-- | apps/installer/includes/os_configs/debian.sh | 4 | ||||
| -rw-r--r-- | apps/installer/includes/os_configs/ubuntu.sh | 6 | ||||
| -rw-r--r-- | apps/installer/includes/os_configs/windows.sh | 5 |
9 files changed, 182 insertions, 72 deletions
diff --git a/apps/installer/includes/config/config-main.sh b/apps/installer/includes/config/config-main.sh new file mode 100644 index 0000000000..f5f0c01f64 --- /dev/null +++ b/apps/installer/includes/config/config-main.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +CURRENT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" || exit ; pwd ) + +# shellcheck source=./config.sh +source "$CURRENT_PATH/config.sh" + +acore_dash_config "$@" + diff --git a/apps/installer/includes/config/config.sh b/apps/installer/includes/config/config.sh new file mode 100644 index 0000000000..40192c4008 --- /dev/null +++ b/apps/installer/includes/config/config.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash + +CURRENT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" || exit ; pwd ) + +# shellcheck source=../../../bash_shared/includes.sh +source "$CURRENT_PATH/../../../bash_shared/includes.sh" +# shellcheck source=../includes.sh +source "$CURRENT_PATH/../includes.sh" +# shellcheck source=../../../bash_shared/menu_system.sh +source "$AC_PATH_APPS/bash_shared/menu_system.sh" + +function acore_dash_configShowValue() { + if [ $# -ne 1 ]; then + echo "Usage: show <VAR_NAME>" + return 1 + fi + + local varName="$1" + local varValue="${!varName}" + if [ -z "$varValue" ]; then + echo "$varName is not set." + else + echo "$varName=$varValue" + fi +} + +function acore_dash_configLoad() { + acore_common_loadConfig + echo "Configuration loaded into the current shell session." +} + +# Configuration management menu definition +# Format: "key|short|description" +config_menu_items=( + "show|s|Show configuration variable value" + "load|l|Load configurations variables within the current shell session" + "help|h|Show detailed help" + "quit|q|Close this menu" +) + +# Menu command handler for configuration operations +function handle_config_command() { + local key="$1" + shift + + case "$key" in + "show") + acore_dash_configShowValue "$@" + ;; + "load") + acore_dash_configLoad + ;; + esac +} + +function acore_dash_config() { + menu_run_with_items "CONFIG MANAGER" handle_config_command -- "${config_menu_items[@]}" -- "$@" + return $? +} + diff --git a/apps/installer/includes/functions.sh b/apps/installer/includes/functions.sh index 9dbe2652c1..3c9b2edba2 100644 --- a/apps/installer/includes/functions.sh +++ b/apps/installer/includes/functions.sh @@ -155,7 +155,7 @@ function inst_simple_restarter { function inst_download_client_data { # change the following version when needed - local VERSION=v16 + local VERSION=v18.0 echo "#######################" echo "Client data downloader" @@ -183,3 +183,5 @@ function inst_download_client_data { && echo "Remove downloaded file" && rm "$zipPath" \ && echo "INSTALLED_VERSION=$VERSION" > "$dataVersionFile" } + + diff --git a/apps/installer/includes/includes.sh b/apps/installer/includes/includes.sh index c0d6bb8bd6..e4c1b9f2b5 100644 --- a/apps/installer/includes/includes.sh +++ b/apps/installer/includes/includes.sh @@ -2,6 +2,7 @@ CURRENT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd ) +# shellcheck source=../../bash_shared/includes.sh source "$CURRENT_PATH/../../bash_shared/includes.sh" AC_PATH_INSTALLER="$AC_PATH_APPS/installer" @@ -9,14 +10,14 @@ AC_PATH_INSTALLER="$AC_PATH_APPS/installer" J_PATH="$AC_PATH_DEPS/acore/joiner" J_PATH_MODULES="$AC_PATH_MODULES" +# shellcheck source=../../../deps/acore/joiner/joiner.sh source "$J_PATH/joiner.sh" -if [ -f "$AC_PATH_INSTALLER/config.sh" ]; then - source "$AC_PATH_INSTALLER/config.sh" # should overwrite previous -fi - +# shellcheck source=../../compiler/includes/includes.sh source "$AC_PATH_APPS/compiler/includes/includes.sh" +# shellcheck source=../../../deps/semver_bash/semver.sh source "$AC_PATH_DEPS/semver_bash/semver.sh" +# shellcheck source=../includes/functions.sh source "$AC_PATH_INSTALLER/includes/functions.sh" diff --git a/apps/installer/includes/modules-manager/README.md b/apps/installer/includes/modules-manager/README.md index 93496a91a6..d6a160b6c7 100644 --- a/apps/installer/includes/modules-manager/README.md +++ b/apps/installer/includes/modules-manager/README.md @@ -63,7 +63,7 @@ repo[:dirname][@branch[:commit]] ./acore.sh module install https://github.com/azerothcore/mod-transmog.git@main # Install multiple modules -./acore.sh module install mod-transmog mod-eluna:custom-eluna +./acore.sh module install mod-transmog mod-ale:custom-eluna # Install all modules from list ./acore.sh module install --all @@ -92,7 +92,7 @@ repo[:dirname][@branch[:commit]] ./acore.sh module remove https://github.com/azerothcore/mod-transmog.git # Remove multiple modules -./acore.sh module remove mod-transmog mod-eluna +./acore.sh module remove mod-transmog mod-ale ``` ### Searching Modules @@ -232,7 +232,7 @@ repo_reference branch commit # Examples: azerothcore/mod-transmog master abc123def456 https://github.com/custom/mod-custom.git develop def456abc789 -mod-eluna:custom-eluna-dir main 789abc123def +mod-ale:custom-eluna-dir main 789abc123def ``` The list maintains: diff --git a/apps/installer/includes/modules-manager/modules.sh b/apps/installer/includes/modules-manager/modules.sh index 787d07677c..89c7ea50ac 100644 --- a/apps/installer/includes/modules-manager/modules.sh +++ b/apps/installer/includes/modules-manager/modules.sh @@ -59,7 +59,6 @@ else C_GREEN='' C_YELLOW='' C_BLUE='' - C_MAGENTA='' C_CYAN='' fi @@ -127,10 +126,13 @@ function inst_module_help() { echo " ./acore.sh module # Interactive menu" echo " ./acore.sh module search [terms...]" echo " ./acore.sh module install [--all | modules...]" - echo " ./acore.sh module update [--all | modules...]" + echo " ./acore.sh module update [--discard-changes] [--all | modules...]" echo " ./acore.sh module remove [modules...]" echo " ./acore.sh module list # List installed modules" echo "" + echo "Options:" + echo " --discard-changes Reset module repositories to a clean state before updating" + echo "" echo "Module Specification Syntax:" echo " name # Simple name (e.g., mod-transmog)" echo " owner/name # GitHub repository" @@ -171,42 +173,8 @@ function inst_module_list() { # Usage: ./acore.sh module <search|install|update|remove> [args...] # ./acore.sh module # Interactive menu function inst_module() { - # If no arguments provided, start interactive menu - if [[ $# -eq 0 ]]; then - menu_run_with_items "MODULE MANAGER" handle_module_command -- "${module_menu_items[@]}" -- - return $? - fi - - # Normalize arguments into an array - local tokens=() - read -r -a tokens <<< "$*" - local cmd="${tokens[0]}" - local args=("${tokens[@]:1}") - - case "$cmd" in - ""|"help"|"-h"|"--help") - inst_module_help - ;; - "search"|"s") - inst_module_search "${args[@]}" - ;; - "install"|"i") - inst_module_install "${args[@]}" - ;; - "update"|"u") - inst_module_update "${args[@]}" - ;; - "remove"|"r") - inst_module_remove "${args[@]}" - ;; - "list"|"l") - inst_module_list "${args[@]}" - ;; - *) - print_error "Unknown module command: $cmd. Use 'help' to see available commands." - return 1 - ;; - esac + menu_run_with_items "MODULE MANAGER" handle_module_command -- "${module_menu_items[@]}" -- "$@" + return $? } # ============================================================================= @@ -602,6 +570,37 @@ function inst_mod_is_installed() { return 1 } +# Discard local changes from a module repository to guarantee a clean update. +function inst_module_reset_repo() { + local repo_ref="$1" + local dirname="$2" + local repo_path="$J_PATH_MODULES/$dirname" + + if [ ! -d "$repo_path" ]; then + print_error "[$repo_ref] Cannot discard changes; path not found ($repo_path)." + return 1 + fi + + if [ ! -d "$repo_path/.git" ]; then + print_error "[$repo_ref] Cannot discard changes; $repo_path is not a git repository." + return 1 + fi + + print_warn "[$repo_ref] Discarding local changes (--discard-changes)." + + if ! git -C "$repo_path" reset --hard >/dev/null 2>&1; then + print_error "[$repo_ref] Failed to reset repository at $repo_path." + return 1 + fi + + if ! git -C "$repo_path" clean -fd >/dev/null 2>&1; then + print_error "[$repo_ref] Failed to remove untracked files from $repo_path." + return 1 + fi + + return 0 +} + # ============================================================================= # Conflict Detection and Validation # ============================================================================= @@ -649,7 +648,7 @@ function inst_getVersionBranch() { res="none" # since we've the pair version,branch alternated in not associative and one-dimensional # array, we've to simulate the association with length/2 trick - for idx in `seq 0 $((${#vers[*]}/2-1))`; do + for idx in $(seq 0 $((${#vers[*]}/2-1))); do semverParseInto "${vers[idx*2]}" MODULE_MAJOR MODULE_MINOR MODULE_PATCH MODULE_SPECIAL if [[ $MODULE_MAJOR -eq $ACV_MAJOR && $MODULE_MINOR -le $ACV_MINOR ]]; then res="${vers[idx*2+1]}" @@ -901,31 +900,48 @@ function inst_module_install { # Update one or more modules function inst_module_update { - # Handle help request - if [[ "$1" == "--help" || "$1" == "-h" ]]; then - inst_module_help - return 0 - fi - - # Support multiple modules and the --all flag; prompt if none specified. - local args=("$@") + local modules=() local use_all=false - if [ ${#args[@]} -gt 0 ] && { [ "${args[0]}" = "--all" ] || [ "${args[0]}" = "-a" ]; }; then - use_all=true + local discard_changes=false + local had_errors=0 + + while [[ $# -gt 0 ]]; do + case "$1" in + --help|-h) + inst_module_help + return 0 + ;; + --all|-a) + use_all=true + ;; + --discard-changes|--reset|-r) + discard_changes=true + ;; + --) + shift || true + while [[ $# -gt 0 ]]; do + modules+=("$1") + shift || true + done + break + ;; + *) + modules+=("$1") + ;; + esac shift || true - fi - - local _tmp=$PWD + done if $use_all; then - local line repo_ref branch commit newCommit owner modname url dirname + local repo_ref branch commit owner modname url dirname newCommit + local parsed_output while read -r repo_ref branch commit; do [ -z "$repo_ref" ] && continue - # Skip excluded modules during update --all if inst_mod_is_excluded "$repo_ref"; then print_warn "[$repo_ref] Excluded by MODULES_EXCLUDE_LIST (skipping)." continue fi + parsed_output=$(inst_parse_module_spec "$repo_ref") IFS=' ' read -r _ owner modname _ _ url dirname <<< "$parsed_output" @@ -935,16 +951,23 @@ function inst_module_update { continue fi + if $discard_changes; then + if ! inst_module_reset_repo "$repo_ref" "$dirname"; then + had_errors=1 + continue + fi + fi + if Joiner:upd_repo "$url" "$dirname" "$branch" ""; then newCommit=$(git -C "$J_PATH_MODULES/$dirname" rev-parse HEAD 2>/dev/null || echo "") inst_mod_list_upsert "$repo_ref" "$branch" "$newCommit" print_success "[$repo_ref] Updated to latest commit on '$branch'." else print_error "[$repo_ref] Cannot update" + had_errors=1 fi done < <(inst_mod_list_read) else - local modules=("$@") if [ ${#modules[@]} -eq 0 ]; then echo "Type the name(s) of the module(s) to update" read -p "Insert name(s): " _line @@ -952,6 +975,7 @@ function inst_module_update { fi local spec repo_ref override_branch override_commit owner modname url dirname v b branch def newCommit + local parsed_output for spec in "${modules[@]}"; do [ -z "$spec" ] && continue parsed_output=$(inst_parse_module_spec "$spec") @@ -959,11 +983,10 @@ function inst_module_update { dirname="${dirname:-$modname}" if [ -d "$J_PATH_MODULES/$dirname/" ]; then - # determine preferred branch if not provided + b="" if [ -n "$override_branch" ] && [ "$override_branch" != "-" ]; then b="$override_branch" else - # try reading acore-module.json for this repo if [[ "$url" =~ github.com ]]; then read v b < <(inst_getVersionBranch "https://raw.githubusercontent.com/${owner}/${modname}/master/acore-module.json") else @@ -981,21 +1004,35 @@ function inst_module_update { fi fi + if $discard_changes; then + if ! inst_module_reset_repo "$repo_ref" "$dirname"; then + had_errors=1 + continue + fi + fi + if Joiner:upd_repo "$url" "$dirname" "$b" ""; then newCommit=$(git -C "$J_PATH_MODULES/$dirname" rev-parse HEAD 2>/dev/null || echo "") inst_mod_list_upsert "$repo_ref" "$b" "$newCommit" print_success "[$repo_ref] Done, please re-run compiling and db assembly" else print_error "[$repo_ref] Cannot update" + had_errors=1 fi else print_error "[$repo_ref] Cannot update! Path doesn't exist ($J_PATH_MODULES/$dirname/)" + had_errors=1 fi done fi echo "" echo "" + + if [ "$had_errors" -ne 0 ]; then + return 1 + fi + return 0 } # Remove one or more modules diff --git a/apps/installer/includes/os_configs/debian.sh b/apps/installer/includes/os_configs/debian.sh index 5bfc93f8f8..1aecbe3d26 100644 --- a/apps/installer/includes/os_configs/debian.sh +++ b/apps/installer/includes/os_configs/debian.sh @@ -32,7 +32,7 @@ $SUDO apt-get install -y gdbserver gdb unzip curl \ VAR_PATH="$CURRENT_PATH/../../../../var" # run noninteractive install for MYSQL 8.4 LTS -wget https://dev.mysql.com/get/mysql-apt-config_0.8.32-1_all.deb -P "$VAR_PATH" -DEBIAN_FRONTEND="noninteractive" $SUDO dpkg -i "$VAR_PATH/mysql-apt-config_0.8.32-1_all.deb" +wget https://dev.mysql.com/get/mysql-apt-config_0.8.35-1_all.deb -P "$VAR_PATH" +DEBIAN_FRONTEND="noninteractive" $SUDO dpkg -i "$VAR_PATH/mysql-apt-config_0.8.35-1_all.deb" $SUDO apt-get update DEBIAN_FRONTEND="noninteractive" $SUDO apt-get install -y mysql-server libmysqlclient-dev diff --git a/apps/installer/includes/os_configs/ubuntu.sh b/apps/installer/includes/os_configs/ubuntu.sh index cd3944fa6d..c2c84fff35 100644 --- a/apps/installer/includes/os_configs/ubuntu.sh +++ b/apps/installer/includes/os_configs/ubuntu.sh @@ -40,8 +40,10 @@ apt-get -y install ccache clang cmake curl google-perftools libmysqlclient-dev m # Do not install MySQL if we are in docker (It will be used a docker container instead) or we are explicitly skipping it. if [[ $DOCKER != 1 && $SKIP_MYSQL_INSTALL != 1 ]]; then # run noninteractive install for MYSQL 8.4 LTS - wget https://dev.mysql.com/get/mysql-apt-config_0.8.32-1_all.deb -P "$VAR_PATH" - DEBIAN_FRONTEND="noninteractive" $SUDO dpkg -i "$VAR_PATH/mysql-apt-config_0.8.32-1_all.deb" + wget https://dev.mysql.com/get/mysql-apt-config_0.8.35-1_all.deb -P "$VAR_PATH" + # resolve expired key issue + sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A8D3785C + DEBIAN_FRONTEND="noninteractive" $SUDO dpkg -i "$VAR_PATH/mysql-apt-config_0.8.35-1_all.deb" $SUDO apt-get update DEBIAN_FRONTEND="noninteractive" $SUDO apt-get install -y mysql-server fi diff --git a/apps/installer/includes/os_configs/windows.sh b/apps/installer/includes/os_configs/windows.sh index b99c2bfebf..cdba50c27f 100644 --- a/apps/installer/includes/os_configs/windows.sh +++ b/apps/installer/includes/os_configs/windows.sh @@ -24,7 +24,6 @@ fi choco install -y --skip-checksums "${INSTALL_ARGS[@]}" cmake.install -y --installargs 'ADD_CMAKE_TO_PATH=System' choco install -y --skip-checksums "${INSTALL_ARGS[@]}" visualstudio2022-workload-nativedesktop -choco install -y --skip-checksums "${INSTALL_ARGS[@]}" openssl --force --version=3.5.3 +choco install -y --skip-checksums "${INSTALL_ARGS[@]}" openssl --force --version=3.5.4 choco install -y --skip-checksums "${INSTALL_ARGS[@]}" boost-msvc-14.3 --force --version=1.87.0 -choco install -y --skip-checksums "${INSTALL_ARGS[@]}" mysql --force --version=8.4.4 - +choco install -y --skip-checksums "${INSTALL_ARGS[@]}" mysql --force --version=8.4.6 |
