mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-15 17:56:12 +01:00
Fix pysftp dependency issue and optimize WSGI-LSAPI compilation: Removed pysftp from requirements in favor of paramiko, and updated Makefile for proper optimization flags to avoid _FORTIFY_SOURCE warnings during WSGI-LSAPI installation.
This commit is contained in:
@@ -573,6 +573,12 @@ for i in {1..50};
|
||||
fi
|
||||
if grep -q "Django==" /usr/local/requirments.txt ; then
|
||||
echo -e "[$(date +"%Y-%m-%d %H:%M:%S")] Requirements file downloaded successfully" | tee -a /var/log/cyberpanel_upgrade_debug.log
|
||||
|
||||
# Fix pysftp dependency issue by removing it from requirements
|
||||
echo -e "[$(date +"%Y-%m-%d %H:%M:%S")] Fixing pysftp dependency issue..." | tee -a /var/log/cyberpanel_upgrade_debug.log
|
||||
sed -i 's/^pysftp$/# pysftp - deprecated, using paramiko instead/' /usr/local/requirments.txt
|
||||
sed -i 's/pysftp/# pysftp - deprecated, using paramiko instead/' /usr/local/requirments.txt
|
||||
|
||||
break
|
||||
else
|
||||
echo -e "\n Requirement list has failed to download for $i times..."
|
||||
@@ -1071,7 +1077,7 @@ else
|
||||
echo -e "[$(date +"%Y-%m-%d %H:%M:%S")] Django is properly installed" | tee -a /var/log/cyberpanel_upgrade_debug.log
|
||||
fi
|
||||
|
||||
echo -e "[$(date +"%Y-%m-%d %H:%M:%S")] Installing WSGI-LSAPI..." | tee -a /var/log/cyberpanel_upgrade_debug.log
|
||||
echo -e "[$(date +"%Y-%m-%d %H:%M:%S")] Installing WSGI-LSAPI with optimized compilation..." | tee -a /var/log/cyberpanel_upgrade_debug.log
|
||||
|
||||
# Save current directory
|
||||
UPGRADE_CWD=$(pwd)
|
||||
@@ -1085,11 +1091,27 @@ cd wsgi-lsapi-2.1 || exit
|
||||
|
||||
echo -e "[$(date +"%Y-%m-%d %H:%M:%S")] Configuring WSGI..." | tee -a /var/log/cyberpanel_upgrade_debug.log
|
||||
/usr/local/CyberPanel/bin/python ./configure.py 2>&1 | tee -a /var/log/cyberpanel_upgrade_debug.log
|
||||
|
||||
# Fix Makefile to use proper optimization flags to avoid _FORTIFY_SOURCE warnings
|
||||
echo -e "[$(date +"%Y-%m-%d %H:%M:%S")] Optimizing Makefile for proper compilation..." | tee -a /var/log/cyberpanel_upgrade_debug.log
|
||||
if [[ -f Makefile ]]; then
|
||||
# Replace -O0 -g3 with -O2 -g to satisfy _FORTIFY_SOURCE
|
||||
sed -i 's/-O0 -g3/-O2 -g/g' Makefile
|
||||
# Ensure we have proper optimization flags
|
||||
if grep -q "CFLAGS" Makefile && ! grep -q "-O2" Makefile; then
|
||||
sed -i 's/CFLAGS =/CFLAGS = -O2/' Makefile
|
||||
fi
|
||||
echo -e "[$(date +"%Y-%m-%d %H:%M:%S")] Makefile optimized for proper compilation" | tee -a /var/log/cyberpanel_upgrade_debug.log
|
||||
fi
|
||||
|
||||
echo -e "[$(date +"%Y-%m-%d %H:%M:%S")] Compiling WSGI with optimized flags..." | tee -a /var/log/cyberpanel_upgrade_debug.log
|
||||
make clean 2>&1 | tee -a /var/log/cyberpanel_upgrade_debug.log
|
||||
make 2>&1 | tee -a /var/log/cyberpanel_upgrade_debug.log
|
||||
|
||||
echo -e "[$(date +"%Y-%m-%d %H:%M:%S")] Installing lswsgi binary..." | tee -a /var/log/cyberpanel_upgrade_debug.log
|
||||
rm -f /usr/local/CyberCP/bin/lswsgi
|
||||
cp lswsgi /usr/local/CyberCP/bin/
|
||||
chmod +x /usr/local/CyberCP/bin/lswsgi
|
||||
|
||||
# Return to original directory
|
||||
cd "$UPGRADE_CWD" || cd /root
|
||||
|
||||
@@ -2118,6 +2118,7 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
|
||||
|
||||
def setupPythonWSGI(self):
|
||||
try:
|
||||
preFlightsChecks.stdOut("Setting up Python WSGI-LSAPI with optimized compilation...", 1)
|
||||
|
||||
command = "wget http://www.litespeedtech.com/packages/lsapi/wsgi-lsapi-2.1.tgz"
|
||||
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
|
||||
@@ -2130,6 +2131,12 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
|
||||
command = "/usr/local/CyberPanel/bin/python ./configure.py"
|
||||
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
|
||||
|
||||
# Fix Makefile to use proper optimization flags to avoid _FORTIFY_SOURCE warnings
|
||||
self._fixWSGIMakefile()
|
||||
|
||||
# Compile with proper optimization flags
|
||||
command = "make clean"
|
||||
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
|
||||
|
||||
command = "make"
|
||||
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
|
||||
@@ -2140,11 +2147,47 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
|
||||
command = "cp lswsgi /usr/local/CyberCP/bin/"
|
||||
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
|
||||
|
||||
os.chdir(self.cwd)
|
||||
# Set proper permissions
|
||||
command = "chmod +x /usr/local/CyberCP/bin/lswsgi"
|
||||
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
|
||||
|
||||
except:
|
||||
os.chdir(self.cwd)
|
||||
preFlightsChecks.stdOut("WSGI-LSAPI compiled successfully with optimized flags", 1)
|
||||
|
||||
except Exception as e:
|
||||
preFlightsChecks.stdOut(f"WSGI setup error: {str(e)}", 0)
|
||||
return 0
|
||||
|
||||
def _fixWSGIMakefile(self):
|
||||
"""Fix the Makefile to use proper compiler optimization flags"""
|
||||
try:
|
||||
makefile_path = "Makefile"
|
||||
|
||||
if not os.path.exists(makefile_path):
|
||||
preFlightsChecks.stdOut("Makefile not found, skipping optimization fix", 1)
|
||||
return
|
||||
|
||||
# Read the Makefile
|
||||
with open(makefile_path, 'r') as f:
|
||||
content = f.read()
|
||||
|
||||
# Fix compiler flags to avoid _FORTIFY_SOURCE warnings
|
||||
# Replace -O0 -g3 with -O2 -g to satisfy _FORTIFY_SOURCE
|
||||
content = content.replace('-O0 -g3', '-O2 -g')
|
||||
|
||||
# Ensure we have proper optimization flags
|
||||
if 'CFLAGS' in content and '-O2' not in content:
|
||||
content = content.replace('CFLAGS =', 'CFLAGS = -O2')
|
||||
|
||||
# Write the fixed Makefile
|
||||
with open(makefile_path, 'w') as f:
|
||||
f.write(content)
|
||||
|
||||
preFlightsChecks.stdOut("Makefile optimized for proper compilation", 1)
|
||||
|
||||
except Exception as e:
|
||||
preFlightsChecks.stdOut(f"Warning: Could not optimize Makefile: {str(e)}", 1)
|
||||
|
||||
def setupLSCPDDaemon(self):
|
||||
try:
|
||||
|
||||
|
||||
@@ -3745,7 +3745,7 @@ echo $oConfig->Save() ? 'Done' : 'Error';
|
||||
'lsphp7? lsphp7?-common lsphp7?-curl lsphp7?-dev lsphp7?-imap lsphp7?-intl lsphp7?-json ' \
|
||||
'lsphp7?-ldap lsphp7?-mysql lsphp7?-opcache lsphp7?-pspell lsphp7?-recode ' \
|
||||
'lsphp7?-sqlite3 lsphp7?-tidy'
|
||||
Upgrade.executioner(command, 'Install PHP 73, 0')
|
||||
Upgrade.executioner(command, 'Install PHP 7.x', 0)
|
||||
|
||||
command = 'DEBIAN_FRONTEND=noninteractive apt-get -y install lsphp80*'
|
||||
os.system(command)
|
||||
|
||||
@@ -21,7 +21,7 @@ pexpect==4.8.0
|
||||
psutil==5.7.3
|
||||
py3dns==4.0.2
|
||||
pyOpenSSL==19.1.0
|
||||
pysftp
|
||||
# pysftp - deprecated, using paramiko instead
|
||||
pyotp
|
||||
requests==2.26.0
|
||||
s3transfer==0.5.0
|
||||
|
||||
Reference in New Issue
Block a user