-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
107 lines (91 loc) · 3.29 KB
/
Copy pathinstall.sh
File metadata and controls
107 lines (91 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/bin/bash
# =========================================================
# BPI - Pterodactyl Blueprint Interactive GUI Installer
# Repository: https://github.com/ProPlayer777bug/BPI
# =========================================================
# Ensure script operates from the current directory
WORKING_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd "$WORKING_DIR" || exit 1
# Check if Blueprint CLI is installed
if ! command -v blueprint &> /dev/null; then
clear
echo "❌ ERROR: 'blueprint' CLI command is not installed or not in PATH."
echo "Please install the Blueprint framework first."
exit 1
fi
# Search for .blueprint files
shopt -s nullglob
BLUEPRINTS=( *.blueprint )
if [ ${#BLUEPRINTS[@]} -eq 0 ]; then
clear
echo "=============================================="
echo "❌ No .blueprint files found in:"
echo " $WORKING_DIR"
echo "=============================================="
echo "Please place your .blueprint files inside this directory and run the installer again."
exit 1
fi
# Ensure whiptail GUI utility is available
if ! command -v whiptail &> /dev/null; then
echo "⚙️ Installing 'whiptail' menu tool..."
if command -v apt-get &> /dev/null; then
apt-get update -y && apt-get install -y whiptail
elif command -v yum &> /dev/null; then
yum install -y newt
fi
fi
# Build GUI Menu Options
MENU_ITEMS=("0" "⚡ INSTALL ALL BLUEPRINTS (${#BLUEPRINTS[@]} total)")
for i in "${!BLUEPRINTS[@]}"; do
MENU_ITEMS+=("$((i + 1))" "${BLUEPRINTS[$i]}")
done
# Render Graphical Terminal Interface
CHOICE=$(whiptail --clear \
--backtitle "Pterodactyl BPI Installer - https://github.com/ProPlayer777bug/BPI" \
--title " Blueprint Package Selection " \
--menu "Use UP/DOWN arrow keys to navigate and press ENTER to select:" 18 70 10 \
"${MENU_ITEMS[@]}" \
3>&1 1>&2 2>&3)
# Handle Cancellation
if [ $? -ne 0 ]; then
clear
echo "Installation cancelled by user."
exit 0
fi
clear
# Automated Installation Function
execute_installation() {
local target_file="$1"
# Cleanly strip file extension to get extension identifier
local blueprint_identifier
blueprint_identifier=$(basename "$target_file" .blueprint)
echo "=============================================="
echo " 🚀 Auto-Installing: $blueprint_identifier"
echo "=============================================="
# Pipe 'yes' to bypass interactive confirmation prompts in Blueprint CLI
if yes | blueprint -install "$blueprint_identifier"; then
echo ""
echo "✅ Successfully installed: $blueprint_identifier"
rm -f "$target_file"
else
echo ""
echo "❌ Failed to install: $blueprint_identifier"
exit 1
fi
echo ""
}
# Run selection based on menu choice
if [ "$CHOICE" -eq 0 ]; then
echo "Starting batch installation of all detected blueprints..."
echo ""
for file in "${BLUEPRINTS[@]}"; do
execute_installation "$file"
done
echo "=============================================="
echo "✅ All blueprint packages installed successfully!"
echo "=============================================="
else
SELECTED_INDEX=$((CHOICE - 1))
TARGET_FILE="${BLUEPRINTS[$SELECTED_INDEX]}"
execute_installation "$TARGET_FILE"
fi