feat(installer): add WireGuard check + auto-install for native install
This commit is contained in:
@@ -49,6 +49,7 @@ Prerequisites:
|
|||||||
- nginx installed and running
|
- nginx installed and running
|
||||||
- PostgreSQL installed and running
|
- PostgreSQL installed and running
|
||||||
- Redis installed and running
|
- Redis installed and running
|
||||||
|
- WireGuard tools (will be auto-installed if missing)
|
||||||
- Pre-built binaries in ./bin/ directory
|
- Pre-built binaries in ./bin/ directory
|
||||||
|
|
||||||
This script will:
|
This script will:
|
||||||
@@ -90,6 +91,29 @@ command -v systemctl >/dev/null 2>&1 || error "systemctl is not installed"
|
|||||||
command -v psql >/dev/null 2>&1 || error "PostgreSQL client (psql) is not installed"
|
command -v psql >/dev/null 2>&1 || error "PostgreSQL client (psql) is not installed"
|
||||||
command -v redis-cli >/dev/null 2>&1 || error "Redis client (redis-cli) is not installed"
|
command -v redis-cli >/dev/null 2>&1 || error "Redis client (redis-cli) is not installed"
|
||||||
|
|
||||||
|
# Check and install WireGuard
|
||||||
|
if ! command -v wg >/dev/null 2>&1; then
|
||||||
|
warn "WireGuard tools not found. Installing..."
|
||||||
|
if command -v apt >/dev/null 2>&1; then
|
||||||
|
apt update -qq && apt install -y -qq wireguard-tools
|
||||||
|
elif command -v dnf >/dev/null 2>&1; then
|
||||||
|
dnf install -y -q wireguard-tools
|
||||||
|
elif command -v yum >/dev/null 2>&1; then
|
||||||
|
yum install -y -q wireguard-tools
|
||||||
|
elif command -v pacman >/dev/null 2>&1; then
|
||||||
|
pacman -S --noconfirm wireguard-tools
|
||||||
|
else
|
||||||
|
error "Cannot auto-install WireGuard. Please install wireguard-tools manually."
|
||||||
|
fi
|
||||||
|
info "WireGuard tools installed: $(wg --version)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check WireGuard kernel module
|
||||||
|
if ! lsmod 2>/dev/null | grep -q wireguard; then
|
||||||
|
warn "WireGuard kernel module not loaded. Loading..."
|
||||||
|
modprobe wireguard 2>/dev/null || warn "Could not load wireguard module (may need manual load or reboot)"
|
||||||
|
fi
|
||||||
|
|
||||||
# Check for pre-built binaries
|
# Check for pre-built binaries
|
||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
SERVER_BINARY="$SCRIPT_DIR/bin/server-core"
|
SERVER_BINARY="$SCRIPT_DIR/bin/server-core"
|
||||||
|
|||||||
Reference in New Issue
Block a user