Merge pull request #1569 from master3395/v2.5.5-dev

V2.5.5 dev
This commit is contained in:
Master3395
2025-09-25 23:05:24 +02:00
committed by GitHub

View File

@@ -621,153 +621,67 @@ install_cyberpanel_direct() {
echo "===============================================================================================================" echo "==============================================================================================================="
echo "" echo ""
# Run the installer with active progress monitoring # Run the installer with live progress monitoring
echo "Starting CyberPanel installation process..." echo "Starting CyberPanel installation process..."
echo "This may take several minutes. Please be patient." echo "This may take several minutes. Please be patient."
echo "" echo ""
# Start the installer in background and monitor progress # Create log directory
echo "Starting CyberPanel installer with PID tracking..." mkdir -p /var/log/CyberPanel
./cyberpanel_installer.sh $([ "$DEBUG_MODE" = true ] && echo "--debug") > /var/log/CyberPanel/install_output.log 2>&1 &
local install_pid=$!
# Give the process a moment to start # Run the installer with live output monitoring
sleep 2 echo "Starting CyberPanel installer with live progress monitoring..."
echo ""
echo "==============================================================================================================="
echo " LIVE INSTALLATION PROGRESS"
echo "==============================================================================================================="
echo ""
# Check if the process is still running # Run installer and show live output
if ! kill -0 $install_pid 2>/dev/null; then if [ "$DEBUG_MODE" = true ]; then
print_status "ERROR: CyberPanel installer failed to start or exited immediately" ./cyberpanel_installer.sh --debug 2>&1 | tee /var/log/CyberPanel/install_output.log
else
./cyberpanel_installer.sh 2>&1 | tee /var/log/CyberPanel/install_output.log
fi
local install_exit_code=${PIPESTATUS[0]}
echo ""
echo "==============================================================================================================="
echo " INSTALLATION COMPLETED"
echo "==============================================================================================================="
echo ""
# Check if installation was successful
if [ $install_exit_code -ne 0 ]; then
print_status "ERROR: CyberPanel installation failed with exit code $install_exit_code"
echo "" echo ""
echo "Debugging information:" echo "Installation log (last 50 lines):"
echo " • Installer file size: $(wc -c < cyberpanel_installer.sh 2>/dev/null || echo 'unknown') bytes" echo "==============================================================================================================="
echo " • File permissions: $(ls -la cyberpanel_installer.sh 2>/dev/null || echo 'file not found')" tail -50 /var/log/CyberPanel/install_output.log 2>/dev/null || echo "Could not read installation log"
echo " • First few lines of installer:" echo "==============================================================================================================="
head -3 cyberpanel_installer.sh 2>/dev/null || echo "Could not read file"
echo "" echo ""
echo "Installation log:" echo "Full installation log available at: /var/log/CyberPanel/install_output.log"
cat /var/log/CyberPanel/install_output.log 2>/dev/null || echo "No log file found"
echo ""
echo "This usually means:"
echo " 1. The installer has syntax errors or missing dependencies"
echo " 2. The installer requires specific arguments or environment"
echo " 3. Missing installation files or directories"
echo "" echo ""
return 1 return 1
fi fi
# Active progress bar with real-time updates
local progress=0
local bar_length=50
local start_time=$(date +%s)
local last_progress=0
echo "Progress: [ ] 0%"
echo ""
echo "Status: Downloading and installing CyberPanel components..."
echo ""
# Monitor the installation process
local min_wait_time=30 # Minimum 30 seconds before allowing completion
local max_wait_time=1800 # Maximum 30 minutes timeout
while true; do
# Check if process is still running
if ! kill -0 $install_pid 2>/dev/null; then
# Process has finished, but wait minimum time
if [ $elapsed -ge $min_wait_time ]; then
break
else
# Still within minimum wait time, continue monitoring
sleep 2
continue
fi
fi
local current_time=$(date +%s)
local elapsed=$((current_time - start_time))
# Check for timeout
if [ $elapsed -gt $max_wait_time ]; then
print_status "ERROR: Installation timeout after $((max_wait_time / 60)) minutes"
kill $install_pid 2>/dev/null || true
break
fi
# Calculate progress based on elapsed time (conservative and realistic)
if [ $elapsed -lt 30 ]; then
progress=$((elapsed * 2)) # 0-60% in first 30 seconds
elif [ $elapsed -lt 120 ]; then
progress=$((60 + (elapsed - 30) * 1)) # 60-150% in next 90 seconds
elif [ $elapsed -lt 300 ]; then
progress=$((150 + (elapsed - 120) * 1)) # 150-330% in next 3 minutes
else
progress=$((330 + (elapsed - 300) * 1)) # 330%+ after 5 minutes
fi
# Cap progress at 95% until actually complete
if [ $progress -gt 95 ]; then
progress=95
fi
# Only update display if progress changed significantly
if [ $progress -gt $last_progress ]; then
# Create progress bar
local filled=$((progress * bar_length / 100))
local empty=$((bar_length - filled))
local bar=""
for ((i=0; i<filled; i++)); do
bar="${bar}"
done
for ((i=0; i<empty; i++)); do
bar="${bar}"
done
# Status messages based on elapsed time
local status_msg=""
if [ $elapsed -lt 30 ]; then
status_msg="Downloading CyberPanel installer..."
elif [ $elapsed -lt 120 ]; then
status_msg="Installing core components..."
elif [ $elapsed -lt 300 ]; then
status_msg="Configuring services and database..."
else
status_msg="Finalizing installation..."
fi
# Update progress display
printf "\r\033[KProgress: [%s] %d%% | %s | Elapsed: %dm %ds" "$bar" "$progress" "$status_msg" "$((elapsed / 60))" "$((elapsed % 60))"
last_progress=$progress
fi
sleep 2
done
# Wait for the process to complete and get exit status
wait $install_pid
local install_status=$?
# Show final progress
local final_elapsed=$((elapsed / 60))
local final_seconds=$((elapsed % 60))
printf "\r\033[KProgress: [██████████████████████████████████████████████████] 100%% | Complete! | Elapsed: %dm %ds\n" "$final_elapsed" "$final_seconds"
echo ""
# Clean up temporary directory # Clean up temporary directory
cd /tmp cd /tmp
rm -rf "$temp_dir" 2>/dev/null || true rm -rf "$temp_dir" 2>/dev/null || true
if [ $install_status -eq 0 ]; then # Check if installation was successful
print_status "SUCCESS: CyberPanel installed successfully" if [ $install_exit_code -eq 0 ]; then
print_status "SUCCESS: CyberPanel installed successfully"
# Run post-installation fixes # Run post-installation fixes
echo "" echo ""
echo " 🔧 Running post-installation fixes..." echo " 🔧 Running post-installation fixes..."
fix_post_install_issues fix_post_install_issues
return 0 return 0
else else
print_status "ERROR: CyberPanel installation failed (exit code: $install_status)" print_status "ERROR: CyberPanel installation failed (exit code: $install_exit_code)"
echo "" echo ""
echo "===============================================================================================================" echo "==============================================================================================================="
echo " INSTALLATION FAILED" echo " INSTALLATION FAILED"
@@ -1072,12 +986,9 @@ show_fresh_install_menu() {
return return
;; ;;
2) 2)
echo "" BRANCH_NAME="v2.5.5-dev"
echo "ERROR: v2.5.5-dev is not yet available on GitHub." show_installation_preferences
echo " Please select 'Latest Stable Version' or 'Custom Branch Name' instead." return
echo " The enhanced installer will be available after pushing to GitHub."
echo ""
continue
;; ;;
3) 3)
show_version_selection show_version_selection
@@ -1850,139 +1761,53 @@ start_upgrade() {
echo "===============================================================================================================" echo "==============================================================================================================="
echo "" echo ""
# Run the upgrade with progress monitoring # Run the upgrade with live progress monitoring
echo "Starting CyberPanel upgrade process..." echo "Starting CyberPanel upgrade process..."
echo "This may take several minutes. Please be patient." echo "This may take several minutes. Please be patient."
echo "" echo ""
# Start the upgrade in background and monitor progress # Create log directory
./cyberpanel_upgrade.sh $([ "$DEBUG_MODE" = true ] && echo "--debug") > /var/log/CyberPanel/upgrade_output.log 2>&1 & mkdir -p /var/log/CyberPanel
local upgrade_pid=$!
# Active progress bar with real-time updates # Run the upgrade with live output monitoring
local progress=0 echo "Starting CyberPanel upgrade with live progress monitoring..."
local bar_length=50 echo ""
local start_time=$(date +%s) echo "==============================================================================================================="
local last_progress=0 echo " LIVE UPGRADE PROGRESS"
echo "==============================================================================================================="
echo "Progress: [ ] 0%"
echo ""
echo "Status: Upgrading CyberPanel components..."
echo "" echo ""
# Monitor the upgrade process # Run upgrade and show live output
while true; do if [ "$DEBUG_MODE" = true ]; then
# Check if process is still running ./cyberpanel_upgrade.sh --debug 2>&1 | tee /var/log/CyberPanel/upgrade_output.log
if ! kill -0 $upgrade_pid 2>/dev/null; then else
# Process has finished, break the loop ./cyberpanel_upgrade.sh 2>&1 | tee /var/log/CyberPanel/upgrade_output.log
break fi
fi
local current_time=$(date +%s) local upgrade_exit_code=${PIPESTATUS[0]}
local elapsed=$((current_time - start_time))
# Calculate progress based on elapsed time
if [ $elapsed -lt 30 ]; then
progress=$((elapsed * 3)) # 0-90% in first 30 seconds
elif [ $elapsed -lt 120 ]; then
progress=$((90 + (elapsed - 30) * 1)) # 90-180% in next 90 seconds
elif [ $elapsed -lt 300 ]; then
progress=$((180 + (elapsed - 120) * 1)) # 180-360% in next 3 minutes
else
progress=$((360 + (elapsed - 300) * 1)) # 360%+ after 5 minutes
fi
# Cap progress at 95% until actually complete
if [ $progress -gt 95 ]; then
progress=95
fi
# Only update display if progress changed significantly
if [ $progress -gt $last_progress ]; then
# Create progress bar
local filled=$((progress * bar_length / 100))
local empty=$((bar_length - filled))
local bar=""
for ((i=0; i<filled; i++)); do
bar="${bar}"
done
for ((i=0; i<empty; i++)); do
bar="${bar}"
done
# Status messages based on elapsed time
local status_msg=""
if [ $elapsed -lt 30 ]; then
status_msg="Preparing upgrade..."
elif [ $elapsed -lt 120 ]; then
status_msg="Upgrading core components..."
elif [ $elapsed -lt 300 ]; then
status_msg="Updating services and database..."
else
status_msg="Finalizing upgrade..."
fi
# Update progress display
printf "\r\033[KProgress: [%s] %d%% | %s | Elapsed: %dm %ds" "$bar" "$progress" "$status_msg" "$((elapsed / 60))" "$((elapsed % 60))"
last_progress=$progress
fi
sleep 2
done
# Wait for the process to complete and get exit status
wait $upgrade_pid
local upgrade_status=$?
# Show final progress
local final_elapsed=$((elapsed / 60))
local final_seconds=$((elapsed % 60))
printf "\r\033[KProgress: [██████████████████████████████████████████████████] 100%% | Complete! | Elapsed: %dm %ds\n" "$final_elapsed" "$final_seconds"
echo ""
echo "==============================================================================================================="
echo " UPGRADE COMPLETED"
echo "==============================================================================================================="
echo "" echo ""
# Clean up downloaded upgrade script # Clean up downloaded upgrade script
rm -f cyberpanel_upgrade.sh 2>/dev/null rm -f cyberpanel_upgrade.sh 2>/dev/null
if [ $upgrade_status -eq 0 ]; then # Check if upgrade was successful
if [ $upgrade_exit_code -eq 0 ]; then
print_status "SUCCESS: CyberPanel upgraded successfully" print_status "SUCCESS: CyberPanel upgraded successfully"
return 0 return 0
else else
print_status "ERROR: CyberPanel upgrade failed" print_status "ERROR: CyberPanel upgrade failed with exit code $upgrade_exit_code"
echo "" echo ""
echo "Upgrade log (last 50 lines):"
echo "===============================================================================================================" echo "==============================================================================================================="
echo " UPGRADE FAILED" tail -50 /var/log/CyberPanel/upgrade_output.log 2>/dev/null || echo "Could not read upgrade log"
echo "===============================================================================================================" echo "==============================================================================================================="
echo "" echo ""
echo "The CyberPanel upgrade has failed. Here's how to troubleshoot:" echo "Full upgrade log available at: /var/log/CyberPanel/upgrade_output.log"
echo ""
echo "📋 LOG FILES LOCATION:"
echo " • Main installer log: /var/log/CyberPanel/install.log"
echo " • Upgrade output: /var/log/CyberPanel/upgrade_output.log"
echo " • System logs: /var/log/messages"
echo ""
echo "🔍 TROUBLESHOOTING STEPS:"
echo " 1. Check the upgrade output log for specific errors"
echo " 2. Ensure your current installation is working"
echo " 3. Check for conflicting services"
echo " 4. Verify you have sufficient disk space"
echo " 5. Try running the upgrade again"
echo ""
echo "📄 LAST 30 LINES OF UPGRADE LOG:"
echo "==============================================================================================================="
if [ -f "/var/log/CyberPanel/upgrade_output.log" ]; then
tail -30 /var/log/CyberPanel/upgrade_output.log 2>/dev/null || echo "Could not read upgrade log"
else
echo "Upgrade log not found at /var/log/CyberPanel/upgrade_output.log"
fi
echo "==============================================================================================================="
echo ""
echo "💡 QUICK DEBUG COMMANDS:"
echo " • View full log: cat /var/log/CyberPanel/upgrade_output.log"
echo " • Check CyberPanel status: systemctl status lscpd"
echo " • Check system: free -h && df -h"
echo " • Retry upgrade: Run the installer again"
echo "" echo ""
return 1 return 1
fi fi