missing char
Some checks failed
Bump build.func Revision / bump-revision (push) Has been cancelled

This commit is contained in:
CanbiZ 2025-10-16 23:00:40 +02:00
parent 26ec62beee
commit 5605449dfd

View File

@ -36,14 +36,14 @@ echo -e "Log file: ${TEST_LOG}\n"
# Source tools.func from repository # Source tools.func from repository
echo -e "${BLUE}► Sourcing tools.func from repository...${NC}" echo -e "${BLUE}► Sourcing tools.func from repository...${NC}"
if ! source <(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/tools.func); then if ! source <(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/tools.func); then
echo -e "${RED}✖ Failed to source tools.func${NC}" echo -e "${RED}✖ Failed to source tools.func${NC}"
exit 1 exit 1
fi fi
echo -e "${GREEN}✔ tools.func loaded${NC}\n" echo -e "${GREEN}✔ tools.func loaded${NC}\n"
# Source core functions if available # Source core functions if available
if curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/core.func &>/dev/null; then if curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/core.func &>/dev/null; then
source <(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/core.func) || true source <(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/core.func) || true
fi fi
# Override STD to show all output for debugging # Override STD to show all output for debugging
@ -70,93 +70,92 @@ CL="${CL:-${NC}}"
# Reload environment helper # Reload environment helper
reload_path() { reload_path() {
export PATH="/usr/local/bin:/usr/local/go/bin:/root/.cargo/bin:/root/.rbenv/bin:/root/.rbenv/shims:/opt/java/bin:$PATH" export PATH="/usr/local/bin:/usr/local/go/bin:/root/.cargo/bin:/root/.rbenv/bin:/root/.rbenv/shims:/opt/java/bin:$PATH"
# Source profile files if they exist # Source profile files if they exist
[ -f "/root/.bashrc" ] && source /root/.bashrc 2>/dev/null || true [ -f "/root/.bashrc" ] && source /root/.bashrc 2>/dev/null || true
[ -f "/root/.profile" ] && source /root/.profile 2>/dev/null || true [ -f "/root/.profile" ] && source /root/.profile 2>/dev/null || true
[ -f "/root/.cargo/env" ] && source /root/.cargo/env 2>/dev/null || true [ -f "/root/.cargo/env" ] && source /root/.cargo/env 2>/dev/null || true
} }
# Clean up before test to avoid interactive prompts and locks # Clean up before test to avoid interactive prompts and locks
cleanup_before_test() { cleanup_before_test() {
# Kill any hanging apt processes # Kill any hanging apt processes
killall apt-get apt 2>/dev/null || true killall apt-get apt 2>/dev/null || true
# Remove apt locks # Remove apt locks
rm -f /var/lib/dpkg/lock-frontend /var/lib/dpkg/lock /var/cache/apt/archives/lock 2>/dev/null || true rm -f /var/lib/dpkg/lock-frontend /var/lib/dpkg/lock /var/cache/apt/archives/lock 2>/dev/null || true
# Remove existing keyrings to avoid overwrite prompts # Remove existing keyrings to avoid overwrite prompts
rm -f /etc/apt/keyrings/*.gpg 2>/dev/null || true rm -f /etc/apt/keyrings/*.gpg 2>/dev/null || true
# Wait a moment for processes to clean up # Wait a moment for processes to clean up
sleep 1 sleep 1
}
[ -f "/root/.profile" ] && source /root/.profile 2>/dev/null || true
[ -f "/root/.cargo/env" ] && source /root/.cargo/env 2>/dev/null || true
} }
[ -f "/root/.profile" ] && source /root/.profile 2>/dev/null || true
[ -f "/root/.cargo/env" ] && source /root/.cargo/env 2>/dev/null || true
# Test validation function # Test validation function
test_function() { test_function() {
local test_name="$1" local test_name="$1"
local test_command="$2" local test_command="$2"
local validation_cmd="${3:-}" local validation_cmd="${3:-}"
# Clean up before starting test # Clean up before starting test
cleanup_before_test cleanup_before_test
echo -e "\n${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}" echo -e "\n${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${CYAN}Testing: ${test_name}${NC}" echo -e "${CYAN}Testing: ${test_name}${NC}"
echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}" echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
{ {
echo "=== Test: ${test_name} ===" echo "=== Test: ${test_name} ==="
echo "Command: ${test_command}" echo "Command: ${test_command}"
echo "Started: $(date)" echo "Started: $(date)"
} | tee -a "$TEST_LOG" } | tee -a "$TEST_LOG"
# Execute installation with output visible AND logged # Execute installation with output visible AND logged
if eval "$test_command" 2>&1 | tee -a "$TEST_LOG"; then if eval "$test_command" 2>&1 | tee -a "$TEST_LOG"; then
# Reload PATH after installation # Reload PATH after installation
reload_path reload_path
if [[ -n "$validation_cmd" ]]; then if [[ -n "$validation_cmd" ]]; then
local output local output
if output=$(bash -c "$validation_cmd" 2>&1); then if output=$(bash -c "$validation_cmd" 2>&1); then
msg_ok "${test_name} - $(echo "$output" | head -n1)" msg_ok "${test_name} - $(echo "$output" | head -n1)"
((TESTS_PASSED++)) ((TESTS_PASSED++))
else else
msg_error "${test_name} - Installation succeeded but validation failed" msg_error "${test_name} - Installation succeeded but validation failed"
{ {
echo "Validation command: $validation_cmd" echo "Validation command: $validation_cmd"
echo "Validation output: $output" echo "Validation output: $output"
echo "PATH: $PATH" echo "PATH: $PATH"
} | tee -a "$TEST_LOG" } | tee -a "$TEST_LOG"
((TESTS_FAILED++))
fi
else
msg_ok "${test_name}"
((TESTS_PASSED++))
fi
else
msg_error "${test_name} - Installation failed"
echo "Installation failed" | tee -a "$TEST_LOG"
((TESTS_FAILED++)) ((TESTS_FAILED++))
fi
else
msg_ok "${test_name}"
((TESTS_PASSED++))
fi fi
else
msg_error "${test_name} - Installation failed"
echo "Installation failed" | tee -a "$TEST_LOG"
((TESTS_FAILED++))
fi
echo "Completed: $(date)" | tee -a "$TEST_LOG" echo "Completed: $(date)" | tee -a "$TEST_LOG"
echo "" | tee -a "$TEST_LOG" echo "" | tee -a "$TEST_LOG"
} }
# Skip test with reason # Skip test with reason
skip_test() { skip_test() {
local test_name="$1" local test_name="$1"
local reason="$2" local reason="$2"
echo -e "\n${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}" echo -e "\n${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${CYAN}Testing: ${test_name}${NC}" echo -e "${CYAN}Testing: ${test_name}${NC}"
echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}" echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
msg_warn "Skipped: ${reason}" msg_warn "Skipped: ${reason}"
((TESTS_SKIPPED++)) ((TESTS_SKIPPED++))
} }
# Update system # Update system
@ -171,36 +170,36 @@ apt-get install -y curl wget gpg jq git build-essential ca-certificates &>/dev/n
# TEST 1: YQ - YAML Processor # TEST 1: YQ - YAML Processor
# ============================================================================== # ==============================================================================
test_function "YQ" \ test_function "YQ" \
"setup_yq" \ "setup_yq" \
"yq --version" "yq --version"
# ============================================================================== # ==============================================================================
# TEST 2: ADMINER - Database Management # TEST 2: ADMINER - Database Management
# ============================================================================== # ==============================================================================
test_function "Adminer" \ test_function "Adminer" \
"setup_adminer" \ "setup_adminer" \
"test -f /usr/share/adminer/latest.php && echo 'Adminer installed'" "test -f /usr/share/adminer/latest.php && echo 'Adminer installed'"
# ============================================================================== # ==============================================================================
# TEST 3: CLICKHOUSE # TEST 3: CLICKHOUSE
# ============================================================================== # ==============================================================================
test_function "ClickHouse" \ test_function "ClickHouse" \
"setup_clickhouse" \ "setup_clickhouse" \
"clickhouse-server --version" "clickhouse-server --version"
# ============================================================================== # ==============================================================================
# TEST 4: POSTGRESQL # TEST 4: POSTGRESQL
# ============================================================================== # ==============================================================================
test_function "PostgreSQL 17" \ test_function "PostgreSQL 17" \
"PG_VERSION=17 setup_postgresql" \ "PG_VERSION=17 setup_postgresql" \
"psql --version" "psql --version"
# ============================================================================== # ==============================================================================
# TEST 6: MARIADB # TEST 6: MARIADB
# ============================================================================== # ==============================================================================
test_function "MariaDB 11.4" \ test_function "MariaDB 11.4" \
"MARIADB_VERSION=11.4 setup_mariadb" \ "MARIADB_VERSION=11.4 setup_mariadb" \
"mariadb --version" "mariadb --version"
# ============================================================================== # ==============================================================================
# TEST 7: MYSQL (Remove MariaDB first) # TEST 7: MYSQL (Remove MariaDB first)
@ -213,96 +212,96 @@ rm -rf /etc/mysql /var/lib/mysql
msg_ok "MariaDB removed" msg_ok "MariaDB removed"
test_function "MySQL 8.0" \ test_function "MySQL 8.0" \
"MYSQL_VERSION=8.0 setup_mysql" \ "MYSQL_VERSION=8.0 setup_mysql" \
"mysql --version" "mysql --version"
# ============================================================================== # ==============================================================================
# TEST 8: MONGODB (Check AVX support) # TEST 8: MONGODB (Check AVX support)
# ============================================================================== # ==============================================================================
if grep -q avx /proc/cpuinfo; then if grep -q avx /proc/cpuinfo; then
test_function "MongoDB 8.0" \ test_function "MongoDB 8.0" \
"MONGO_VERSION=8.0 setup_mongodb" \ "MONGO_VERSION=8.0 setup_mongodb" \
"mongod --version" "mongod --version"
else else
skip_test "MongoDB 8.0" "CPU does not support AVX" skip_test "MongoDB 8.0" "CPU does not support AVX"
fi fi
# ============================================================================== # ==============================================================================
# TEST 9: NODE.JS # TEST 9: NODE.JS
# ============================================================================== # ==============================================================================
test_function "Node.js 22 with modules" \ test_function "Node.js 22 with modules" \
"NODE_VERSION=22 NODE_MODULE='yarn,pnpm@10.1.0,pm2' setup_nodejs" \ "NODE_VERSION=22 NODE_MODULE='yarn,pnpm@10.1.0,pm2' setup_nodejs" \
"node --version && npm --version && yarn --version && pnpm --version && pm2 --version" "node --version && npm --version && yarn --version && pnpm --version && pm2 --version"
# ============================================================================== # ==============================================================================
# TEST 10: PYTHON (UV) # TEST 10: PYTHON (UV)
# ============================================================================== # ==============================================================================
test_function "Python 3.12 via uv" \ test_function "Python 3.12 via uv" \
"PYTHON_VERSION=3.12 setup_uv" \ "PYTHON_VERSION=3.12 setup_uv" \
"uv --version" "uv --version"
# ============================================================================== # ==============================================================================
# TEST 11: PHP # TEST 11: PHP
# ============================================================================== # ==============================================================================
test_function "PHP 8.3 with FPM" \ test_function "PHP 8.3 with FPM" \
"PHP_VERSION=8.3 PHP_FPM=YES PHP_MODULE='redis,imagick,apcu,zip,mbstring' setup_php" \ "PHP_VERSION=8.3 PHP_FPM=YES PHP_MODULE='redis,imagick,apcu,zip,mbstring' setup_php" \
"php --version" "php --version"
# ============================================================================== # ==============================================================================
# TEST 12: COMPOSER # TEST 12: COMPOSER
# ============================================================================== # ==============================================================================
test_function "Composer" \ test_function "Composer" \
"setup_composer" \ "setup_composer" \
"composer --version" "composer --version"
# ============================================================================== # ==============================================================================
# TEST 13: JAVA # TEST 13: JAVA
# ============================================================================== # ==============================================================================
test_function "Java Temurin 21" \ test_function "Java Temurin 21" \
"JAVA_VERSION=21 setup_java" \ "JAVA_VERSION=21 setup_java" \
"java --version" "java --version"
# ============================================================================== # ==============================================================================
# TEST 14: GO # TEST 14: GO
# ============================================================================== # ==============================================================================
test_function "Go (latest)" \ test_function "Go (latest)" \
"GO_VERSION=latest setup_go" \ "GO_VERSION=latest setup_go" \
"go version" "go version"
# ============================================================================== # ==============================================================================
# TEST 15: RUBY # TEST 15: RUBY
# ============================================================================== # ==============================================================================
test_function "Ruby 3.4.1 with Rails" \ test_function "Ruby 3.4.1 with Rails" \
"RUBY_VERSION=3.4.1 RUBY_INSTALL_RAILS=true setup_ruby" \ "RUBY_VERSION=3.4.1 RUBY_INSTALL_RAILS=true setup_ruby" \
"ruby --version" "ruby --version"
# ============================================================================== # ==============================================================================
# TEST 16: RUST # TEST 16: RUST
# ============================================================================== # ==============================================================================
test_function "Rust (stable)" \ test_function "Rust (stable)" \
"RUST_TOOLCHAIN=stable RUST_CRATES='cargo-edit' setup_rust" \ "RUST_TOOLCHAIN=stable RUST_CRATES='cargo-edit' setup_rust" \
"source \$HOME/.cargo/env && rustc --version" "source \$HOME/.cargo/env && rustc --version"
# ============================================================================== # ==============================================================================
# TEST 17: GHOSTSCRIPT # TEST 17: GHOSTSCRIPT
# ============================================================================== # ==============================================================================
test_function "Ghostscript" \ test_function "Ghostscript" \
"setup_gs" \ "setup_gs" \
"gs --version" "gs --version"
# ============================================================================== # ==============================================================================
# TEST 18: IMAGEMAGICK # TEST 18: IMAGEMAGICK
# ============================================================================== # ==============================================================================
test_function "ImageMagick" \ test_function "ImageMagick" \
"setup_imagemagick" \ "setup_imagemagick" \
"magick --version" "magick --version"
# ============================================================================== # ==============================================================================
# TEST 19: FFMPEG # TEST 19: FFMPEG
# ============================================================================== # ==============================================================================
test_function "FFmpeg n7.1.1 (full)" \ test_function "FFmpeg n7.1.1 (full)" \
"FFMPEG_VERSION=n7.1.1 FFMPEG_TYPE=full setup_ffmpeg" \ "FFMPEG_VERSION=n7.1.1 FFMPEG_TYPE=full setup_ffmpeg" \
"ffmpeg -version" "ffmpeg -version"
# ============================================================================== # ==============================================================================
# FINAL SUMMARY # FINAL SUMMARY
@ -317,31 +316,31 @@ echo -e "\nDetailed log: ${TEST_LOG}"
# Generate summary report # Generate summary report
{ {
echo "" echo ""
echo "=== FINAL SUMMARY ===" echo "=== FINAL SUMMARY ==="
echo "Tests Passed: ${TESTS_PASSED}" echo "Tests Passed: ${TESTS_PASSED}"
echo "Tests Failed: ${TESTS_FAILED}" echo "Tests Failed: ${TESTS_FAILED}"
echo "Tests Skipped: ${TESTS_SKIPPED}" echo "Tests Skipped: ${TESTS_SKIPPED}"
echo "" echo ""
echo "=== Installed Versions ===" echo "=== Installed Versions ==="
command -v yq &>/dev/null && echo "yq: $(yq --version 2>&1)" command -v yq &>/dev/null && echo "yq: $(yq --version 2>&1)"
command -v clickhouse-server &>/dev/null && echo "ClickHouse: $(clickhouse-server --version 2>&1 | head -n1)" command -v clickhouse-server &>/dev/null && echo "ClickHouse: $(clickhouse-server --version 2>&1 | head -n1)"
command -v psql &>/dev/null && echo "PostgreSQL: $(psql --version)" command -v psql &>/dev/null && echo "PostgreSQL: $(psql --version)"
command -v mysql &>/dev/null && echo "MySQL: $(mysql --version)" command -v mysql &>/dev/null && echo "MySQL: $(mysql --version)"
command -v mongod &>/dev/null && echo "MongoDB: $(mongod --version 2>&1 | head -n1)" command -v mongod &>/dev/null && echo "MongoDB: $(mongod --version 2>&1 | head -n1)"
command -v node &>/dev/null && echo "Node.js: $(node --version)" command -v node &>/dev/null && echo "Node.js: $(node --version)"
command -v php &>/dev/null && echo "PHP: $(php --version | head -n1)" command -v php &>/dev/null && echo "PHP: $(php --version | head -n1)"
command -v java &>/dev/null && echo "Java: $(java --version 2>&1 | head -n1)" command -v java &>/dev/null && echo "Java: $(java --version 2>&1 | head -n1)"
command -v go &>/dev/null && echo "Go: $(go version)" command -v go &>/dev/null && echo "Go: $(go version)"
command -v ruby &>/dev/null && echo "Ruby: $(ruby --version)" command -v ruby &>/dev/null && echo "Ruby: $(ruby --version)"
command -v rustc &>/dev/null && echo "Rust: $(rustc --version)" command -v rustc &>/dev/null && echo "Rust: $(rustc --version)"
command -v ffmpeg &>/dev/null && echo "FFmpeg: $(ffmpeg -version 2>&1 | head -n1)" command -v ffmpeg &>/dev/null && echo "FFmpeg: $(ffmpeg -version 2>&1 | head -n1)"
} >>"$TEST_LOG" } >>"$TEST_LOG"
if [ $TESTS_FAILED -eq 0 ]; then if [ $TESTS_FAILED -eq 0 ]; then
echo -e "\n${GREEN}All tests completed successfully!${NC}" echo -e "\n${GREEN}All tests completed successfully!${NC}"
exit 0 exit 0
else else
echo -e "\n${RED}Some tests failed. Check the log for details.${NC}" echo -e "\n${RED}Some tests failed. Check the log for details.${NC}"
exit 1 exit 1
fi fi