feat blueprint.sh install.sh: add new "developerEscalateInstallScript" flag

This commit is contained in:
prplwtf 2024-08-26 18:07:20 +02:00
parent eb703b51b0
commit db5759b189
2 changed files with 32 additions and 20 deletions

View file

@ -176,17 +176,19 @@ assignflags() {
F_developerIgnoreRebuild=false
F_developerForceMigrate=false
F_developerKeepApplicationCache=false
F_developerEscalateInstallScript=false
F_developerEscalateExportScript=false
if [[ ( $flags == *"ignorePlaceholders,"* ) || ( $flags == *"ignorePlaceholders" ) ]]; then F_ignorePlaceholders=true ;fi
if [[ ( $flags == *"forceLegacyPlaceholders,"* ) || ( $flags == *"forceLegacyPlaceholders" ) ]]; then F_forceLegacyPlaceholders=true ;fi
if [[ ( $flags == *"hasInstallScript,"* ) || ( $flags == *"hasInstallScript" ) ]]; then F_hasInstallScript=true ;fi
if [[ ( $flags == *"hasRemovalScript,"* ) || ( $flags == *"hasRemovalScript" ) ]]; then F_hasRemovalScript=true ;fi
if [[ ( $flags == *"hasExportScript,"* ) || ( $flags == *"hasExportScript" ) ]]; then F_hasExportScript=true ;fi
if [[ ( $flags == *"developerIgnoreInstallScript,"* ) || ( $flags == *"developerIgnoreInstallScript" ) ]]; then F_developerIgnoreInstallScript=true ;fi
if [[ ( $flags == *"developerIgnoreRebuild,"* ) || ( $flags == *"developerIgnoreRebuild" ) ]]; then F_developerIgnoreRebuild=true ;fi
if [[ ( $flags == *"developerForceMigrate,"* ) || ( $flags == *"developerForceMigrate" ) ]]; then F_developerForceMigrate=true ;fi
if [[ ( $flags == *"developerKeepApplicationCache,"* ) || ( $flags == *"developerKeepApplicationCache" ) ]]; then F_developerKeepApplicationCache=true ;fi
if [[ ( $flags == *"developerEscalateExportScript,"* ) || ( $flags == *"developerEscalateExportScript" ) ]]; then F_developerEscalateExportScript=true ;fi
if [[ ( $flags == *"ignorePlaceholders,"* ) || ( $flags == *"ignorePlaceholders" ) ]]; then F_ignorePlaceholders=true ;fi
if [[ ( $flags == *"forceLegacyPlaceholders,"* ) || ( $flags == *"forceLegacyPlaceholders" ) ]]; then F_forceLegacyPlaceholders=true ;fi
if [[ ( $flags == *"hasInstallScript,"* ) || ( $flags == *"hasInstallScript" ) ]]; then F_hasInstallScript=true ;fi
if [[ ( $flags == *"hasRemovalScript,"* ) || ( $flags == *"hasRemovalScript" ) ]]; then F_hasRemovalScript=true ;fi
if [[ ( $flags == *"hasExportScript,"* ) || ( $flags == *"hasExportScript" ) ]]; then F_hasExportScript=true ;fi
if [[ ( $flags == *"developerIgnoreInstallScript,"* ) || ( $flags == *"developerIgnoreInstallScript" ) ]]; then F_developerIgnoreInstallScript=true ;fi
if [[ ( $flags == *"developerIgnoreRebuild,"* ) || ( $flags == *"developerIgnoreRebuild" ) ]]; then F_developerIgnoreRebuild=true ;fi
if [[ ( $flags == *"developerForceMigrate,"* ) || ( $flags == *"developerForceMigrate" ) ]]; then F_developerForceMigrate=true ;fi
if [[ ( $flags == *"developerKeepApplicationCache,"* ) || ( $flags == *"developerKeepApplicationCache" ) ]]; then F_developerKeepApplicationCache=true ;fi
if [[ ( $flags == *"developerEscalateInstallScript,"* ) || ( $flags == *"developerEscalateInstallScript" ) ]]; then F_developerEscalateInstallScript=true ;fi
if [[ ( $flags == *"developerEscalateExportScript,"* ) || ( $flags == *"developerEscalateExportScript" ) ]]; then F_developerEscalateExportScript=true ;fi
}
# Adds the "blueprint" command to the /usr/local/bin directory and configures the correct permissions for it.

View file

@ -1222,16 +1222,26 @@ InstallExtension() {
chmod --silent +x ".blueprint/extensions/$identifier/private/install.sh" 2>> "$BLUEPRINT__DEBUG"
# Run script while also parsing some useful variables for the install script to use.
su "$WEBUSER" -s "$USERSHELL" -c "
cd \"$FOLDER\";
EXTENSION_IDENTIFIER=\"$identifier\" \
EXTENSION_TARGET=\"$target\" \
EXTENSION_VERSION=\"$version\" \
PTERODACTYL_DIRECTORY=\"$FOLDER\" \
BLUEPRINT_VERSION=\"$VERSION\" \
BLUEPRINT_DEVELOPER=\"$dev\" \
bash .blueprint/extensions/$identifier/private/install.sh
"
if $F_developerEscalateInstallScript; then
EXTENSION_IDENTIFIER="$identifier" \
EXTENSION_TARGET="$target" \
EXTENSION_VERSION="$version" \
PTERODACTYL_DIRECTORY="$FOLDER" \
BLUEPRINT_VERSION="$VERSION" \
BLUEPRINT_DEVELOPER="$dev" \
bash .blueprint/extensions/"$identifier"/private/install.sh
else
su "$WEBUSER" -s "$USERSHELL" -c "
cd \"$FOLDER\";
EXTENSION_IDENTIFIER=\"$identifier\" \
EXTENSION_TARGET=\"$target\" \
EXTENSION_VERSION=\"$version\" \
PTERODACTYL_DIRECTORY=\"$FOLDER\" \
BLUEPRINT_VERSION=\"$VERSION\" \
BLUEPRINT_DEVELOPER=\"$dev\" \
bash .blueprint/extensions/$identifier/private/install.sh
"
fi
echo -e "\e[0m\x1b[0m\033[0m"
fi
fi