This commit is contained in:
parent
647d05be1f
commit
0c12ac59bb
@ -85,8 +85,17 @@ cleanup_before_test() {
|
|||||||
# 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
|
# Clean up broken repository files from previous tests
|
||||||
|
# Remove all custom sources files
|
||||||
|
rm -f /etc/apt/sources.list.d/*.sources 2>/dev/null || true
|
||||||
|
rm -f /etc/apt/sources.list.d/*.list 2>/dev/null || true
|
||||||
|
|
||||||
|
# Remove all keyrings
|
||||||
rm -f /etc/apt/keyrings/*.gpg 2>/dev/null || true
|
rm -f /etc/apt/keyrings/*.gpg 2>/dev/null || true
|
||||||
|
rm -f /etc/apt/keyrings/*.asc 2>/dev/null || true
|
||||||
|
|
||||||
|
# Update package lists to ensure clean state
|
||||||
|
apt-get update -qq 2>/dev/null || true
|
||||||
|
|
||||||
# Wait a moment for processes to clean up
|
# Wait a moment for processes to clean up
|
||||||
sleep 1
|
sleep 1
|
||||||
@ -176,23 +185,23 @@ apt-get install -y curl wget gpg jq git build-essential ca-certificates &>/dev/n
|
|||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# TEST 2: ADMINER - Database Management
|
# TEST 2: ADMINER - Database Management
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
test_function "Adminer" \
|
# test_function "Adminer" \
|
||||||
"setup_adminer" \
|
# "setup_adminer" \
|
||||||
"dpkg -l adminer 2>/dev/null | grep -q '^ii' && a2query -c adminer 2>/dev/null && echo 'Adminer installed'"
|
# "dpkg -l adminer 2>/dev/null | grep -q '^ii' && a2query -c adminer 2>/dev/null && 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 16" \
|
||||||
# "PG_VERSION=17 setup_postgresql" \
|
"PG_VERSION=16 setup_postgresql" \
|
||||||
# "psql --version"
|
"psql --version"
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# TEST 6: MARIADB
|
# TEST 6: MARIADB
|
||||||
@ -218,13 +227,13 @@ test_function "MySQL 8.0" \
|
|||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# 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
|
||||||
@ -278,9 +287,9 @@ test_function "Ruby 3.4.1 with Rails" \
|
|||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# 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
|
||||||
|
@ -88,11 +88,20 @@ ensure_dependencies() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if ((current_time - last_update > 300)); then
|
if ((current_time - last_update > 300)); then
|
||||||
$STD apt update
|
# Ensure orphaned sources are cleaned before updating
|
||||||
|
cleanup_orphaned_sources 2>/dev/null || true
|
||||||
|
|
||||||
|
if ! $STD apt update; then
|
||||||
|
msg_warn "apt update failed, attempting to fix..."
|
||||||
|
ensure_apt_working || return 1
|
||||||
|
fi
|
||||||
echo "$current_time" >"$apt_cache_file"
|
echo "$current_time" >"$apt_cache_file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$STD apt install -y "${missing[@]}"
|
$STD apt install -y "${missing[@]}" || {
|
||||||
|
msg_error "Failed to install dependencies: ${missing[*]}"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
msg_ok "Installed dependencies"
|
msg_ok "Installed dependencies"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -536,6 +545,7 @@ cleanup_old_repo_files() {
|
|||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# Cleanup orphaned .sources files that reference missing keyrings
|
# Cleanup orphaned .sources files that reference missing keyrings
|
||||||
# This prevents APT signature verification errors
|
# This prevents APT signature verification errors
|
||||||
|
# Call this at the start of any setup function to ensure APT is in a clean state
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
cleanup_orphaned_sources() {
|
cleanup_orphaned_sources() {
|
||||||
local sources_dir="/etc/apt/sources.list.d"
|
local sources_dir="/etc/apt/sources.list.d"
|
||||||
@ -554,6 +564,37 @@ cleanup_orphaned_sources() {
|
|||||||
rm -f "$sources_file"
|
rm -f "$sources_file"
|
||||||
fi
|
fi
|
||||||
done < <(find "$sources_dir" -name "*.sources" -print0 2>/dev/null)
|
done < <(find "$sources_dir" -name "*.sources" -print0 2>/dev/null)
|
||||||
|
|
||||||
|
# Also check for broken symlinks in keyrings directory
|
||||||
|
if [[ -d "$keyrings_dir" ]]; then
|
||||||
|
find "$keyrings_dir" -type l ! -exec test -e {} \; -delete 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Ensure APT is in a working state before installing packages
|
||||||
|
# This should be called at the start of any setup function
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
ensure_apt_working() {
|
||||||
|
# Clean up orphaned sources first
|
||||||
|
cleanup_orphaned_sources
|
||||||
|
|
||||||
|
# Try to update package lists
|
||||||
|
if ! apt-get update -qq 2>/dev/null; then
|
||||||
|
msg_warn "APT update failed, attempting to fix..."
|
||||||
|
|
||||||
|
# More aggressive cleanup
|
||||||
|
rm -f /etc/apt/sources.list.d/*.sources 2>/dev/null || true
|
||||||
|
cleanup_orphaned_sources
|
||||||
|
|
||||||
|
# Try again
|
||||||
|
if ! apt-get update -qq 2>/dev/null; then
|
||||||
|
msg_error "Cannot update package lists - APT is critically broken"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
@ -2055,17 +2096,19 @@ setup_mariadb() {
|
|||||||
$STD apt purge -y 'mariadb*' || true
|
$STD apt purge -y 'mariadb*' || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install required dependencies first (MariaDB needs these from main repos)
|
# Ensure APT is working before proceeding
|
||||||
msg_info "Installing MariaDB dependencies"
|
ensure_apt_working || return 1
|
||||||
$STD apt update
|
|
||||||
$STD apt install -y gawk rsync socat libdbi-perl pv || {
|
|
||||||
msg_error "Failed to install MariaDB dependencies"
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# Cleanup old repository files
|
# Cleanup old repository files
|
||||||
cleanup_old_repo_files "mariadb"
|
cleanup_old_repo_files "mariadb"
|
||||||
|
|
||||||
|
# Install required dependencies first (MariaDB needs these from main repos)
|
||||||
|
msg_info "Installing MariaDB dependencies"
|
||||||
|
ensure_dependencies gawk rsync socat libdbi-perl pv || {
|
||||||
|
msg_error "Failed to install MariaDB dependencies"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
# Use helper function to get fallback suite
|
# Use helper function to get fallback suite
|
||||||
local SUITE
|
local SUITE
|
||||||
SUITE=$(get_fallback_suite "$DISTRO_ID" "$DISTRO_CODENAME" "http://mirror.mariadb.org/repo/${MARIADB_VERSION}/${DISTRO_ID}")
|
SUITE=$(get_fallback_suite "$DISTRO_ID" "$DISTRO_CODENAME" "http://mirror.mariadb.org/repo/${MARIADB_VERSION}/${DISTRO_ID}")
|
||||||
@ -2286,16 +2329,25 @@ function setup_mysql() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! apt-cache policy mysql-server | grep -q 'Candidate:'; then
|
# Check for either mysql-server meta package or mysql-community-server
|
||||||
|
if ! apt-cache policy mysql-server mysql-community-server 2>/dev/null | grep -q 'Candidate:'; then
|
||||||
msg_error "MySQL ${MYSQL_VERSION} package not available for suite ${SUITE}"
|
msg_error "MySQL ${MYSQL_VERSION} package not available for suite ${SUITE}"
|
||||||
msg_info "Available MySQL components:"
|
msg_info "Available MySQL components:"
|
||||||
apt-cache search "^mysql-" | grep "^mysql-" | head -20 | sed 's/^/ /'
|
apt-cache search "^mysql-" | grep "^mysql-" | head -20 | sed 's/^/ /'
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! $STD apt install -y mysql-server; then
|
# Try to install mysql-server first (meta package), fallback to mysql-community-server
|
||||||
msg_error "Failed to install MySQL ${MYSQL_VERSION}"
|
if apt-cache policy mysql-server 2>/dev/null | grep -q 'Candidate:'; then
|
||||||
return 1
|
if ! $STD apt install -y mysql-server mysql-client; then
|
||||||
|
msg_error "Failed to install MySQL ${MYSQL_VERSION}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if ! $STD apt install -y mysql-community-server mysql-community-client; then
|
||||||
|
msg_error "Failed to install MySQL ${MYSQL_VERSION}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Verify installation
|
# Verify installation
|
||||||
@ -2719,6 +2771,9 @@ function setup_ruby() {
|
|||||||
|
|
||||||
msg_info "Installing Ruby $RUBY_VERSION"
|
msg_info "Installing Ruby $RUBY_VERSION"
|
||||||
|
|
||||||
|
# Ensure APT is working before installing dependencies
|
||||||
|
ensure_apt_working || return 1
|
||||||
|
|
||||||
# Install all required build dependencies
|
# Install all required build dependencies
|
||||||
ensure_dependencies jq autoconf patch build-essential rustc libssl-dev libyaml-dev \
|
ensure_dependencies jq autoconf patch build-essential rustc libssl-dev libyaml-dev \
|
||||||
libreadline6-dev zlib1g-dev libgmp-dev libncurses5-dev libffi-dev libgdbm6 \
|
libreadline6-dev zlib1g-dev libgmp-dev libncurses5-dev libffi-dev libgdbm6 \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user