forked from avacocloud/XHTTP-Installer
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
61 lines (52 loc) · 2.25 KB
/
Copy pathinstall.sh
File metadata and controls
61 lines (52 loc) · 2.25 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
#!/usr/bin/env bash
# =============================================================
# XHTTP Installer — Bootstrap
# Copyright (C) 2025 avaco_cloud
# Repository: https://github.com/avacocloud/XHTTP-Installer
# Licensed under GPL-3.0. See LICENSE file.
# =============================================================
# Usage: bash <(curl -fsSL https://raw.githubusercontent.com/avacocloud/XHTTP-Installer/main/install.sh)
set -euo pipefail
readonly AVC_BUILD_ID="avc-7f3a92e1-2025-avacocloud"
export AVC_BUILD_ID
REPO_URL="https://github.com/avacocloud/XHTTP-Installer.git"
TARGET_DIR="/root/XHTTP-Installer"
BRANCH="main"
C_CYAN="\033[1;36m"; C_GREEN="\033[1;32m"; C_YELLOW="\033[1;33m"
C_RED="\033[1;31m"; C_RESET="\033[0m"
info() { echo -e "${C_CYAN}➜${C_RESET} $*"; }
ok() { echo -e "${C_GREEN}✔${C_RESET} $*"; }
warn() { echo -e "${C_YELLOW}⚠${C_RESET} $*"; }
fail() { echo -e "${C_RED}✘${C_RESET} $*"; exit 1; }
# ── must run as root ─────────────────────────────────────
if [[ $EUID -ne 0 ]]; then
fail "Run as root (use: sudo bash <(curl ...))"
fi
# ── ensure git is installed ──────────────────────────────
if ! command -v git &>/dev/null; then
info "Installing git..."
apt-get update -qq
apt-get install -y -qq git
ok "git installed"
fi
# ── clone or update repo ─────────────────────────────────
if [[ -d "$TARGET_DIR/.git" ]]; then
warn "Existing install found at $TARGET_DIR — updating..."
git -C "$TARGET_DIR" fetch --depth=1 origin "$BRANCH"
git -C "$TARGET_DIR" reset --hard "origin/$BRANCH"
ok "Repo updated"
else
if [[ -d "$TARGET_DIR" ]]; then
warn "Directory exists but is not a git repo — removing..."
rm -rf "$TARGET_DIR"
fi
info "Cloning $REPO_URL..."
git clone --depth=1 --branch "$BRANCH" "$REPO_URL" "$TARGET_DIR"
ok "Repo cloned to $TARGET_DIR"
fi
# ── run the installer ────────────────────────────────────
cd "$TARGET_DIR"
chmod +x Deploy-Ubuntu.sh
info "Launching Deploy-Ubuntu.sh..."
echo ""
exec bash Deploy-Ubuntu.sh "$@"