From b24bd32a9ebd6b35beb3e805700f3a051f4d377d Mon Sep 17 00:00:00 2001 From: Emma Date: Fri, 19 Dec 2025 18:21:18 +0100 Subject: [PATCH 01/11] feat: start work on updater-v2 --- .github/workflows/release.yaml | 6 +-- blueprint.sh | 22 +++++++++-- scripts/commands/advanced/upgrade.sh | 58 ++++++++++++---------------- scripts/helpers/preupdate.sh | 18 +++++++++ 4 files changed, 64 insertions(+), 40 deletions(-) create mode 100644 scripts/helpers/preupdate.sh diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index fbd9d7f..a8a6b5b 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -36,7 +36,7 @@ jobs: env: REF_NAME: ${{ github.ref_name }} run: | - zip -r "${REF_NAME}.zip" * .eslintrc.js .prettierignore .prettierrc.json .shellcheckrc + zip -r "release.zip" * .eslintrc.js .prettierignore .prettierrc.json .shellcheckrc - name: Create changelog env: @@ -48,7 +48,7 @@ jobs: env: REF_NAME: ${{ github.ref_name }} run: | - SUM=`sha256sum "${REF_NAME}.zip"` + SUM=`sha256sum "release.zip"` echo -e "\n#### SHA256 Checksum\n\n\`\`\`\n$SUM\n\`\`\`\n" >> ./RELEASE_CHANGELOG echo "$SUM" > checksum.txt @@ -62,5 +62,5 @@ jobs: prerelease: ${{ contains(github.ref, 'rc') }} body_path: ./RELEASE_CHANGELOG files: | - ${{ github.ref_name }}.zip + release.zip checksum.txt diff --git a/blueprint.sh b/blueprint.sh index 47bda8e..101307e 100644 --- a/blueprint.sh +++ b/blueprint.sh @@ -10,7 +10,7 @@ BLUEPRINT_ENGINE="solstice" REPOSITORY="BlueprintFramework/framework" -VERSION="rolling" #; +VERSION="beta-2025-12" #; FOLDER=$(realpath "$(dirname "$0" 2> /dev/null)" 2> /dev/null) || FOLDER="$BLUEPRINT__FOLDER" OWNERSHIP="www-data:www-data" #; @@ -232,7 +232,7 @@ if [[ $1 != "-bash" ]]; then exit 2 else # Only run if Blueprint is not in the process of upgrading. - if [[ ( $BLUEPRINT_ENVIRONMENT != "upgrade" ) && ( $1 != "--post-upgrade" ) ]]; then + if [[ $BLUEPRINT_ENVIRONMENT != "upgrade2" ]]; then # Print Blueprint icon with ascii characters. C0="\x1b[0m" C1="\x1b[31;43;1m" @@ -246,9 +246,23 @@ if [[ $1 != "-bash" ]]; then export PROGRESS_TOTAL=15 export PROGRESS_NOW=0 + else + PROGRESS_TOTAL="$(("$PROGRESS_TOTAL" + 15))" fi if [[ $BLUEPRINT_ENVIRONMENT == "upgrade" ]]; then + echo -e "\x1b[30;41;1m YOU ARE USING THE LEGACY UPDATER!! \x1b[0m" + echo -e "\x1b[31;49;1mPlease rerun 'blueprint -upgrade' to continue the update process. This is NOT A BUG.\nPress ENTER to continue back to legacy updater (will fail) or ^C to terminate the process.\x1b[0m" + + echo -e "\n\n1. Terminate this process with CTRL+C (^C)" + echo -e "2. Run 'blueprint -upgrade'" + echo -e "3. Blueprint will update to the latest version." + + read -r + exit 1 + fi + + if [[ $BLUEPRINT_ENVIRONMENT == "upgrade2" ]]; then # Get rid of beta-2025-11 leftovers rm -rf resources/scripts/blueprint/utility resources/scripts/blueprint/css/BlueprintStylesheet.css resources/scripts/blueprint/index.ts fi @@ -257,7 +271,7 @@ if [[ $1 != "-bash" ]]; then PRINT INFO "Installing node modules.." # Check for yarn before installing node modules.. if ! [ -x "$(command -v yarn)" ]; then - PRINT FATAL "Missing dependency \"yarn\"." + PRINT FATAL "Missing dependency \"yarn\"." fi hide_progress fi @@ -417,7 +431,7 @@ if [[ $1 != "-bash" ]]; then sed -i "s~NOTINSTALLED~INSTALLED~g" "$FOLDER/app/BlueprintFramework/Services/PlaceholderService/BlueprintPlaceholderService.php" # Finish installation - if [[ ( $BLUEPRINT_ENVIRONMENT != "upgrade" ) && ( $1 != "--post-upgrade" ) ]]; then + if [[ $BLUEPRINT_ENVIRONMENT != "upgrade2" ]]; then PRINT SUCCESS "Blueprint has completed its installation process." hide_progress fi diff --git a/scripts/commands/advanced/upgrade.sh b/scripts/commands/advanced/upgrade.sh index 35c2499..753fe92 100644 --- a/scripts/commands/advanced/upgrade.sh +++ b/scripts/commands/advanced/upgrade.sh @@ -23,8 +23,8 @@ Command() { if [[ ${YN} != "continue" ]]; then PRINT INFO "Upgrade cancelled.";exit 1;fi YN="" - INSTALL_STEPS=15 - export PROGRESS_TOTAL="$((10 + "$INSTALL_STEPS"))" + # Initial steps count + export PROGRESS_TOTAL=9 export PROGRESS_NOW=0 if [[ $1 == "remote" ]]; then PRINT INFO "Fetching and pulling latest commit.." @@ -33,10 +33,6 @@ Command() { ((PROGRESS_NOW++)) mkdir "$FOLDER/.tmp" - cp blueprint.sh .blueprint.sh.bak - - ((PROGRESS_NOW++)) - HAS_DEV=false if [[ -n $(find .blueprint/dev -maxdepth 1 -type f -not -name ".gitkeep" -print -quit) ]]; then PRINT INFO "Backing up extension development files.." @@ -62,28 +58,34 @@ Command() { # download release hide_progress if [[ $3 == "" ]]; then - git clone "$REMOTE_REPOSITORY" main + git clone "$REMOTE_REPOSITORY" update else - git clone "$REMOTE_REPOSITORY" main --branch "$3" + git clone "$REMOTE_REPOSITORY" update --branch "$3" fi else # download latest release hide_progress - LOCATION=$(curl -s https://api.github.com/repos/"$REPOSITORY"/releases/latest \ - | grep "zipball_url" \ - | awk '{ print $2 }' \ - | sed 's/,$//' \ - | sed 's/"//g' ) \ - ; curl -L -o main.zip "$LOCATION" - - unzip main.zip - rm main.zip - mv ./* main + + PRINT DEBUG "setting TAG_NAME to $TAG_NAME" + TAG_NAME=$(curl -s https://api.github.com/repos/"$REPOSITORY"/releases/latest \ + | grep "tag_name" \ + | awk '{ print $2 }' \ + | sed 's/,$//' \ + | sed 's/"//g' ) + + PRINT DEBUG "attempting to pull https://github.com/$REPOSITORY.git to the update folder (branch: release/$TAG_NAME)" + git clone "https://github.com/$REPOSITORY.git" update --branch "release/$TAG_NAME" fi ((PROGRESS_NOW++)) - if [[ ! -d "main" ]]; then + PRINT INFO "Running next version's preupdater.." + + + ((PROGRESS_NOW++)) + + if [[ ! -d "update" ]]; then + PRINT DEBUG "update directory not found.. exiting" cd "$FOLDER" || cdhalt rm -r "$FOLDER/.tmp" &>> "$BLUEPRINT__DEBUG" rm "$FOLDER/.blueprint.sh.bak" &>> "$BLUEPRINT__DEBUG" @@ -94,22 +96,12 @@ Command() { ((PROGRESS_NOW++)) - # Remove some files/directories that don't have to be moved to the Pterodactyl folder. - PRINT INFO "Cleaning up fetched release.." - rm -r \ - "main/.github" \ - "main/.git" \ - "main/.gitignore" \ - "main/README.md" \ - &>> "$BLUEPRINT__DEBUG" - - ((PROGRESS_NOW++)) - # Copy fetched release files to the Pterodactyl directory and remove temp files. PRINT INFO "Moving release files to Pterodactyl directory.." - cp -r main/* "$FOLDER"/ + cp -r update/* "$FOLDER"/ + cp -r update/.* "$FOLDER"/ rm -r \ - "main" \ + "update" \ "$FOLDER"/.blueprint \ "$FOLDER"/.tmp/files cd "$FOLDER" || cdhalt @@ -137,7 +129,7 @@ Command() { chmod +x blueprint.sh mv "$FOLDER/blueprint" "$FOLDER/.blueprint" hide_progress - BLUEPRINT_ENVIRONMENT="upgrade" PROGRESS_NOW="$PROGRESS_NOW" PROGRESS_TOTAL="$PROGRESS_TOTAL" bash blueprint.sh + BLUEPRINT_ENVIRONMENT="upgrade2" PROGRESS_NOW="$PROGRESS_NOW" PROGRESS_TOTAL="$PROGRESS_TOTAL" bash blueprint.sh ((PROGRESS_NOW++)) diff --git a/scripts/helpers/preupdate.sh b/scripts/helpers/preupdate.sh new file mode 100644 index 0000000..f4e2a34 --- /dev/null +++ b/scripts/helpers/preupdate.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# $NEW_TAG: New Blueprint version that update.sh is updating to +# $OLD_TAG: Old Blueprint version that update.sh is updating from +# $RAN_BY_LEGACY: If this script is ran by the legacy updater +# $UPDATE_FOLDER: Folder with the update files + +# $FOLDER: Pterodactyl directory +# $REPOSITORY: GitHub repository +# $BLUEPRINT_ENGINE: Blueprint engine name +# $OWNERSHIP: Group that owns the Pterodactyl directory permissions +# $WEBUSER: User that owns the Pterodactyl directory permissions +# $USERSHELL: The shell used for extension scripts and stuff +# $BLUEPRINT__DEBUG: Blueprint debug directory for debug logs + +source ../libraries/logFormat.sh || echo "could not import logformat" + +exit 0 From f07885b733d4a6731e5c0e069f23360045d64369 Mon Sep 17 00:00:00 2001 From: Emma Date: Fri, 19 Dec 2025 19:29:52 +0100 Subject: [PATCH 02/11] feat: start rewriting the entire update utility --- scripts/commands/advanced/upgrade.sh | 173 +--------------------- scripts/commands/advanced/upgrade_old.sh | 177 +++++++++++++++++++++++ scripts/helpers/preupdate.sh | 2 + 3 files changed, 183 insertions(+), 169 deletions(-) create mode 100644 scripts/commands/advanced/upgrade_old.sh diff --git a/scripts/commands/advanced/upgrade.sh b/scripts/commands/advanced/upgrade.sh index 753fe92..f36f9eb 100644 --- a/scripts/commands/advanced/upgrade.sh +++ b/scripts/commands/advanced/upgrade.sh @@ -1,172 +1,7 @@ #!/bin/bash -Command() { - PRINT WARNING "This is an advanced feature, only proceed if you know what you are doing." +PRINT INPUT "Updates cannot be undone! Are you sure that you'd like to update? (y/b/n)" - # Confirmation question for developer upgrade. - if [[ $1 == "remote" ]]; then - PRINT INPUT "Upgrading to the latest development build will update Blueprint to a remote version which might differ from the latest release. Continue? (y/N)" - read -r YN - if [[ ( ${YN} != "y"* ) && ( ${YN} != "Y"* ) ]]; then PRINT INFO "Upgrade cancelled.";exit 1;fi - YN="" - fi - - # Confirmation question for both developer and stable upgrade. - PRINT INPUT "Upgrading will wipe your .blueprint folder and will deactivate all active extensions. Continue? (y/N)" - read -r YN - if [[ ( ${YN} != "y"* ) && ( ${YN} != "Y"* ) ]]; then PRINT INFO "Upgrade cancelled.";exit 1;fi - YN="" - - # Last confirmation question for both developer and stable upgrade. - PRINT INPUT "This is the last warning before upgrading/wiping Blueprint. Type 'continue' to continue, all other input will be taken as 'no'." - read -r YN - if [[ ${YN} != "continue" ]]; then PRINT INFO "Upgrade cancelled.";exit 1;fi - YN="" - - # Initial steps count - export PROGRESS_TOTAL=9 - export PROGRESS_NOW=0 - - if [[ $1 == "remote" ]]; then PRINT INFO "Fetching and pulling latest commit.." - else PRINT INFO "Fetching and pulling latest release.."; fi - - ((PROGRESS_NOW++)) - - mkdir "$FOLDER/.tmp" - HAS_DEV=false - if [[ -n $(find .blueprint/dev -maxdepth 1 -type f -not -name ".gitkeep" -print -quit) ]]; then - PRINT INFO "Backing up extension development files.." - mkdir -p "$FOLDER/.tmp" - cp .blueprint/dev "$FOLDER/.tmp/dev" -Rf - HAS_DEV=true - fi - - ((PROGRESS_NOW++)) - - mkdir -p "$FOLDER/.tmp/files" - cd "$FOLDER/.tmp/files" || cdhalt - if [[ $1 == "remote" ]]; then - if [[ $2 == "" ]]; then - REMOTE_REPOSITORY="https://github.com/$REPOSITORY.git" - else - if [[ $2 != "http://"* ]] && [[ $2 != "https://"* ]]; then - REMOTE_REPOSITORY="https://github.com/$2.git" - else - REMOTE_REPOSITORY="$2" - fi - fi - # download release - hide_progress - if [[ $3 == "" ]]; then - git clone "$REMOTE_REPOSITORY" update - else - git clone "$REMOTE_REPOSITORY" update --branch "$3" - fi - else - # download latest release - hide_progress - - PRINT DEBUG "setting TAG_NAME to $TAG_NAME" - TAG_NAME=$(curl -s https://api.github.com/repos/"$REPOSITORY"/releases/latest \ - | grep "tag_name" \ - | awk '{ print $2 }' \ - | sed 's/,$//' \ - | sed 's/"//g' ) - - PRINT DEBUG "attempting to pull https://github.com/$REPOSITORY.git to the update folder (branch: release/$TAG_NAME)" - git clone "https://github.com/$REPOSITORY.git" update --branch "release/$TAG_NAME" - fi - - ((PROGRESS_NOW++)) - - PRINT INFO "Running next version's preupdater.." - - - ((PROGRESS_NOW++)) - - if [[ ! -d "update" ]]; then - PRINT DEBUG "update directory not found.. exiting" - cd "$FOLDER" || cdhalt - rm -r "$FOLDER/.tmp" &>> "$BLUEPRINT__DEBUG" - rm "$FOLDER/.blueprint.sh.bak" &>> "$BLUEPRINT__DEBUG" - PRINT FATAL "Remote does not exist or encountered an error, try again later." - hide_progress - exit 1 - fi - - ((PROGRESS_NOW++)) - - # Copy fetched release files to the Pterodactyl directory and remove temp files. - PRINT INFO "Moving release files to Pterodactyl directory.." - cp -r update/* "$FOLDER"/ - cp -r update/.* "$FOLDER"/ - rm -r \ - "update" \ - "$FOLDER"/.blueprint \ - "$FOLDER"/.tmp/files - cd "$FOLDER" || cdhalt - - ((PROGRESS_NOW++)) - - # Clean up folders with potentially broken symlinks. - rm \ - "resources/views/blueprint/admin/wrappers/"* \ - "resources/views/blueprint/dashboard/wrappers/"* \ - "routes/blueprint/application/"* \ - "routes/blueprint/client/"* \ - "routes/blueprint/web/"* \ - &>> /dev/null # cannot forward to debug dir because it does not exist - - ((PROGRESS_NOW++)) - - # Deprecated, kept in for backwards compatibility - sed -i -E \ - -e "s|OWNERSHIP=\"www-data:www-data\" #;|OWNERSHIP=\"$OWNERSHIP\" #;|g" \ - -e "s|WEBUSER=\"www-data\" #;|WEBUSER=\"$WEBUSER\" #;|g" \ - -e "s|USERSHELL=\"/bin/bash\" #;|USERSHELL=\"$USERSHELL\" #;|g" \ - "$FOLDER/blueprint.sh" - - chmod +x blueprint.sh - mv "$FOLDER/blueprint" "$FOLDER/.blueprint" - hide_progress - BLUEPRINT_ENVIRONMENT="upgrade2" PROGRESS_NOW="$PROGRESS_NOW" PROGRESS_TOTAL="$PROGRESS_TOTAL" bash blueprint.sh - - ((PROGRESS_NOW++)) - - if [[ ${HAS_DEV} == true ]]; then - PRINT INFO "Restoring extension development files.." - rm -rf .blueprint/dev - mv "$FOLDER/.tmp/dev" .blueprint/dev - fi - - rm -r "$FOLDER/.tmp" - - ((PROGRESS_NOW++)) - - # Post-upgrade checks. - PRINT INFO "Validating update.." - score=0 - - if dbValidate "blueprint.setupFinished"; then score=$((score+1)) - else PRINT WARNING "'blueprint.setupFinished' could not be detected or found."; fi - - # Finalize upgrade. - if [[ ${score} == 1 ]]; then - PRINT SUCCESS "Upgrade finished." - hide_progress - rm .blueprint.sh.bak - exit 0 # success - elif [[ ${score} == 0 ]]; then - PRINT FATAL "All checks have failed. The 'blueprint.sh' file has been reverted." - hide_progress - rm blueprint.sh - mv .blueprint.sh.bak blueprint.sh - exit 1 # error - else - PRINT FATAL "Some checks have failed. The 'blueprint.sh' file has been reverted." - hide_progress - rm blueprint.sh - mv .blueprint.sh.bak blueprint.sh - exit 1 # error - fi -} +echo -e "\x1b[35;47;1m y \x1b[0m Update Blueprint" +echo -e "\x1b[35;47;1m b \x1b[0m Update Blueprint and take a backup" +echo -e "\x1b[31;47;1m n \x1b[0m Cancel command" diff --git a/scripts/commands/advanced/upgrade_old.sh b/scripts/commands/advanced/upgrade_old.sh new file mode 100644 index 0000000..e2f2dc4 --- /dev/null +++ b/scripts/commands/advanced/upgrade_old.sh @@ -0,0 +1,177 @@ +#!/bin/bash + +Command() { + PRINT WARNING "This is an advanced feature, only proceed if you know what you are doing." + + # Confirmation question for developer upgrade. + if [[ $1 == "remote" ]]; then + PRINT INPUT "Upgrading to the latest development build will update Blueprint to a remote version which might differ from the latest release. Continue? (y/N)" + read -r YN + if [[ ( ${YN} != "y"* ) && ( ${YN} != "Y"* ) ]]; then PRINT INFO "Upgrade cancelled.";exit 1;fi + YN="" + fi + + # Confirmation question for both developer and stable upgrade. + PRINT INPUT "Upgrading will wipe your .blueprint folder and will deactivate all active extensions. Continue? (y/N)" + read -r YN + if [[ ( ${YN} != "y"* ) && ( ${YN} != "Y"* ) ]]; then PRINT INFO "Upgrade cancelled.";exit 1;fi + YN="" + + # Last confirmation question for both developer and stable upgrade. + PRINT INPUT "This is the last warning before upgrading/wiping Blueprint. Type 'continue' to continue, all other input will be taken as 'no'." + read -r YN + if [[ ${YN} != "continue" ]]; then PRINT INFO "Upgrade cancelled.";exit 1;fi + YN="" + + # Initial steps count + export PROGRESS_TOTAL=9 + export PROGRESS_NOW=0 + + if [[ $1 == "remote" ]]; then PRINT INFO "Fetching and pulling latest commit.." + else PRINT INFO "Fetching and pulling latest release.."; fi + + ((PROGRESS_NOW++)) + + mkdir "$FOLDER/.tmp" + HAS_DEV=false + if [[ -n $(find .blueprint/dev -maxdepth 1 -type f -not -name ".gitkeep" -print -quit) ]]; then + PRINT INFO "Backing up extension development files.." + mkdir -p "$FOLDER/.tmp" + cp .blueprint/dev "$FOLDER/.tmp/dev" -Rf + HAS_DEV=true + fi + + ((PROGRESS_NOW++)) + + mkdir -p "$FOLDER/.tmp/files" + cd "$FOLDER/.tmp/files" || cdhalt + if [[ $1 == "remote" ]]; then + if [[ $2 == "" ]]; then + REMOTE_REPOSITORY="https://github.com/$REPOSITORY.git" + else + if [[ $2 != "http://"* ]] && [[ $2 != "https://"* ]]; then + REMOTE_REPOSITORY="https://github.com/$2.git" + else + REMOTE_REPOSITORY="$2" + fi + fi + # download release + hide_progress + if [[ $3 == "" ]]; then + git clone "$REMOTE_REPOSITORY" update + else + git clone "$REMOTE_REPOSITORY" update --branch "$3" + fi + else + # download latest release + hide_progress + + PRINT DEBUG "setting TAG_NAME to $TAG_NAME" + TAG_NAME=$(curl -s https://api.github.com/repos/"$REPOSITORY"/releases/latest \ + | grep "tag_name" \ + | awk '{ print $2 }' \ + | sed 's/,$//' \ + | sed 's/"//g' ) + + PRINT DEBUG "attempting to pull https://github.com/$REPOSITORY.git to the update folder (branch: release/$TAG_NAME)" + git clone "https://github.com/$REPOSITORY.git" update --branch "release/$TAG_NAME" + fi + + ((PROGRESS_NOW++)) + + PRINT INFO "Running updater.." + + NEW_TAG="$TAG_NAME" \ + OLD_TAG="$VERSION" \ + RAN_BY_LEGACY=false \ + UPDATE_FOLDER="$FOLDER/.tmp/files/update" \ + PROGRESS_NOW="$PROGRESS_NOW" \ + PROGRESS_TOTAL="$PROGRESS_TOTAL" \ + FOLDER="$FOLDER" \ + REPOSITORY="$REPOSITORY" \ + BLUEPRINT_ENGINE="$BLUEPRINT_ENGINE" \ + OWNERSHIP="$OWNERSHIP" \ + WEBUSER="$WEBUSER" \ + USERSHELL="$USERSHELL" \ + BLUEPRINT__DEBUG="$BLUEPRINT__DEBUG" \ + bash update/scripts/helpers/preupdate.sh + + ((PROGRESS_NOW++)) + + if [[ ! -d "update" ]]; then + PRINT DEBUG "update directory not found.. exiting" + cd "$FOLDER" || cdhalt + rm -r "$FOLDER/.tmp" &>> "$BLUEPRINT__DEBUG" + PRINT FATAL "Remote does not exist or encountered an error, try again later." + hide_progress + exit 1 + fi + + ((PROGRESS_NOW++)) + + # Copy fetched release files to the Pterodactyl directory and remove temp files. + PRINT INFO "Moving release files to Pterodactyl directory.." + cp -r update/* "$FOLDER"/ + cp -r update/.* "$FOLDER"/ + rm -r \ + "update" \ + "$FOLDER"/.blueprint \ + "$FOLDER"/.tmp/files + cd "$FOLDER" || cdhalt + + ((PROGRESS_NOW++)) + + # Clean up folders with potentially broken symlinks. + rm \ + "resources/views/blueprint/admin/wrappers/"* \ + "resources/views/blueprint/dashboard/wrappers/"* \ + "routes/blueprint/application/"* \ + "routes/blueprint/client/"* \ + "routes/blueprint/web/"* \ + &>> /dev/null # cannot forward to debug dir because it does not exist + + ((PROGRESS_NOW++)) + + # Deprecated, kept in for backwards compatibility + sed -i -E \ + -e "s|OWNERSHIP=\"www-data:www-data\" #;|OWNERSHIP=\"$OWNERSHIP\" #;|g" \ + -e "s|WEBUSER=\"www-data\" #;|WEBUSER=\"$WEBUSER\" #;|g" \ + -e "s|USERSHELL=\"/bin/bash\" #;|USERSHELL=\"$USERSHELL\" #;|g" \ + "$FOLDER/blueprint.sh" + + chmod +x blueprint.sh + mv "$FOLDER/blueprint" "$FOLDER/.blueprint" + hide_progress + BLUEPRINT_ENVIRONMENT="upgrade2" PROGRESS_NOW="$PROGRESS_NOW" PROGRESS_TOTAL="$PROGRESS_TOTAL" bash blueprint.sh + + ((PROGRESS_NOW++)) + + if [[ ${HAS_DEV} == true ]]; then + PRINT INFO "Restoring extension development files.." + rm -rf .blueprint/dev + mv "$FOLDER/.tmp/dev" .blueprint/dev + fi + + rm -r "$FOLDER/.tmp" + + ((PROGRESS_NOW++)) + + # Post-upgrade checks. + PRINT INFO "Validating update.." + score=0 + + if dbValidate "blueprint.setupFinished"; then score=$((score+1)) + else PRINT WARNING "'blueprint.setupFinished' could not be detected or found."; fi + + # Finalize upgrade. + if [[ ${score} == 1 ]]; then + PRINT SUCCESS "Upgrade finished." + hide_progress + rm .blueprint.sh.bak + exit 0 # success + else + PRINT FATAL "Upgrade has failed." + hide_progress + exit 1 # error + fi +} diff --git a/scripts/helpers/preupdate.sh b/scripts/helpers/preupdate.sh index f4e2a34..8e66762 100644 --- a/scripts/helpers/preupdate.sh +++ b/scripts/helpers/preupdate.sh @@ -4,6 +4,8 @@ # $OLD_TAG: Old Blueprint version that update.sh is updating from # $RAN_BY_LEGACY: If this script is ran by the legacy updater # $UPDATE_FOLDER: Folder with the update files +# $PROGRESS_NOW: Current loader progress +# $PROGRESS_TOTAL: Total loader progress # $FOLDER: Pterodactyl directory # $REPOSITORY: GitHub repository From cecdb611aa0c3398c7cbb846ef60a794e7177d39 Mon Sep 17 00:00:00 2001 From: prplwtf Date: Fri, 19 Dec 2025 20:37:07 +0100 Subject: [PATCH 03/11] feat: move preupdate and continue work on updater --- CODE_OF_CONDUCT.md | 31 +------ blueprint.sh | 5 +- scripts/commands/advanced/upgrade.sh | 105 +++++++++++++++++++++- scripts/{helpers => updater}/preupdate.sh | 0 4 files changed, 105 insertions(+), 36 deletions(-) rename scripts/{helpers => updater}/preupdate.sh (100%) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 3eca9ed..8bf86d9 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,32 +1,3 @@ ![Code of conduct](https://github.com/user-attachments/assets/c65201ac-400b-41c4-9fdf-a0abeb82048e) - -## Community Code of Conduct -Blueprint's Code of Conduct is designed to create a welcoming and inclusive environment for all members of our community. By adhering to these guidelines, we can ensure a positive experience for everyone. - -1. **Respect and Inclusivity**\ -• Treat all members with respect, kindness, and consideration.\ -• Embrace diversity and be inclusive of different backgrounds, perspectives, and experiences. - -2. **Communication**\ -• Communicate openly and honestly, but also thoughtfully.\ -• Listen actively and be open to feedback and differing opinions.\ -• Avoid using offensive language, personal attacks, or harassment. - -3. **Collaboration**\ -• Foster a spirit of collaboration and teamwork.\ -• Support one another in achieving community goals. - -4. **Conflict Resolution**\ -• Address conflicts constructively and privately when possible.\ -• Seek mediation from a community leader or moderator if needed. - -5. **Privacy and Safety**\ -• Respect the privacy of others and do not share personal information without consent.\ -• Create a safe space for all members, free from bullying, discrimination, or intimidation. - -6. **Accountability**\ -• Take responsibility for your actions and their impact on the community.\ -• Report any violations of this Code of Conduct to a community leader or moderator. - -By following this Code of Conduct, we can create a positive and supportive community for everyone. +## Blueprint's [code of conduct](https://blueprint.zip/legal/conduct) applies to this project. diff --git a/blueprint.sh b/blueprint.sh index 101307e..2a2cc13 100644 --- a/blueprint.sh +++ b/blueprint.sh @@ -10,6 +10,7 @@ BLUEPRINT_ENGINE="solstice" REPOSITORY="BlueprintFramework/framework" +REPOSITORY_BRANCH="main" VERSION="beta-2025-12" #; FOLDER=$(realpath "$(dirname "$0" 2> /dev/null)" 2> /dev/null) || FOLDER="$BLUEPRINT__FOLDER" @@ -252,9 +253,9 @@ if [[ $1 != "-bash" ]]; then if [[ $BLUEPRINT_ENVIRONMENT == "upgrade" ]]; then echo -e "\x1b[30;41;1m YOU ARE USING THE LEGACY UPDATER!! \x1b[0m" - echo -e "\x1b[31;49;1mPlease rerun 'blueprint -upgrade' to continue the update process. This is NOT A BUG.\nPress ENTER to continue back to legacy updater (will fail) or ^C to terminate the process.\x1b[0m" + echo -e "\n\x1b[31;49;1mPlease rerun 'blueprint -upgrade' to continue the update process. This is NOT A BUG.\nPress ENTER to continue back to legacy updater (will fail) or ^C to terminate the process.\x1b[0m" - echo -e "\n\n1. Terminate this process with CTRL+C (^C)" + echo -e "\n1. Terminate this process with CTRL+C (^C)" echo -e "2. Run 'blueprint -upgrade'" echo -e "3. Blueprint will update to the latest version." diff --git a/scripts/commands/advanced/upgrade.sh b/scripts/commands/advanced/upgrade.sh index f36f9eb..de7b48c 100644 --- a/scripts/commands/advanced/upgrade.sh +++ b/scripts/commands/advanced/upgrade.sh @@ -1,7 +1,104 @@ #!/bin/bash -PRINT INPUT "Updates cannot be undone! Are you sure that you'd like to update? (y/b/n)" +Command() { + # Confirmation question before updating Blueprint + PRINT INPUT "You are about to update your Blueprint installation. Continue? (y/N)" + read -r update_choice + if [[ ( ${update_choice} != "y"* ) && ( ${update_choice} != "Y"* ) ]]; then + # Exit when cancelled by user + PRINT INFO "Upgrade cancelled by user." + exit 1 + fi + update_choice="" -echo -e "\x1b[35;47;1m y \x1b[0m Update Blueprint" -echo -e "\x1b[35;47;1m b \x1b[0m Update Blueprint and take a backup" -echo -e "\x1b[31;47;1m n \x1b[0m Cancel command" + # Initial steps count for progress bar + export PROGRESS_TOTAL=10 + export PROGRESS_NOW=0 + + # Make sure the script is in $FOLDER + cd "$FOLDER" || exit 1 + + # Create temporary directory for upgrade files + PRINT INFO "Creating .update directory.." + mkdir -p .update + + # Define cleanup for this step + cleanup() { + cd "$FOLDER" || exit 1 + rm -rf .update + + if [[ $1 != "" ]]; then + exit "$1" + fi + } + + ((PROGRESS_NOW++)) + + # Prepare repository URL + if [[ $1 == "remote" ]]; then + PRINT DEBUG "\$1 was 'remote'" + case $2 in + # Custom git repository + *.git|http://*|https://*) + PRINT DEBUG "setting remote_repo to '$2', remote_branch to '$3'" + remote_repo="$2" + remote_branch="$3" + + if [[ $remote_branch == "" ]]; then + PRINT FATAL "Expected a git branch at argument 3, was empty. Exiting.." + cleanup 1 + fi + if [[ $remote_branch != *.git ]]; then + PRINT FATAL "Expected a git repository at argument 2, was invalid. (Did you forget to prepend your argument with .git?) Exiting.." + cleanup 1 + fi + ;; + + # Custom GitHub repository + */*) + PRINT DEBUG "setting remote_repo to 'https://github.com/$2.git', remote_branch to '$3'" + remote_repo="https://github.com/$2.git" + remote_branch="$3" + + if [[ $remote_branch == "" ]]; then + PRINT FATAL "Expected a git branch at argument 3, was empty. Exiting.." + cleanup 1 + fi + ;; + + # Blueprint default repository + "") + PRINT INFO "No git repository provided, defaulting to '$REPOSITORY' (repo) and '$REPOSITORY_BRANCH' (branch)!" + PRINT DEBUG "setting remote_repo to 'https://github.com/$REPOSITORY.git'" + remote_repo="https://github.com/$REPOSITORY.git" + remote_branch="$REPOSITORY_BRANCH" + ;; + + # Invalid repository provided + *) + PRINT DEBUG "Invalid repository provided" + PRINT FATAL "Expected a GitHub repository name or git repo url at argument 2, but was invalid. Exiting.." + cleanup 1 + ;; + esac + else + PRINT DEBUG "\$1 was NOT 'remote' (it was '$1')" + fi + + ((PROGRESS_NOW++)) + + # Fetching repository with git + PRINT INFO "Downloading repository.." + git clone "$remote_repo" .update/repo --branch "$remote_branch" + + if [[ ! -d ".update/repo" ]]; then + PRINT FATAL "Could not download repository! Exiting.." + cleanup 1 + fi + + ((PROGRESS_NOW++)) + + # Run update script + PRINT INFO "Running update script.." + bash .update/repo +} diff --git a/scripts/helpers/preupdate.sh b/scripts/updater/preupdate.sh similarity index 100% rename from scripts/helpers/preupdate.sh rename to scripts/updater/preupdate.sh From 425b373e4767f8e7bf7187035ec0e38fac581301 Mon Sep 17 00:00:00 2001 From: prplwtf Date: Fri, 19 Dec 2025 20:37:28 +0100 Subject: [PATCH 04/11] feat: move preupdate again :sob: --- scripts/updater/{preupdate.sh => update.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/updater/{preupdate.sh => update.sh} (100%) diff --git a/scripts/updater/preupdate.sh b/scripts/updater/update.sh similarity index 100% rename from scripts/updater/preupdate.sh rename to scripts/updater/update.sh From 06927dc8d109b700905c968306ea0f2aaf3758db Mon Sep 17 00:00:00 2001 From: prplwtf Date: Fri, 19 Dec 2025 21:40:50 +0100 Subject: [PATCH 05/11] feat: maybe functional?? --- blueprint.sh | 6 +- scripts/commands/advanced/upgrade.sh | 83 +++++++++++++++++++++++- scripts/commands/advanced/upgrade_old.sh | 19 ------ scripts/updater/update.sh | 29 ++++----- 4 files changed, 94 insertions(+), 43 deletions(-) diff --git a/blueprint.sh b/blueprint.sh index 2a2cc13..dd7c229 100644 --- a/blueprint.sh +++ b/blueprint.sh @@ -255,9 +255,9 @@ if [[ $1 != "-bash" ]]; then echo -e "\x1b[30;41;1m YOU ARE USING THE LEGACY UPDATER!! \x1b[0m" echo -e "\n\x1b[31;49;1mPlease rerun 'blueprint -upgrade' to continue the update process. This is NOT A BUG.\nPress ENTER to continue back to legacy updater (will fail) or ^C to terminate the process.\x1b[0m" - echo -e "\n1. Terminate this process with CTRL+C (^C)" - echo -e "2. Run 'blueprint -upgrade'" - echo -e "3. Blueprint will update to the latest version." + echo -e "\n\x1b[31;49m1. Terminate this process with CTRL+C (^C)\x1b[0m" + echo -e "\n\x1b[31;49m2. Run 'blueprint -upgrade'\x1b[0m" + echo -e "\n\x1b[31;49m3. Blueprint will update to the latest version.\x1b[0m" read -r exit 1 diff --git a/scripts/commands/advanced/upgrade.sh b/scripts/commands/advanced/upgrade.sh index de7b48c..3103bda 100644 --- a/scripts/commands/advanced/upgrade.sh +++ b/scripts/commands/advanced/upgrade.sh @@ -12,22 +12,35 @@ Command() { update_choice="" # Initial steps count for progress bar - export PROGRESS_TOTAL=10 + export PROGRESS_TOTAL=7 export PROGRESS_NOW=0 # Make sure the script is in $FOLDER cd "$FOLDER" || exit 1 + # Export the repository variables + export remote_repo + export remote_branch + export fetched_version + # Create temporary directory for upgrade files PRINT INFO "Creating .update directory.." mkdir -p .update - # Define cleanup for this step + # Define cleanup cleanup() { + PRINT INFO "Cleaning up.." cd "$FOLDER" || exit 1 + + if [[ $development_files == true ]]; then + PRINT INFO "Restoring extension development files.." + rm -rf .blueprint/dev + mv .update/backup/dev .blueprint/dev + fi rm -rf .update if [[ $1 != "" ]]; then + hide_progress exit "$1" fi } @@ -83,12 +96,23 @@ Command() { esac else PRINT DEBUG "\$1 was NOT 'remote' (it was '$1')" + PRINT INFO "Fetching version info" + + php artisan bp:version:cache 2> $BLUEPRINT__DEBUG + tag_latest=$(php artisan bp:version:latest) + PRINT DEBUG "tag_latest is $tag_latest" + + fetched_version="$tag_latest" + remote_repo="https://github.com/$REPOSITORY.git" + remote_branch="release/$tag_latest" + PRINT DEBUG "set remote_repo to '$remote_repo', remote_branch to '$remote_branch'" fi ((PROGRESS_NOW++)) # Fetching repository with git PRINT INFO "Downloading repository.." + hide_progress git clone "$remote_repo" .update/repo --branch "$remote_branch" if [[ ! -d ".update/repo" ]]; then @@ -98,7 +122,60 @@ Command() { ((PROGRESS_NOW++)) + # Determine and backup development files + development_files=false + if [[ -n $(find .blueprint/dev -maxdepth 1 -type f -not -name ".gitkeep" -print -quit) ]]; then + development_files=true + PRINT INFO "Backing up extension development files.." + mkdir -p .update/backup + cp -Rf .blueprint/dev .update/backup/dev + fi + + ((PROGRESS_NOW++)) + + # Delete files + PRINT INFO "Deleting files.." + rm -rf .blueprint + + # Clean up folders with potentially broken symlinks. + rm \ + "resources/views/blueprint/admin/wrappers/"* \ + "resources/views/blueprint/dashboard/wrappers/"* \ + "routes/blueprint/application/"* \ + "routes/blueprint/client/"* \ + "routes/blueprint/web/"* \ + &>> /dev/null # cannot forward to debug dir because it does not exist + + ((PROGRESS_NOW++)) + # Run update script PRINT INFO "Running update script.." - bash .update/repo + source .update/repo/scripts/updater/update.sh + hide_progress + UpdaterInstall + + ((PROGRESS_NOW++)) + + # Deprecated, kept in for backwards compatibility + sed -i -E \ + -e "s|OWNERSHIP=\"www-data:www-data\" #;|OWNERSHIP=\"$OWNERSHIP\" #;|g" \ + -e "s|WEBUSER=\"www-data\" #;|WEBUSER=\"$WEBUSER\" #;|g" \ + -e "s|USERSHELL=\"/bin/bash\" #;|USERSHELL=\"$USERSHELL\" #;|g" \ + blueprint.sh + + # Run install script + PRINT INFO "Running final install script.." + chmod +x blueprint.sh + mv "$FOLDER/blueprint" "$FOLDER/.blueprint" + hide_progress + BLUEPRINT_ENVIRONMENT="upgrade2" PROGRESS_NOW="$PROGRESS_NOW" PROGRESS_TOTAL="$PROGRESS_TOTAL" bash blueprint.sh + + ((PROGRESS_NOW++)) + + cleanup + + # Tell user that update has finished + PRINT SUCCESS "Update finished!" + hide_progress + exit 0 } diff --git a/scripts/commands/advanced/upgrade_old.sh b/scripts/commands/advanced/upgrade_old.sh index e2f2dc4..6114477 100644 --- a/scripts/commands/advanced/upgrade_old.sh +++ b/scripts/commands/advanced/upgrade_old.sh @@ -79,25 +79,6 @@ Command() { ((PROGRESS_NOW++)) - PRINT INFO "Running updater.." - - NEW_TAG="$TAG_NAME" \ - OLD_TAG="$VERSION" \ - RAN_BY_LEGACY=false \ - UPDATE_FOLDER="$FOLDER/.tmp/files/update" \ - PROGRESS_NOW="$PROGRESS_NOW" \ - PROGRESS_TOTAL="$PROGRESS_TOTAL" \ - FOLDER="$FOLDER" \ - REPOSITORY="$REPOSITORY" \ - BLUEPRINT_ENGINE="$BLUEPRINT_ENGINE" \ - OWNERSHIP="$OWNERSHIP" \ - WEBUSER="$WEBUSER" \ - USERSHELL="$USERSHELL" \ - BLUEPRINT__DEBUG="$BLUEPRINT__DEBUG" \ - bash update/scripts/helpers/preupdate.sh - - ((PROGRESS_NOW++)) - if [[ ! -d "update" ]]; then PRINT DEBUG "update directory not found.. exiting" cd "$FOLDER" || cdhalt diff --git a/scripts/updater/update.sh b/scripts/updater/update.sh index 8e66762..36ee287 100644 --- a/scripts/updater/update.sh +++ b/scripts/updater/update.sh @@ -1,20 +1,13 @@ #!/bin/bash -# $NEW_TAG: New Blueprint version that update.sh is updating to -# $OLD_TAG: Old Blueprint version that update.sh is updating from -# $RAN_BY_LEGACY: If this script is ran by the legacy updater -# $UPDATE_FOLDER: Folder with the update files -# $PROGRESS_NOW: Current loader progress -# $PROGRESS_TOTAL: Total loader progress - -# $FOLDER: Pterodactyl directory -# $REPOSITORY: GitHub repository -# $BLUEPRINT_ENGINE: Blueprint engine name -# $OWNERSHIP: Group that owns the Pterodactyl directory permissions -# $WEBUSER: User that owns the Pterodactyl directory permissions -# $USERSHELL: The shell used for extension scripts and stuff -# $BLUEPRINT__DEBUG: Blueprint debug directory for debug logs - -source ../libraries/logFormat.sh || echo "could not import logformat" - -exit 0 +UpdaterInstall() { + # Copy release files to Pterodactyl directory + PRINT INFO "Copying release files to Pterodactyl directory.." + cp -r .update/repo/* . + cp .eslintrc.js . + cp .prettierignore . + cp .prettierrc.json . + cp .shellcheckrc . + + exit 0 +} From 5174eeac604e4bb9fbafc13deeb4ca7f22a9643e Mon Sep 17 00:00:00 2001 From: prplwtf Date: Fri, 19 Dec 2025 21:44:17 +0100 Subject: [PATCH 06/11] feat: maybe??? --- scripts/commands/advanced/upgrade.sh | 2 +- scripts/libraries/logFormat.sh | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/commands/advanced/upgrade.sh b/scripts/commands/advanced/upgrade.sh index 3103bda..4471594 100644 --- a/scripts/commands/advanced/upgrade.sh +++ b/scripts/commands/advanced/upgrade.sh @@ -166,7 +166,7 @@ Command() { # Run install script PRINT INFO "Running final install script.." chmod +x blueprint.sh - mv "$FOLDER/blueprint" "$FOLDER/.blueprint" + mv blueprint .blueprint hide_progress BLUEPRINT_ENVIRONMENT="upgrade2" PROGRESS_NOW="$PROGRESS_NOW" PROGRESS_TOTAL="$PROGRESS_TOTAL" bash blueprint.sh diff --git a/scripts/libraries/logFormat.sh b/scripts/libraries/logFormat.sh index e98f271..40fa578 100644 --- a/scripts/libraries/logFormat.sh +++ b/scripts/libraries/logFormat.sh @@ -1,5 +1,5 @@ #!/bin/bash -# +# # This script has been created as part of the Blueprint source code # and uses the same license as the rest of the codebase. @@ -97,10 +97,12 @@ PRINT() { echo -e "${SECONDARY}${DATE}${RESET} ${PRIMARY}${TYPE}:${RESET} $MESSAGE${RESET}" fi - echo -e "${BOLD}${SECONDARY}$DATEDEBUG${RESET} ${PRIMARY}${TYPE}:${RESET} $MESSAGE" >> "$FOLDER"/.blueprint/extensions/blueprint/private/debug/logs.txt + if [[ -d "$FOLDER"/.blueprint/extensions/blueprint/private/debug/logs.txt ]]; then + echo -e "${BOLD}${SECONDARY}$DATEDEBUG${RESET} ${PRIMARY}${TYPE}:${RESET} $MESSAGE" >> "$FOLDER"/.blueprint/extensions/blueprint/private/debug/logs.txt + fi # If progress variables exist, draw progress bar if [[ -n "${PROGRESS_TOTAL}" && -n "${PROGRESS_NOW}" ]]; then draw_progress "${PROGRESS_NOW}" "${PROGRESS_TOTAL}" fi -} \ No newline at end of file +} From 0bebefa108ed76cfa10886e113cfb17a1ecc7707 Mon Sep 17 00:00:00 2001 From: prplwtf Date: Fri, 19 Dec 2025 21:45:23 +0100 Subject: [PATCH 07/11] fix: oh i see im stupid --- scripts/updater/update.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/updater/update.sh b/scripts/updater/update.sh index 36ee287..70a52f3 100644 --- a/scripts/updater/update.sh +++ b/scripts/updater/update.sh @@ -4,10 +4,10 @@ UpdaterInstall() { # Copy release files to Pterodactyl directory PRINT INFO "Copying release files to Pterodactyl directory.." cp -r .update/repo/* . - cp .eslintrc.js . - cp .prettierignore . - cp .prettierrc.json . - cp .shellcheckrc . + cp .update/repo/.eslintrc.js . + cp .update/repo/.prettierignore . + cp .update/repo/.prettierrc.json . + cp .update/repo/.shellcheckrc . exit 0 } From a104c8e5561872285d5c291e2cf409443d086df0 Mon Sep 17 00:00:00 2001 From: prplwtf Date: Fri, 19 Dec 2025 22:00:08 +0100 Subject: [PATCH 08/11] fix: slight fixes because it was being stupid --- scripts/commands/advanced/upgrade.sh | 5 +++++ scripts/updater/update.sh | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/commands/advanced/upgrade.sh b/scripts/commands/advanced/upgrade.sh index 4471594..19ab7fc 100644 --- a/scripts/commands/advanced/upgrade.sh +++ b/scripts/commands/advanced/upgrade.sh @@ -23,6 +23,11 @@ Command() { export remote_branch export fetched_version + if [[ -d '.update' ]]; then + PRINT WARNING ".update already exists! Replacing it." + rm -rf .update + fi + # Create temporary directory for upgrade files PRINT INFO "Creating .update directory.." mkdir -p .update diff --git a/scripts/updater/update.sh b/scripts/updater/update.sh index 70a52f3..d2e1950 100644 --- a/scripts/updater/update.sh +++ b/scripts/updater/update.sh @@ -8,6 +8,4 @@ UpdaterInstall() { cp .update/repo/.prettierignore . cp .update/repo/.prettierrc.json . cp .update/repo/.shellcheckrc . - - exit 0 } From 6155d6ddbf27bcec1916dcccaff1899648267cc4 Mon Sep 17 00:00:00 2001 From: prplwtf Date: Fri, 19 Dec 2025 22:07:19 +0100 Subject: [PATCH 09/11] feat: shellcheck and clean up old upgrade script --- scripts/commands/advanced/upgrade.sh | 2 +- scripts/commands/advanced/upgrade_old.sh | 158 ----------------------- 2 files changed, 1 insertion(+), 159 deletions(-) delete mode 100644 scripts/commands/advanced/upgrade_old.sh diff --git a/scripts/commands/advanced/upgrade.sh b/scripts/commands/advanced/upgrade.sh index 19ab7fc..de34c63 100644 --- a/scripts/commands/advanced/upgrade.sh +++ b/scripts/commands/advanced/upgrade.sh @@ -103,7 +103,7 @@ Command() { PRINT DEBUG "\$1 was NOT 'remote' (it was '$1')" PRINT INFO "Fetching version info" - php artisan bp:version:cache 2> $BLUEPRINT__DEBUG + php artisan bp:version:cache 2> "$BLUEPRINT__DEBUG" tag_latest=$(php artisan bp:version:latest) PRINT DEBUG "tag_latest is $tag_latest" diff --git a/scripts/commands/advanced/upgrade_old.sh b/scripts/commands/advanced/upgrade_old.sh deleted file mode 100644 index 6114477..0000000 --- a/scripts/commands/advanced/upgrade_old.sh +++ /dev/null @@ -1,158 +0,0 @@ -#!/bin/bash - -Command() { - PRINT WARNING "This is an advanced feature, only proceed if you know what you are doing." - - # Confirmation question for developer upgrade. - if [[ $1 == "remote" ]]; then - PRINT INPUT "Upgrading to the latest development build will update Blueprint to a remote version which might differ from the latest release. Continue? (y/N)" - read -r YN - if [[ ( ${YN} != "y"* ) && ( ${YN} != "Y"* ) ]]; then PRINT INFO "Upgrade cancelled.";exit 1;fi - YN="" - fi - - # Confirmation question for both developer and stable upgrade. - PRINT INPUT "Upgrading will wipe your .blueprint folder and will deactivate all active extensions. Continue? (y/N)" - read -r YN - if [[ ( ${YN} != "y"* ) && ( ${YN} != "Y"* ) ]]; then PRINT INFO "Upgrade cancelled.";exit 1;fi - YN="" - - # Last confirmation question for both developer and stable upgrade. - PRINT INPUT "This is the last warning before upgrading/wiping Blueprint. Type 'continue' to continue, all other input will be taken as 'no'." - read -r YN - if [[ ${YN} != "continue" ]]; then PRINT INFO "Upgrade cancelled.";exit 1;fi - YN="" - - # Initial steps count - export PROGRESS_TOTAL=9 - export PROGRESS_NOW=0 - - if [[ $1 == "remote" ]]; then PRINT INFO "Fetching and pulling latest commit.." - else PRINT INFO "Fetching and pulling latest release.."; fi - - ((PROGRESS_NOW++)) - - mkdir "$FOLDER/.tmp" - HAS_DEV=false - if [[ -n $(find .blueprint/dev -maxdepth 1 -type f -not -name ".gitkeep" -print -quit) ]]; then - PRINT INFO "Backing up extension development files.." - mkdir -p "$FOLDER/.tmp" - cp .blueprint/dev "$FOLDER/.tmp/dev" -Rf - HAS_DEV=true - fi - - ((PROGRESS_NOW++)) - - mkdir -p "$FOLDER/.tmp/files" - cd "$FOLDER/.tmp/files" || cdhalt - if [[ $1 == "remote" ]]; then - if [[ $2 == "" ]]; then - REMOTE_REPOSITORY="https://github.com/$REPOSITORY.git" - else - if [[ $2 != "http://"* ]] && [[ $2 != "https://"* ]]; then - REMOTE_REPOSITORY="https://github.com/$2.git" - else - REMOTE_REPOSITORY="$2" - fi - fi - # download release - hide_progress - if [[ $3 == "" ]]; then - git clone "$REMOTE_REPOSITORY" update - else - git clone "$REMOTE_REPOSITORY" update --branch "$3" - fi - else - # download latest release - hide_progress - - PRINT DEBUG "setting TAG_NAME to $TAG_NAME" - TAG_NAME=$(curl -s https://api.github.com/repos/"$REPOSITORY"/releases/latest \ - | grep "tag_name" \ - | awk '{ print $2 }' \ - | sed 's/,$//' \ - | sed 's/"//g' ) - - PRINT DEBUG "attempting to pull https://github.com/$REPOSITORY.git to the update folder (branch: release/$TAG_NAME)" - git clone "https://github.com/$REPOSITORY.git" update --branch "release/$TAG_NAME" - fi - - ((PROGRESS_NOW++)) - - if [[ ! -d "update" ]]; then - PRINT DEBUG "update directory not found.. exiting" - cd "$FOLDER" || cdhalt - rm -r "$FOLDER/.tmp" &>> "$BLUEPRINT__DEBUG" - PRINT FATAL "Remote does not exist or encountered an error, try again later." - hide_progress - exit 1 - fi - - ((PROGRESS_NOW++)) - - # Copy fetched release files to the Pterodactyl directory and remove temp files. - PRINT INFO "Moving release files to Pterodactyl directory.." - cp -r update/* "$FOLDER"/ - cp -r update/.* "$FOLDER"/ - rm -r \ - "update" \ - "$FOLDER"/.blueprint \ - "$FOLDER"/.tmp/files - cd "$FOLDER" || cdhalt - - ((PROGRESS_NOW++)) - - # Clean up folders with potentially broken symlinks. - rm \ - "resources/views/blueprint/admin/wrappers/"* \ - "resources/views/blueprint/dashboard/wrappers/"* \ - "routes/blueprint/application/"* \ - "routes/blueprint/client/"* \ - "routes/blueprint/web/"* \ - &>> /dev/null # cannot forward to debug dir because it does not exist - - ((PROGRESS_NOW++)) - - # Deprecated, kept in for backwards compatibility - sed -i -E \ - -e "s|OWNERSHIP=\"www-data:www-data\" #;|OWNERSHIP=\"$OWNERSHIP\" #;|g" \ - -e "s|WEBUSER=\"www-data\" #;|WEBUSER=\"$WEBUSER\" #;|g" \ - -e "s|USERSHELL=\"/bin/bash\" #;|USERSHELL=\"$USERSHELL\" #;|g" \ - "$FOLDER/blueprint.sh" - - chmod +x blueprint.sh - mv "$FOLDER/blueprint" "$FOLDER/.blueprint" - hide_progress - BLUEPRINT_ENVIRONMENT="upgrade2" PROGRESS_NOW="$PROGRESS_NOW" PROGRESS_TOTAL="$PROGRESS_TOTAL" bash blueprint.sh - - ((PROGRESS_NOW++)) - - if [[ ${HAS_DEV} == true ]]; then - PRINT INFO "Restoring extension development files.." - rm -rf .blueprint/dev - mv "$FOLDER/.tmp/dev" .blueprint/dev - fi - - rm -r "$FOLDER/.tmp" - - ((PROGRESS_NOW++)) - - # Post-upgrade checks. - PRINT INFO "Validating update.." - score=0 - - if dbValidate "blueprint.setupFinished"; then score=$((score+1)) - else PRINT WARNING "'blueprint.setupFinished' could not be detected or found."; fi - - # Finalize upgrade. - if [[ ${score} == 1 ]]; then - PRINT SUCCESS "Upgrade finished." - hide_progress - rm .blueprint.sh.bak - exit 0 # success - else - PRINT FATAL "Upgrade has failed." - hide_progress - exit 1 # error - fi -} From 9bdbf7cf43feb25f044b1d541a8bdedb90b767a7 Mon Sep 17 00:00:00 2001 From: prplwtf Date: Fri, 19 Dec 2025 22:16:39 +0100 Subject: [PATCH 10/11] feat: make manual action required warning more descriptive --- blueprint.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/blueprint.sh b/blueprint.sh index dd7c229..e5ee28b 100644 --- a/blueprint.sh +++ b/blueprint.sh @@ -252,12 +252,11 @@ if [[ $1 != "-bash" ]]; then fi if [[ $BLUEPRINT_ENVIRONMENT == "upgrade" ]]; then - echo -e "\x1b[30;41;1m YOU ARE USING THE LEGACY UPDATER!! \x1b[0m" - echo -e "\n\x1b[31;49;1mPlease rerun 'blueprint -upgrade' to continue the update process. This is NOT A BUG.\nPress ENTER to continue back to legacy updater (will fail) or ^C to terminate the process.\x1b[0m" + echo -e "\x1b[37;41;1m MANUAL ACTION REQUIRED \x1b[0m" + echo -e "\n\x1b[31;49;1mThis is NOT a bug. Please follow the following instructions:\x1b[0m" - echo -e "\n\x1b[31;49m1. Terminate this process with CTRL+C (^C)\x1b[0m" - echo -e "\n\x1b[31;49m2. Run 'blueprint -upgrade'\x1b[0m" - echo -e "\n\x1b[31;49m3. Blueprint will update to the latest version.\x1b[0m" + echo -e "\n\x1b[31;49m1. Use the CTRL+C (^C) keyboard shortcut to terminate this process.\x1b[0m" + echo -e "\x1b[31;49m2. Then, run 'blueprint -upgrade' AGAIN.\x1b[0m" read -r exit 1 From d19a7a6282504d9e871890104bd756971e541066 Mon Sep 17 00:00:00 2001 From: prplwtf Date: Fri, 19 Dec 2025 22:25:32 +0100 Subject: [PATCH 11/11] feat: branch fallback for backwards-command-usage-compatibility sake --- scripts/commands/advanced/upgrade.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/commands/advanced/upgrade.sh b/scripts/commands/advanced/upgrade.sh index de34c63..19ad0c9 100644 --- a/scripts/commands/advanced/upgrade.sh +++ b/scripts/commands/advanced/upgrade.sh @@ -79,8 +79,8 @@ Command() { remote_branch="$3" if [[ $remote_branch == "" ]]; then - PRINT FATAL "Expected a git branch at argument 3, was empty. Exiting.." - cleanup 1 + PRINT WARNING "Expected a git branch at argument 3, was empty. Defaulting to $REPOSITORY_BRANCH.." + remote_branch="$REPOSITORY_BRANCH" fi ;;