Files
CyberPanel/install/venvsetup_modules/03_main_run_pip.sh
master3395 a6417b2bda Install/upgrade and UI updates: monolithic install, SnappyMail, firewall, to-do docs
- Install: monolithic install script, venvsetup_modules and venvsetup_monolithic,
  install_modules (parse_main, menus, actions, etc.), remove legacy email-configs
  and php-configs from repo, add install/snappymail and Rainloop->SnappyMail
  migration script
- CyberPanel: urls.py, cyberpanel.sh, cyberpanel_upgrade_monolithic.sh tweaks
- Firewall: firewall.js and firewall.html updates
- plogical: mailUtilities.py, upgrade.py; upgrade_modules 10_post_tweak.sh
- pluginHolder: deploy-plugins-template.sh
- to-do: docs (git conflicts, HTTP 500 recovery, phpMyAdmin, plugins, SnappyMail
  rename, install/upgrade OS support, security whitelist, etc.)
- upgrade_modules: 02_checks_part1/part2.txt
2026-02-16 00:12:03 +01:00

126 lines
4.3 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# install/venvsetup part 3 main_install_run, pip_virtualenv
main_install_run() {
debug="1"
if [[ $debug == "0" ]] ; then
echo "/usr/local/CyberPanel/bin/python2 install.py $SERVER_IP $SERIAL_NO $LICENSE_KEY"
exit
fi
if [[ $debug == "1" ]] ; then
if [[ $DEV == "ON" ]] ; then
/usr/local/CyberPanel/bin/python install.py $SERVER_IP $SERIAL_NO $LICENSE_KEY --mariadb-version "${MARIADB_VER:-11.8}"
else
/usr/local/CyberPanel/bin/python2 install.py $SERVER_IP $SERIAL_NO $LICENSE_KEY --mariadb-version "${MARIADB_VER:-11.8}"
fi
if grep "CyberPanel installation successfully completed" /var/log/installLogs.txt > /dev/null; then
echo -e "\nCyberPanel installation sucessfully completed..."
else
echo -e "Oops, something went wrong..."
exit
fi
if [[ $MEMCACHED == "ON" ]] ; then
memcached_installation
fi
if [[ $REDIS == "ON" ]] ; then
redis_installation
fi
after_install
fi
}
pip_virtualenv() {
if [[ $DEV == "OFF" ]] ; then
if [[ $SERVER_COUNTRY == "CN" ]] ; then
mkdir /root/.pip
cat << EOF > /root/.pip/pip.conf
[global]
index-url = https://mirrors.aliyun.com/pypi/simple/
EOF
fi
if [[ $PROVIDER == "Alibaba Cloud" ]] ; then
pip install --upgrade pip 2>/dev/null || echo "⚠️ pip upgrade completed with warnings"
pip install setuptools==40.8.0 2>/dev/null || echo "⚠️ setuptools installation completed with warnings"
fi
pip install virtualenv 2>/dev/null || echo "⚠️ virtualenv installation completed with warnings"
# Create virtual environment with fallback for Ubuntu 22.04 compatibility
echo "Creating CyberPanel virtual environment..."
if python3 -m venv --system-site-packages /usr/local/CyberPanel 2>&1 | grep -q "unrecognized option"; then
# Fallback to virtualenv if python3 -m venv doesn't support --system-site-packages
virtualenv --system-site-packages /usr/local/CyberPanel
elif python3 -m venv --system-site-packages /usr/local/CyberPanel 2>/dev/null; then
echo "Virtual environment created successfully using python3 -m venv"
else
# Final fallback to virtualenv
virtualenv --system-site-packages /usr/local/CyberPanel
fi
source /usr/local/CyberPanel/bin/activate
rm -rf requirements.txt
wget -O requirements.txt https://raw.githubusercontent.com/usmannasir/cyberpanel/1.8.0/requirments.txt
# Install packages with robust error handling to prevent broken pipe errors
safe_pip_install "pip" "requirements.txt" "--ignore-installed"
fi
if [[ $DEV == "ON" ]] ; then
#install dev branch
#wget https://raw.githubusercontent.com/usmannasir/cyberpanel/$BRANCH_NAME/requirments.txt
cd /usr/local/
python3.6 -m venv CyberPanel
source /usr/local/CyberPanel/bin/activate
# Try to download requirements file with fallback options
echo "Attempting to download requirements for branch/commit: $BRANCH_NAME"
# First try the specified branch/commit
if wget -O requirements.txt https://raw.githubusercontent.com/usmannasir/cyberpanel/$BRANCH_NAME/requirments.txt 2>/dev/null; then
echo "Successfully downloaded requirements from $BRANCH_NAME"
elif wget -O requirements.txt https://raw.githubusercontent.com/usmannasir/cyberpanel/$BRANCH_NAME/requirments-old.txt 2>/dev/null; then
echo "Successfully downloaded requirements-old.txt from $BRANCH_NAME"
elif wget -O requirements.txt https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/requirments.txt 2>/dev/null; then
echo "Fallback: Downloaded requirements from stable branch"
else
echo "Warning: Could not download requirements file, using minimal default requirements"
cat > requirements.txt << 'EOF'
# Minimal CyberPanel requirements - fallback when requirements file is not available
Django==3.2.25
PyMySQL==1.1.0
requests==2.31.0
cryptography==41.0.7
psutil==5.9.6
EOF
fi
safe_pip_install "pip3.6" "requirements.txt" "--ignore-installed"
fi
if [ -f requirements.txt ] && [ -d cyberpanel ] ; then
rm -rf cyberpanel
rm -f requirements.txt
fi
if [[ $SERVER_COUNTRY == "CN" ]] ; then
wget https://cyberpanel.sh/cyberpanel-git.tar.gz
tar xzvf cyberpanel-git.tar.gz > /dev/null
cp -r cyberpanel /usr/local/cyberpanel
cd cyberpanel/install
else
if [[ $DEV == "ON" ]] ; then
git clone https://github.com/usmannasir/cyberpanel
cd cyberpanel
git checkout $BRANCH_NAME
cd -
cd cyberpanel/install
else
git clone https://github.com/usmannasir/cyberpanel
cd cyberpanel/install
fi
fi
curl https://cyberpanel.sh/?version
}