diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 195b86137..5969e9c00 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,6 +23,14 @@ jobs: echo "OK $f" done test -f preUpgrade.sh && test -f cyberpanel_upgrade.sh || { echo "Missing required scripts"; exit 1; } + if [ -d upgrade_modules ]; then + echo "=== Upgrade modules syntax ===" + for f in upgrade_modules/*.sh; do + [ -f "$f" ] || continue + bash -n "$f" || { echo "FAIL (syntax): $f"; exit 1; } + echo "OK $f" + done + fi echo "All shell scripts passed syntax check" validate-python: @@ -57,7 +65,15 @@ jobs: test -f "$f" || { echo "Missing: $f"; exit 1; } done grep -q 'BRANCH_NAME' preUpgrade.sh || exit 1 - grep -q 'Branch_Name\|download_install_phpmyadmin\|Branch_Check' cyberpanel_upgrade.sh || exit 1 + if [ -d upgrade_modules ]; then + for n in 00_common 01_variables 02_checks 03_mariadb 04_git_url 05_repository 06_components 07_branch_input 08_main_upgrade 09_sync 10_post_tweak 11_display_final; do + test -f "upgrade_modules/${n}.sh" || { echo "Missing: upgrade_modules/${n}.sh"; exit 1; } + done + grep -q 'Branch_Check\|Branch_Name' upgrade_modules/00_common.sh upgrade_modules/02_checks.sh || exit 1 + grep -q 'upgrade_modules\|Pre_Upgrade_Branch_Input\|Set_Default_Variables' cyberpanel_upgrade.sh || exit 1 + else + grep -q 'Branch_Name\|download_install_phpmyadmin\|Branch_Check' cyberpanel_upgrade.sh || exit 1 + fi echo "Key files OK" # Run validation inside a container per supported OS (AlmaLinux, CentOS, CloudLinux, Debian, RHEL, Rocky, Ubuntu). @@ -121,6 +137,16 @@ jobs: for f in preUpgrade.sh cyberpanel_upgrade.sh plogical/upgrade.py install/install.py plogical/versionFetcher.py; do test -f "$f" || { echo "Missing: $f"; exit 1; } done - grep -q "BRANCH_NAME" preUpgrade.sh && grep -q "Branch_Name\|download_install_phpmyadmin\|Branch_Check" cyberpanel_upgrade.sh || exit 1 + grep -q "BRANCH_NAME" preUpgrade.sh || exit 1 + if [ -d upgrade_modules ]; then + for n in 00_common 01_variables 02_checks 03_mariadb 04_git_url 05_repository 06_components 07_branch_input 08_main_upgrade 09_sync 10_post_tweak 11_display_final; do + test -f "upgrade_modules/${n}.sh" || { echo "Missing: upgrade_modules/${n}.sh"; exit 1; } + done + grep -q "Branch_Check\|Branch_Name" upgrade_modules/00_common.sh upgrade_modules/02_checks.sh || exit 1 + grep -q "upgrade_modules\|Pre_Upgrade_Branch_Input\|Set_Default_Variables" cyberpanel_upgrade.sh || exit 1 + for f in upgrade_modules/*.sh; do [ -f "$f" ] && bash -n "$f" || exit 1; done + else + grep -q "Branch_Name\|download_install_phpmyadmin\|Branch_Check" cyberpanel_upgrade.sh || exit 1 + fi echo "Done." ' diff --git a/cyberpanel_upgrade.sh b/cyberpanel_upgrade.sh index 9768f282c..5310008d9 100644 --- a/cyberpanel_upgrade.sh +++ b/cyberpanel_upgrade.sh @@ -5,7 +5,8 @@ if [[ $(id -u) -ne 0 ]] 2>/dev/null; then echo "" echo "This script must be run as root." - echo "Run: sudo bash <(curl -sL https://raw.githubusercontent.com/master3395/cyberpanel/stable/cyberpanel_upgrade.sh) -b v2.5.5-dev" + echo "Run: sudo bash <(curl -sL https://raw.githubusercontent.com/master3395/cyberpanel/stable/cyberpanel_upgrade.sh)" + echo " or for dev: .../cyberpanel_upgrade.sh) -b v2.5.5-dev" echo "Or: sudo su - then run the same command without sudo" echo "" exit 1 @@ -13,8 +14,8 @@ fi Sudo_Test=$(set) -# Parse -b/--branch for module download (when not running from repo) -BRANCH_FOR_MODULES="v2.5.5-dev" +# Parse -b/--branch for module download (when not running from repo). Default stable so one-liner works for both branches. +BRANCH_FOR_MODULES="stable" next="" for arg in "$@"; do if [[ "$arg" = "-b" ]] || [[ "$arg" = "--branch" ]]; then