Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scripts/commands/extensions/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ InstallExtension() {
# run extension update script
if [[ -f ".blueprint/extensions/$identifier/private/update.sh" ]]; then
PRINT WARNING "Extension uses a custom update script, proceed with caution."
hide_progress
blueprint_custom_script_confirm "update"
chmod --silent +x ".blueprint/extensions/$identifier/private/update.sh" 2>> "$BLUEPRINT__DEBUG"


Expand Down Expand Up @@ -1308,7 +1308,7 @@ InstallExtension() {
if [[ ( $F_developerIgnoreInstallScript == false ) || ( $dev != true ) ]]; then
if [[ -f ".blueprint/extensions/$identifier/private/install.sh" ]]; then
PRINT WARNING "Extension uses a custom installation script, proceed with caution."
hide_progress
blueprint_custom_script_confirm "installation"
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.
Expand Down
2 changes: 1 addition & 1 deletion scripts/commands/extensions/remove.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ RemoveExtension() {

if [[ -f ".blueprint/extensions/$identifier/private/remove.sh" ]]; then
PRINT WARNING "Extension uses a custom removal script, proceed with caution."
hide_progress
blueprint_custom_script_confirm "removal"
chmod +x ".blueprint/extensions/$identifier/private/remove.sh"

# Run script while also parsing some useful variables for the uninstall script to use.
Expand Down
22 changes: 22 additions & 0 deletions scripts/libraries/misc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,25 @@ extract_extension() {

return 0
}


blueprint_custom_script_confirm() {
local phase="$1"
local deadline remaining

if [[ ! -t 0 ]] || [[ -n "${BLUEPRINT_SKIP_SCRIPT_CONFIRM:-}" ]]; then
return 0
fi

hide_progress

deadline=$((SECONDS + 10))

while [[ $SECONDS -lt $deadline ]]; do
remaining=$((deadline - SECONDS))
printf "\r\033[2m%s\033[0m \x1b[35;1mInput:\x1b[0m Extension has a custom %s script. Press \x1b[32;1m[ENTER]\x1b[0m to continue or \x1b[31;1m^C\x1b[0m to abort. \x1b[2m(auto-proceeding in %ds)\x1b[0m " "$(date +"%H:%M:%S")" "$phase" "$remaining"
read -r -t 1 && { printf "\r\033[K"; return 0; }
done

printf "\r\033[K"
}