Skip to content

Commit

Permalink
take care if due to new packages upgrades dont work
Browse files Browse the repository at this point in the history
  • Loading branch information
usmannasir committed Aug 6, 2024
1 parent 55d4762 commit d76d2db
Showing 1 changed file with 57 additions and 1 deletion.
58 changes: 57 additions & 1 deletion cyberpanel_upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,52 @@ Pre_Upgrade_Branch_Input() {

Main_Upgrade() {
/usr/local/CyberPanel/bin/python upgrade.py "$Branch_Name"
Check_Return
# Capture the return code of the last command executed
RETURN_CODE=$?

# Check if the command was successful (return code 0)
if [ $RETURN_CODE -eq 0 ]; then
echo "Upgrade successful."
else


if [ -e /usr/bin/pip3 ]; then
PIP3="/usr/bin/pip3"
else
PIP3="pip3.6"
fi

rm -rf /usr/local/CyberPanelTemp
virtualenv -p /usr/bin/python3 --system-site-packages /usr/local/CyberPanelTemp

# shellcheck disable=SC1091
. /usr/local/CyberPanelTemp/bin/activate

wget -O /usr/local/requirments-old.txt "${Git_Content_URL}/${Branch_Name}/requirments-old.txt"

if [[ "$Server_OS" = "CentOS" ]] ; then
# $PIP3 install --default-timeout=3600 virtualenv==16.7.9
# Check_Return
$PIP3 install --default-timeout=3600 --ignore-installed -r /usr/local/requirments-old.txt
Check_Return
elif [[ "$Server_OS" = "Ubuntu" ]] ; then
# shellcheck disable=SC1091
. /usr/local/CyberPanelTemp/bin/activate
Check_Return
pip3 install --default-timeout=3600 --ignore-installed -r /usr/local/requirments-old.txt
Check_Return
elif [[ "$Server_OS" = "openEuler" ]] ; then
pip3 install --default-timeout=3600 --ignore-installed -r /usr/local/requirments-old.txt
Check_Return
fi

/usr/local/CyberPanelTemp/bin/python upgrade.py "$Branch_Name"
Check_Return

rm -rf /usr/local/CyberPanelTemp

fi


rm -rf /usr/local/CyberCP/bin
rm -rf /usr/local/CyberCP/lib
Expand Down Expand Up @@ -776,6 +821,17 @@ rm -f /usr/local/requirments.txt

chown -R cyberpanel:cyberpanel /usr/local/CyberCP/lib
chown -R cyberpanel:cyberpanel /usr/local/CyberCP/lib64



if [[ "$Server_OS_Version" = "9" ]] || [[ "$Server_OS_Version" = "8" ]]; then
echo "PYTHONHOME=/usr" > /usr/local/lscp/conf/pythonenv.conf
else
# Uncomment and use the following lines if necessary for other OS versions
# rsync -av --ignore-existing /usr/lib64/python3.9/ /usr/local/CyberCP/lib64/python3.9/
# Check_Return
:
fi
systemctl restart lscpd

}
Expand Down

0 comments on commit d76d2db

Please sign in to comment.