Files
vpn-wireguard/bootstrap.sh

45 lines
1.0 KiB
Bash
Raw Permalink Normal View History

#!/bin/bash
# WireGuard Secure Installer
# Copyright (c) 2025 Muhammad Fadhila Abiyyu Faris
# GitHub: [github.com/fadhila36/wireguard-secure-installer](https://github.com/fadhila36/wireguard-secure-installer)
set -e
REPO_URL="https://github.com/fadhila36/wireguard-secure-installer.git"
INSTALL_DIR="/opt/wg-installer"
echo "Bootstrapping WireGuard Secure Installer..."
# Check Root
if [ "$EUID" -ne 0 ]; then
echo "Error: Must be run as root."
exit 1
fi
# Install Git if missing
if ! command -v git >/dev/null; then
echo "Installing Git..."
if [ -f /etc/debian_version ]; then
apt-get update && apt-get install -y git
elif [ -f /etc/redhat-release ]; then
dnf install -y git
fi
fi
# Clone or Update Repo
if [ -d "$INSTALL_DIR" ]; then
echo "Updating existing installation..."
cd "$INSTALL_DIR"
git pull
else
echo "Cloning repository..."
git clone "$REPO_URL" "$INSTALL_DIR"
cd "$INSTALL_DIR"
fi
# Make scripts executable
chmod +x install.sh manage.sh lib/*.sh
# Run Installer
./install.sh