allow full config command parsing
This commit is contained in:
parent
b2c75bfb3c
commit
290f8a8b42
1 changed files with 31 additions and 2 deletions
|
|
@ -151,7 +151,7 @@ cat << "EOF"
|
|||
\____\__,_|_|\__,_|\__, |\___/| .__/ \__,_|___/
|
||||
|___/ |_|
|
||||
|
||||
Calagopus Wings Installer | v1.1
|
||||
Calagopus Wings Installer | v1.2
|
||||
|
||||
EOF
|
||||
|
||||
|
|
@ -220,8 +220,37 @@ say "Wings installed"
|
|||
CONFIG_CREATED=false
|
||||
section "Configuration"
|
||||
|
||||
# Pulls just the base64 join-data token out of whatever the user pastes.
|
||||
# Accepts:
|
||||
# - the raw token by itself
|
||||
# - the full "wings configure --join-data <token>" command
|
||||
# - either wrapped in single/double quotes, with extra surrounding whitespace
|
||||
extract_join_data() {
|
||||
local raw="$1"
|
||||
local out="$raw"
|
||||
|
||||
# If a --join-data flag is present, keep only what comes after it.
|
||||
if [[ "$out" == *"--join-data"* ]]; then
|
||||
out="${out#*--join-data}"
|
||||
fi
|
||||
|
||||
# Trim leading/trailing whitespace.
|
||||
out="$(printf '%s' "$out" | sed -E 's/^[[:space:]]+//; s/[[:space:]]+$//')"
|
||||
|
||||
# Strip a single layer of surrounding single or double quotes, if present.
|
||||
out="$(printf '%s' "$out" | sed -E "s/^['\"]//; s/['\"]\$//")"
|
||||
|
||||
# In case the command was pasted with trailing shell noise (e.g. a
|
||||
# trailing backslash/newline continuation), just take the first token.
|
||||
out="$(printf '%s' "$out" | awk '{print $1}')"
|
||||
|
||||
printf '%s' "$out"
|
||||
}
|
||||
|
||||
if confirm_default_no "Run wings configure --join-data now?"; then
|
||||
JOIN_DATA="$(prompt "Paste join-data string: ")"
|
||||
JOIN_DATA_RAW="$(prompt "Paste join-data (raw token or the full 'wings configure --join-data ...' command): ")"
|
||||
JOIN_DATA="$(extract_join_data "$JOIN_DATA_RAW")"
|
||||
|
||||
if [[ -n "$JOIN_DATA" ]]; then
|
||||
$SUDO mkdir -p /etc/pterodactyl
|
||||
$SUDO "$WINGS_BIN" configure --join-data "$JOIN_DATA"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue