diff --git a/README.md b/README.md index 5dd4c9c..be1a881 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ If you choose to enable SSL: ``` - Automatically modifies: -`/etc/calagopus/config.yml` +`/etc/pterodactyl/config.yml` From: @@ -63,7 +63,7 @@ To: A backup of the config is created as: ``` -/etc/calagopus/config.yml.bak +/etc/pterodactyl/config.yml.bak ``` --- diff --git a/install-wings.sh b/install-wings.sh index 55d75ab..0d5c542 100644 --- a/install-wings.sh +++ b/install-wings.sh @@ -1,17 +1,28 @@ #!/usr/bin/env bash set -euo pipefail +######################################## # Seby's Calagopus Wings Installer -# Safe for curl | bash usage +# curl | bash safe +######################################## ######################################## -# helpers +# Styling ######################################## TTY="/dev/tty" -say() { printf "\n\033[1m%s\033[0m\n" "$*"; } -warn() { printf "\n\033[33m[warn]\033[0m %s\n" "$*"; } -err() { printf "\n\033[31m[error]\033[0m %s\n" "$*"; } +BOLD="\033[1m" +DIM="\033[2m" +GREEN="\033[32m" +YELLOW="\033[33m" +RED="\033[31m" +BLUE="\033[34m" +RESET="\033[0m" + +section() { printf "\n${BLUE}${BOLD}==> %s${RESET}\n" "$*"; } +say() { printf "${GREEN}✔ %s${RESET}\n" "$*"; } +warn() { printf "${YELLOW}⚠ %s${RESET}\n" "$*"; } +err() { printf "${RED}✖ %s${RESET}\n" "$*"; } have() { command -v "$1" >/dev/null 2>&1; } @@ -25,7 +36,7 @@ need_tty() { prompt() { local msg="$1" local out - printf "%s" "$msg" >"$TTY" + printf "${BOLD}%s${RESET}" "$msg" >"$TTY" IFS= read -r out <"$TTY" printf "%s" "$out" } @@ -51,12 +62,12 @@ require_root_or_sudo() { } apt_install() { - $SUDO apt-get update -y - $SUDO apt-get install -y "$@" + $SUDO apt-get update -y >/dev/null 2>&1 + $SUDO apt-get install -y "$@" >/dev/null 2>&1 } ######################################## -# SSL config updater (runs AFTER config exists) +# SSL config updater ######################################## update_ssl_config() { local domain="$1" @@ -65,25 +76,23 @@ update_ssl_config() { local key="/etc/letsencrypt/live/${domain}/privkey.pem" if [[ ! -f "$cfg" ]]; then - warn "Config not found at $cfg — skipping SSL update." + warn "Config not found — skipping SSL update." return fi if [[ ! -f "$cert" || ! -f "$key" ]]; then - warn "Cert files not found ($cert / $key) — skipping SSL update." + warn "Cert files not found — skipping SSL update." return fi - say "Updating SSL section in $cfg" + section "Updating SSL configuration" $SUDO cp -a "$cfg" "${cfg}.bak" - # Rewrites only the ssl: block keys (expects standard indentation) $SUDO awk -v cert="$cert" -v key="$key" ' BEGIN { inssl=0 } { if ($0 ~ /^ ssl:[[:space:]]*$/) { inssl=1; print; next } if (inssl==1) { - # leave ssl block when we hit the next top-level section (two spaces + non-space) if ($0 ~ /^ [^[:space:]]/ && $0 !~ /^ ssl:/) { inssl=0 } else if ($0 ~ /^ enabled:/) { print " enabled: true"; next } else if ($0 ~ /^ cert:/) { print " cert: " cert; next } @@ -93,12 +102,26 @@ update_ssl_config() { } ' "$cfg" | $SUDO tee "$cfg" >/dev/null - say "SSL config updated. Backup saved to ${cfg}.bak" + say "SSL block updated (backup saved)" } ######################################## -# Start +# Header ######################################## +clear +cat << "EOF" + + ____ _ + / ___|__ _| | __ _ __ _ ___ _ __ _ _ ___ +| | / _` | |/ _` |/ _` |/ _ \| '_ \| | | / __| +| |__| (_| | | (_| | (_| | (_) | |_) | |_| \__ \ + \____\__,_|_|\__,_|\__, |\___/| .__/ \__,_|___/ + |___/ |_| + + Calagopus Wings Installer | v1.0 + +EOF + need_tty require_root_or_sudo @@ -107,19 +130,26 @@ if ! have apt-get; then exit 1 fi -say "Calagopus Wings Installer" - ######################################## # Docker ######################################## +section "Docker Check" + if have docker; then say "Docker detected: $(docker --version || true)" else warn "Docker not installed." if confirm_default_no "Install Docker?"; then + section "Installing Docker (quiet mode)" apt_install ca-certificates curl - curl -fsSL https://get.docker.com/ | CHANNEL=stable $SUDO bash - say "Docker installed: $(docker --version || true)" + + if curl -fsSL https://get.docker.com/ | CHANNEL=stable $SUDO bash >/dev/null 2>&1; then + say "Docker installed successfully" + say "$(docker --version)" + else + err "Docker installation failed" + exit 1 + fi else err "Docker required. Exiting." exit 1 @@ -129,7 +159,7 @@ fi ######################################## # Download Wings ######################################## -say "Downloading Wings binary..." +section "Downloading Wings" ARCH="$(uname -m)" case "$ARCH" in @@ -144,43 +174,42 @@ esac WINGS_URL="https://github.com/calagopus/wings/releases/latest/download/wings-rs-${WINGS_ARCH}-linux" WINGS_BIN="/usr/local/bin/wings" -$SUDO curl -fL "$WINGS_URL" -o "$WINGS_BIN" +$SUDO curl -fL "$WINGS_URL" -o "$WINGS_BIN" >/dev/null 2>&1 $SUDO chmod +x "$WINGS_BIN" -say "Wings installed to $WINGS_BIN" +say "Wings installed" "$WINGS_BIN" version || true ######################################## -# Configure (creates /etc/pterodactyl/config.yml) +# Configure ######################################## CONFIG_CREATED=false +section "Configuration" -if confirm_default_no "Run wings configure --join-data now? (recommended)"; then +if confirm_default_no "Run wings configure --join-data now?"; then JOIN_DATA="$(prompt "Paste join-data string: ")" if [[ -n "$JOIN_DATA" ]]; then $SUDO mkdir -p /etc/pterodactyl $SUDO "$WINGS_BIN" configure --join-data "$JOIN_DATA" CONFIG_CREATED=true + say "Configuration complete" else - warn "No join-data provided; skipping configure." + warn "No join-data provided" fi -else - warn "Skipping configure. SSL setup will be skipped because config.yml will not exist yet." fi ######################################## -# SSL (after config exists) +# SSL ######################################## -if $CONFIG_CREATED && confirm_default_no "Set up SSL with certbot now?"; then - DOMAIN="$(prompt "Enter domain (e.g. node.example.com): ")" - EMAIL="$(prompt "Enter email for Let's Encrypt renewal notices: ")" +if $CONFIG_CREATED && confirm_default_no "Set up SSL with certbot?"; then + section "SSL Setup" + + DOMAIN="$(prompt "Enter domain: ")" + EMAIL="$(prompt "Enter email: ")" if [[ -n "$DOMAIN" && -n "$EMAIL" ]]; then - say "Installing certbot..." apt_install certbot - warn "Ports 80/443 must be open and not in use for standalone mode." - $SUDO certbot certonly \ --standalone \ -d "$DOMAIN" \ @@ -191,17 +220,20 @@ if $CONFIG_CREATED && confirm_default_no "Set up SSL with certbot now?"; then update_ssl_config "$DOMAIN" else - warn "Domain/email missing. Skipping SSL." + warn "Domain/email missing — skipping SSL" fi fi ######################################## -# Install Service +# Service ######################################## -if confirm_default_no "Install as systemd service? (wings service-install)"; then +section "Service Installation" + +if confirm_default_no "Install as systemd service?"; then $SUDO "$WINGS_BIN" service-install - say "Service status:" + say "Service installed" $SUDO systemctl --no-pager status wings || true fi -say "Installation complete." +section "Done" +say "Calagopus Wings installation complete."