Initial commit
This commit is contained in:
9
apps/installer/includes/config/config-main.sh
Normal file
9
apps/installer/includes/config/config-main.sh
Normal file
@@ -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 "$@"
|
||||
|
||||
60
apps/installer/includes/config/config.sh
Normal file
60
apps/installer/includes/config/config.sh
Normal file
@@ -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 $?
|
||||
}
|
||||
|
||||
187
apps/installer/includes/functions.sh
Normal file
187
apps/installer/includes/functions.sh
Normal file
@@ -0,0 +1,187 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Set SUDO variable - one liner
|
||||
if [[ "$OSTYPE" == "msys"* ]]; then
|
||||
SUDO=""
|
||||
else
|
||||
SUDO=$([ "$EUID" -ne 0 ] && echo "sudo" || echo "")
|
||||
fi
|
||||
|
||||
function inst_configureOS() {
|
||||
echo "Platform: $OSTYPE"
|
||||
case "$OSTYPE" in
|
||||
solaris*) echo "Solaris is not supported yet" ;;
|
||||
darwin*) source "$AC_PATH_INSTALLER/includes/os_configs/osx.sh" ;;
|
||||
linux*)
|
||||
# If $OSDISTRO is set, use this value (from config.sh)
|
||||
if [ ! -z "$OSDISTRO" ]; then
|
||||
DISTRO=$OSDISTRO
|
||||
# If available, use LSB to identify distribution
|
||||
elif command -v lsb_release >/dev/null 2>&1 ; then
|
||||
DISTRO=$(lsb_release -is)
|
||||
# Otherwise, use release info file
|
||||
else
|
||||
DISTRO=$(ls -d /etc/[A-Za-z]*[_-][rv]e[lr]* | grep -v "lsb" | cut -d'/' -f3 | cut -d'-' -f1 | cut -d'_' -f1)
|
||||
fi
|
||||
|
||||
case $DISTRO in
|
||||
# add here distro that are debian or ubuntu based
|
||||
# TODO: find a better way, maybe checking the existance
|
||||
# of a package manager
|
||||
"neon" | "ubuntu" | "Ubuntu")
|
||||
DISTRO="ubuntu"
|
||||
;;
|
||||
"debian" | "Debian")
|
||||
DISTRO="debian"
|
||||
;;
|
||||
*)
|
||||
echo "Distro: $DISTRO, is not supported. If your distribution is based on debian or ubuntu,
|
||||
please set the 'OSDISTRO' environment variable to one of these distro (you can use config.sh file)"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
DISTRO=${DISTRO,,}
|
||||
|
||||
echo "Distro: $DISTRO"
|
||||
|
||||
# TODO: implement different configurations by distro
|
||||
source "$AC_PATH_INSTALLER/includes/os_configs/$DISTRO.sh"
|
||||
;;
|
||||
*bsd*) echo "BSD is not supported yet" ;;
|
||||
msys*) source "$AC_PATH_INSTALLER/includes/os_configs/windows.sh" ;;
|
||||
*) echo "This platform is not supported" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Use the data/sql/create/create_mysql.sql to initialize the database
|
||||
function inst_dbCreate() {
|
||||
echo "Creating database..."
|
||||
|
||||
# Attempt to connect with MYSQL_ROOT_PASSWORD
|
||||
if [ ! -z "$MYSQL_ROOT_PASSWORD" ]; then
|
||||
if $SUDO mysql -u root -p"$MYSQL_ROOT_PASSWORD" < "$AC_PATH_ROOT/data/sql/create/create_mysql.sql" 2>/dev/null; then
|
||||
echo "Database created successfully."
|
||||
return 0
|
||||
else
|
||||
echo "Failed to connect with provided password, falling back to interactive mode..."
|
||||
fi
|
||||
fi
|
||||
|
||||
# In CI environments or when no password is set, try without password first
|
||||
if [[ "$CONTINUOUS_INTEGRATION" == "true" ]]; then
|
||||
echo "CI environment detected, attempting connection without password..."
|
||||
|
||||
if $SUDO mysql -u root < "$AC_PATH_ROOT/data/sql/create/create_mysql.sql" 2>/dev/null; then
|
||||
echo "Database created successfully."
|
||||
return 0
|
||||
else
|
||||
echo "Failed to connect without password, falling back to interactive mode..."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Try with password (interactive mode)
|
||||
echo "Please enter your sudo and your MySQL root password if prompted."
|
||||
$SUDO mysql -u root -p < "$AC_PATH_ROOT/data/sql/create/create_mysql.sql"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Database creation failed. Please check your MySQL server and credentials."
|
||||
exit 1
|
||||
fi
|
||||
echo "Database created successfully."
|
||||
}
|
||||
|
||||
function inst_updateRepo() {
|
||||
cd "$AC_PATH_ROOT"
|
||||
if [ ! -z $INSTALLER_PULL_FROM ]; then
|
||||
git pull "$ORIGIN_REMOTE" "$INSTALLER_PULL_FROM"
|
||||
else
|
||||
git pull "$ORIGIN_REMOTE" $(git rev-parse --abbrev-ref HEAD)
|
||||
fi
|
||||
}
|
||||
|
||||
function inst_resetRepo() {
|
||||
cd "$AC_PATH_ROOT"
|
||||
git reset --hard $(git rev-parse --abbrev-ref HEAD)
|
||||
git clean -f
|
||||
}
|
||||
|
||||
function inst_compile() {
|
||||
comp_configure
|
||||
comp_build
|
||||
}
|
||||
|
||||
function inst_cleanCompile() {
|
||||
comp_clean
|
||||
inst_compile
|
||||
}
|
||||
|
||||
function inst_allInOne() {
|
||||
inst_configureOS
|
||||
inst_compile
|
||||
inst_dbCreate
|
||||
inst_download_client_data
|
||||
}
|
||||
|
||||
############################################################
|
||||
# Module helpers and dispatcher #
|
||||
############################################################
|
||||
|
||||
# Returns the default branch name of a GitHub repo in the azerothcore org.
|
||||
# If the API call fails, defaults to "master".
|
||||
function inst_get_default_branch() {
|
||||
local repo="$1"
|
||||
local def
|
||||
def=$(curl --silent "https://api.github.com/repos/azerothcore/${repo}" \
|
||||
| "$AC_PATH_DEPS/jsonpath/JSONPath.sh" -b '$.default_branch')
|
||||
if [ -z "$def" ]; then
|
||||
def="master"
|
||||
fi
|
||||
echo "$def"
|
||||
}
|
||||
|
||||
# =============================================================================
|
||||
# Module Management System
|
||||
# =============================================================================
|
||||
# Load the module manager functions from the dedicated modules-manager directory
|
||||
source "$AC_PATH_INSTALLER/includes/modules-manager/modules.sh"
|
||||
|
||||
function inst_simple_restarter {
|
||||
echo "Running $1 ..."
|
||||
bash "$AC_PATH_APPS/startup-scripts/src/simple-restarter" "$AC_BINPATH_FULL" "$1"
|
||||
echo
|
||||
#disown -a
|
||||
#jobs -l
|
||||
}
|
||||
|
||||
function inst_download_client_data {
|
||||
# change the following version when needed
|
||||
local VERSION=v19
|
||||
|
||||
echo "#######################"
|
||||
echo "Client data downloader"
|
||||
echo "#######################"
|
||||
|
||||
# first check if it's defined in env, otherwise use the default
|
||||
local path="${DATAPATH:-$AC_BINPATH_FULL}"
|
||||
local zipPath="${DATAPATH_ZIP:-"$path/data.zip"}"
|
||||
|
||||
dataVersionFile="$path/data-version"
|
||||
|
||||
[ -f "$dataVersionFile" ] && source "$dataVersionFile"
|
||||
|
||||
# create the path if doesn't exists
|
||||
mkdir -p "$path"
|
||||
|
||||
if [ "$VERSION" == "$INSTALLED_VERSION" ]; then
|
||||
echo "Data $VERSION already installed. If you want to force the download remove the following file: $dataVersionFile"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "Downloading client data in: $zipPath ..."
|
||||
curl -L https://github.com/wowgaming/client-data/releases/download/$VERSION/data.zip > "$zipPath" \
|
||||
&& echo "unzip downloaded file in $path..." && unzip -q -o "$zipPath" -d "$path/" \
|
||||
&& echo "Remove downloaded file" && rm "$zipPath" \
|
||||
&& echo "INSTALLED_VERSION=$VERSION" > "$dataVersionFile"
|
||||
}
|
||||
|
||||
|
||||
23
apps/installer/includes/includes.sh
Normal file
23
apps/installer/includes/includes.sh
Normal file
@@ -0,0 +1,23 @@
|
||||
[[ ${INSTALLER_GUARDYVAR:-} -eq 1 ]] && return || readonly INSTALLER_GUARDYVAR=1 # include it once
|
||||
|
||||
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"
|
||||
|
||||
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"
|
||||
|
||||
# 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"
|
||||
311
apps/installer/includes/modules-manager/README.md
Normal file
311
apps/installer/includes/modules-manager/README.md
Normal file
@@ -0,0 +1,311 @@
|
||||
# AzerothCore Module Manager
|
||||
|
||||
This directory contains the module management system for AzerothCore, providing advanced functionality for installing, updating, and managing server modules.
|
||||
|
||||
## 🚀 Features
|
||||
|
||||
- **Advanced Syntax**: Support for `repo[:dirname][@branch[:commit]]` format
|
||||
- **Cross-Format Recognition**: Intelligent matching across URLs, SSH, and simple names
|
||||
- **Custom Directory Naming**: Prevent conflicts with custom directory names
|
||||
- **Duplicate Prevention**: Smart detection and prevention of duplicate installations
|
||||
- **Multi-Host Support**: GitHub, GitLab, and other Git hosts
|
||||
- **Module Exclusion**: Support for excluding modules via environment variable
|
||||
- **Interactive Menu System**: Easy-to-use menu interface for module management
|
||||
- **Colored Output**: Enhanced terminal output with color support (respects NO_COLOR)
|
||||
- **Flat Directory Structure**: Uses flat module installation (no owner subfolders)
|
||||
|
||||
## 📁 File Structure
|
||||
|
||||
```
|
||||
modules-manager/
|
||||
├── modules.sh # Core module management functions
|
||||
└── README.md # This documentation file
|
||||
```
|
||||
|
||||
## 🔧 Module Specification Syntax
|
||||
|
||||
The module manager supports flexible syntax for specifying modules:
|
||||
|
||||
### New Syntax Format
|
||||
```bash
|
||||
repo[:dirname][@branch[:commit]]
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
| Specification | Description |
|
||||
|---------------|-------------|
|
||||
| `mod-transmog` | Simple module name, uses default branch and directory |
|
||||
| `mod-transmog:my-custom-dir` | Custom directory name |
|
||||
| `mod-transmog@develop` | Specific branch |
|
||||
| `mod-transmog:custom@develop:abc123` | Custom directory, branch, and commit |
|
||||
| `https://github.com/owner/repo.git@main` | Full URL with branch |
|
||||
| `git@github.com:owner/repo.git:custom-dir` | SSH URL with custom directory |
|
||||
|
||||
## 🎯 Usage Examples
|
||||
|
||||
### Installing Modules
|
||||
|
||||
```bash
|
||||
# Simple module installation
|
||||
./acore.sh module install mod-transmog
|
||||
|
||||
# Install with custom directory name
|
||||
./acore.sh module install mod-transmog:my-transmog-dir
|
||||
|
||||
# Install specific branch
|
||||
./acore.sh module install mod-transmog@develop
|
||||
|
||||
# Install with full specification
|
||||
./acore.sh module install mod-transmog:custom-dir@develop:abc123
|
||||
|
||||
# Install from URL
|
||||
./acore.sh module install https://github.com/azerothcore/mod-transmog.git@main
|
||||
|
||||
# Install multiple modules
|
||||
./acore.sh module install mod-transmog mod-ale:custom-eluna
|
||||
|
||||
# Install all modules from list
|
||||
./acore.sh module install --all
|
||||
```
|
||||
|
||||
### Updating Modules
|
||||
|
||||
```bash
|
||||
# Update specific module
|
||||
./acore.sh module update mod-transmog
|
||||
|
||||
# Update all modules
|
||||
./acore.sh module update --all
|
||||
|
||||
# Update with branch specification
|
||||
./acore.sh module update mod-transmog@develop
|
||||
```
|
||||
|
||||
### Removing Modules
|
||||
|
||||
```bash
|
||||
# Remove by simple name (cross-format recognition)
|
||||
./acore.sh module remove mod-transmog
|
||||
|
||||
# Remove by URL (recognizes same module)
|
||||
./acore.sh module remove https://github.com/azerothcore/mod-transmog.git
|
||||
|
||||
# Remove multiple modules
|
||||
./acore.sh module remove mod-transmog mod-ale
|
||||
```
|
||||
|
||||
### Searching Modules
|
||||
|
||||
```bash
|
||||
# Search for modules
|
||||
./acore.sh module search transmog
|
||||
|
||||
# Search with multiple terms
|
||||
./acore.sh module search auction house
|
||||
|
||||
# Search with input prompt
|
||||
./acore.sh module search
|
||||
```
|
||||
|
||||
### Listing Installed Modules
|
||||
|
||||
```bash
|
||||
# List all installed modules
|
||||
./acore.sh module list
|
||||
```
|
||||
|
||||
### Interactive Menu
|
||||
|
||||
```bash
|
||||
# Start interactive menu system
|
||||
./acore.sh module
|
||||
|
||||
# Menu options:
|
||||
# s - Search for available modules
|
||||
# i - Install one or more modules
|
||||
# u - Update installed modules
|
||||
# r - Remove installed modules
|
||||
# l - List installed modules
|
||||
# h - Show detailed help
|
||||
# q - Close this menu
|
||||
```
|
||||
|
||||
## 🔍 Cross-Format Recognition
|
||||
|
||||
The system intelligently recognizes the same module across different specification formats:
|
||||
|
||||
```bash
|
||||
# These all refer to the same module:
|
||||
mod-transmog
|
||||
azerothcore/mod-transmog
|
||||
https://github.com/azerothcore/mod-transmog.git
|
||||
git@github.com:azerothcore/mod-transmog.git
|
||||
```
|
||||
|
||||
This allows:
|
||||
- Installing with one format and removing with another
|
||||
- Preventing duplicates regardless of specification format
|
||||
- Consistent module tracking across different input methods
|
||||
|
||||
## 🛡️ Conflict Prevention
|
||||
|
||||
The system prevents common conflicts:
|
||||
|
||||
### Directory Conflicts
|
||||
```bash
|
||||
# If 'mod-transmog' directory already exists:
|
||||
$ ./acore.sh module install mod-transmog:mod-transmog
|
||||
Possible solutions:
|
||||
1. Use a different directory name: mod-transmog:my-custom-name
|
||||
2. Remove the existing directory first
|
||||
3. Use the update command if this is the same module
|
||||
```
|
||||
|
||||
### Duplicate Module Prevention
|
||||
The system uses intelligent owner/name matching to prevent installing the same module multiple times, even when specified in different formats.
|
||||
|
||||
## 🚫 Module Exclusion
|
||||
|
||||
You can exclude modules from installation using the `MODULES_EXCLUDE_LIST` environment variable:
|
||||
|
||||
```bash
|
||||
# Exclude specific modules (space-separated)
|
||||
export MODULES_EXCLUDE_LIST="mod-test-module azerothcore/mod-dev-only"
|
||||
./acore.sh module install --all # Will skip excluded modules
|
||||
|
||||
# Supports cross-format matching
|
||||
export MODULES_EXCLUDE_LIST="https://github.com/azerothcore/mod-transmog.git"
|
||||
./acore.sh module install mod-transmog # Will be skipped as excluded
|
||||
```
|
||||
|
||||
The exclusion system:
|
||||
- Uses the same cross-format recognition as other module operations
|
||||
- Works with all installation methods (`install`, `install --all`)
|
||||
- Provides clear feedback when modules are skipped
|
||||
- Supports URLs, owner/name format, and simple names
|
||||
|
||||
## 🎨 Color Support
|
||||
|
||||
The module manager provides enhanced terminal output with colors:
|
||||
|
||||
- **Info**: Cyan text for informational messages
|
||||
- **Success**: Green text for successful operations
|
||||
- **Warning**: Yellow text for warnings
|
||||
- **Error**: Red text for errors
|
||||
- **Headers**: Bold cyan text for section headers
|
||||
|
||||
Color support is automatically disabled when:
|
||||
- Output is not to a terminal (piped/redirected)
|
||||
- `NO_COLOR` environment variable is set
|
||||
- Terminal doesn't support colors
|
||||
|
||||
You can force color output with:
|
||||
```bash
|
||||
export FORCE_COLOR=1
|
||||
```
|
||||
|
||||
## 🔄 Integration
|
||||
|
||||
### Including in Scripts
|
||||
```bash
|
||||
# Source the module functions
|
||||
source "$AC_PATH_INSTALLER/includes/modules-manager/modules.sh"
|
||||
|
||||
# Use module functions
|
||||
inst_module_install "mod-transmog:custom-dir@develop"
|
||||
```
|
||||
|
||||
### Testing
|
||||
The module system is tested through the main installer test suite:
|
||||
```bash
|
||||
./apps/installer/test/test_module_commands.bats
|
||||
```
|
||||
|
||||
## 📋 Module List Format
|
||||
|
||||
Modules are tracked in `conf/modules.list` with the format:
|
||||
```
|
||||
# Comments start with #
|
||||
repo_reference branch commit
|
||||
|
||||
# Examples:
|
||||
azerothcore/mod-transmog master abc123def456
|
||||
https://github.com/custom/mod-custom.git develop def456abc789
|
||||
mod-ale:custom-eluna-dir main 789abc123def
|
||||
```
|
||||
|
||||
The list maintains:
|
||||
- **Alphabetical ordering** by normalized owner/name for consistency
|
||||
- **Original format preservation** of how modules were specified
|
||||
- **Automatic deduplication** across different specification formats
|
||||
- **Custom directory tracking** when specified
|
||||
|
||||
## 🔧 Configuration
|
||||
|
||||
### Environment Variables
|
||||
|
||||
| Variable | Description | Default |
|
||||
|----------|-------------|---------|
|
||||
| `MODULES_LIST_FILE` | Override default modules list path | `$AC_PATH_ROOT/conf/modules.list` |
|
||||
| `MODULES_EXCLUDE_LIST` | Space-separated list of modules to exclude | - |
|
||||
| `J_PATH_MODULES` | Modules installation directory | `$AC_PATH_ROOT/modules` |
|
||||
| `AC_PATH_ROOT` | AzerothCore root path | - |
|
||||
| `NO_COLOR` | Disable colored output | - |
|
||||
| `FORCE_COLOR` | Force colored output even when not TTY | - |
|
||||
|
||||
### Default Paths
|
||||
- **Modules list**: `$AC_PATH_ROOT/conf/modules.list`
|
||||
- **Installation directory**: `$J_PATH_MODULES` (flat structure, no owner subfolders)
|
||||
|
||||
## 🏗️ Architecture
|
||||
|
||||
### Core Functions
|
||||
|
||||
| Function | Purpose |
|
||||
|----------|---------|
|
||||
| `inst_module()` | Main dispatcher and interactive menu |
|
||||
| `inst_parse_module_spec()` | Parse advanced module syntax |
|
||||
| `inst_extract_owner_name()` | Normalize modules for cross-format recognition |
|
||||
| `inst_mod_list_*()` | Module list management (read/write/update) |
|
||||
| `inst_module_*()` | Module operations (install/update/remove/search) |
|
||||
|
||||
### Key Features
|
||||
|
||||
- **Flat Directory Structure**: All modules install directly under `modules/` without owner subdirectories
|
||||
- **Smart Conflict Detection**: Prevents directory name conflicts with helpful suggestions
|
||||
- **Cross-Platform Compatibility**: Works on Linux, macOS, and Windows (Git Bash)
|
||||
- **Version Compatibility**: Checks `acore-module.json` for AzerothCore version compatibility
|
||||
- **Git Integration**: Uses Joiner system for Git repository management
|
||||
|
||||
### Debug Mode
|
||||
|
||||
For debugging module operations, you can examine the generated commands:
|
||||
```bash
|
||||
# Check what Joiner commands would be executed
|
||||
tail -f /tmp/joiner_called.txt # In test environments
|
||||
```
|
||||
|
||||
## 🤝 Contributing
|
||||
|
||||
When modifying the module manager:
|
||||
|
||||
1. **Maintain backwards compatibility** with existing module list format
|
||||
2. **Update tests** in `test_module_commands.bats` for new functionality
|
||||
3. **Update this documentation** for any new features or changes
|
||||
4. **Test cross-format recognition** thoroughly across all supported formats
|
||||
5. **Ensure helpful error messages** for common user mistakes
|
||||
6. **Test exclusion functionality** with various module specification formats
|
||||
7. **Verify color output** works correctly in different terminal environments
|
||||
|
||||
### Testing Guidelines
|
||||
|
||||
```bash
|
||||
# Run all module-related tests
|
||||
cd apps/installer
|
||||
bats test/test_module_commands.bats
|
||||
|
||||
# Test with different environments
|
||||
NO_COLOR=1 ./acore.sh module list
|
||||
FORCE_COLOR=1 ./acore.sh module help
|
||||
```
|
||||
7
apps/installer/includes/modules-manager/module-main.sh
Normal file
7
apps/installer/includes/modules-manager/module-main.sh
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CURRENT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" || exit ; pwd )
|
||||
|
||||
source "$CURRENT_PATH/modules.sh"
|
||||
|
||||
inst_module "$@"
|
||||
1066
apps/installer/includes/modules-manager/modules.sh
Normal file
1066
apps/installer/includes/modules-manager/modules.sh
Normal file
File diff suppressed because it is too large
Load Diff
46
apps/installer/includes/os_configs/debian.sh
Normal file
46
apps/installer/includes/os_configs/debian.sh
Normal file
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
# Set SUDO variable - one liner
|
||||
SUDO=$([ "$EUID" -ne 0 ] && echo "sudo" || echo "")
|
||||
|
||||
if ! command -v lsb_release &>/dev/null ; then
|
||||
$SUDO apt-get install -y lsb-release
|
||||
fi
|
||||
|
||||
DEBIAN_VERSION=$(lsb_release -sr)
|
||||
DEBIAN_VERSION_MIN="12"
|
||||
|
||||
if [[ $DEBIAN_VERSION -lt $DEBIAN_VERSION_MIN ]]; then
|
||||
echo "########## ########## ##########"
|
||||
echo ""
|
||||
echo " using unsupported Debian version" $DEBIAN_VERSION
|
||||
echo " please update to Debian" $DEBIAN_VERSION_MIN "or later"
|
||||
echo ""
|
||||
echo "########## ########## ##########"
|
||||
fi
|
||||
|
||||
$SUDO apt-get update -y
|
||||
|
||||
$SUDO apt-get install -y gdbserver gdb unzip curl \
|
||||
libncurses-dev libreadline-dev clang g++ \
|
||||
gcc git cmake make ccache \
|
||||
libssl-dev libbz2-dev \
|
||||
libboost-all-dev gnupg wget jq screen tmux expect
|
||||
|
||||
VAR_PATH="$CURRENT_PATH/../../../../var"
|
||||
|
||||
# run noninteractive install for MYSQL
|
||||
# Version
|
||||
MYSQL_APT_CONFIG_VERSION=0.8.36-1
|
||||
# # # # #
|
||||
mkdir -p "$VAR_PATH/mysqlpackages" && cd "$VAR_PATH/mysqlpackages"
|
||||
# Download
|
||||
wget "https://dev.mysql.com/get/mysql-apt-config_${MYSQL_APT_CONFIG_VERSION}_all.deb"
|
||||
# Install
|
||||
sudo DEBIAN_FRONTEND="noninteractive" dpkg -i ./mysql-apt-config_${MYSQL_APT_CONFIG_VERSION}_all.deb
|
||||
sudo apt update
|
||||
sudo DEBIAN_FRONTEND="noninteractive" apt install -y mysql-server libmysqlclient-dev
|
||||
# Cleanup
|
||||
rm -v mysql-apt-config_${MYSQL_APT_CONFIG_VERSION}_all* && unset MYSQL_APT_CONFIG_VERSION
|
||||
34
apps/installer/includes/os_configs/osx.sh
Normal file
34
apps/installer/includes/os_configs/osx.sh
Normal file
@@ -0,0 +1,34 @@
|
||||
##########################################
|
||||
## workaround for python upgrade issue https://github.com/actions/runner-images/issues/6817
|
||||
rm /usr/local/bin/2to3 || true
|
||||
rm /usr/local/bin/2to3-3.10 || true
|
||||
rm /usr/local/bin/2to3-3.11 || true
|
||||
rm /usr/local/bin/2to3-3.12 || true
|
||||
rm /usr/local/bin/idle3 || true
|
||||
rm /usr/local/bin/idle3.10 || true
|
||||
rm /usr/local/bin/idle3.11 || true
|
||||
rm /usr/local/bin/idle3.12 || true
|
||||
rm /usr/local/bin/pydoc3 || true
|
||||
rm /usr/local/bin/pydoc3.10 || true
|
||||
rm /usr/local/bin/pydoc3.11 || true
|
||||
rm /usr/local/bin/pydoc3.12 || true
|
||||
rm /usr/local/bin/python3 || true
|
||||
rm /usr/local/bin/python3.10 || true
|
||||
rm /usr/local/bin/python3.11 || true
|
||||
rm /usr/local/bin/python3.12 || true
|
||||
rm /usr/local/bin/python3-config || true
|
||||
rm /usr/local/bin/python3.10-config || true
|
||||
rm /usr/local/bin/python3.11-config || true
|
||||
rm /usr/local/bin/python3.12-config || true
|
||||
##########################################
|
||||
|
||||
brew update
|
||||
|
||||
##########################################
|
||||
## workaround for cmake already being installed in the github runners
|
||||
if ! command -v cmake &>/dev/null ; then
|
||||
brew install cmake
|
||||
fi
|
||||
##########################################
|
||||
|
||||
brew install openssl@3 readline boost bash-completion curl unzip mysql ccache expect tmux screen jq
|
||||
56
apps/installer/includes/os_configs/ubuntu.sh
Normal file
56
apps/installer/includes/os_configs/ubuntu.sh
Normal file
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
# Set SUDO variable - one liner
|
||||
SUDO=$([ "$EUID" -ne 0 ] && echo "sudo" || echo "")
|
||||
|
||||
if ! command -v lsb_release &>/dev/null ; then
|
||||
$SUDO apt-get install -y lsb-release
|
||||
fi
|
||||
|
||||
UBUNTU_VERSION=$(lsb_release -sr);
|
||||
|
||||
case $UBUNTU_VERSION in
|
||||
"22.04")
|
||||
;;
|
||||
"24.04")
|
||||
;;
|
||||
*)
|
||||
echo "########## ########## ##########"
|
||||
echo ""
|
||||
echo " using unsupported Ubuntu version " $UBUNTU_VERSION
|
||||
echo " please update to Ubuntu 22.04 or later"
|
||||
echo ""
|
||||
echo "########## ########## ##########"
|
||||
;;
|
||||
esac
|
||||
|
||||
$SUDO apt update
|
||||
|
||||
# shared deps
|
||||
DEBIAN_FRONTEND="noninteractive" $SUDO \
|
||||
apt-get -y install ccache clang cmake curl google-perftools libmysqlclient-dev make unzip jq screen tmux \
|
||||
libreadline-dev libncurses5-dev libncursesw5-dev libbz2-dev git gcc g++ libssl-dev \
|
||||
libncurses-dev libboost-all-dev gdb gdbserver expect
|
||||
|
||||
VAR_PATH="$CURRENT_PATH/../../../../var"
|
||||
|
||||
|
||||
# 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.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
|
||||
|
||||
|
||||
if [[ $CONTINUOUS_INTEGRATION ]]; then
|
||||
$SUDO systemctl enable mysql.service
|
||||
$SUDO systemctl start mysql.service
|
||||
fi
|
||||
|
||||
29
apps/installer/includes/os_configs/windows.sh
Normal file
29
apps/installer/includes/os_configs/windows.sh
Normal file
@@ -0,0 +1,29 @@
|
||||
# install chocolatey before
|
||||
|
||||
# powershell.exe -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
|
||||
|
||||
# install automatically following packages:
|
||||
# cmake
|
||||
# git
|
||||
# microsoft-build-tools
|
||||
# mysql
|
||||
|
||||
INSTALL_ARGS=()
|
||||
|
||||
if [[ $CONTINUOUS_INTEGRATION ]]; then
|
||||
INSTALL_ARGS+=(--no-progress)
|
||||
else
|
||||
{ # try
|
||||
choco uninstall -y -n cmake.install cmake # needed to make sure that following install set the env properly
|
||||
} || { # catch
|
||||
echo "nothing to do"
|
||||
}
|
||||
|
||||
choco install -y --skip-checksums "${INSTALL_ARGS[@]}" git visualstudio2022community
|
||||
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.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.6
|
||||
Reference in New Issue
Block a user