-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·125 lines (110 loc) · 4.23 KB
/
install.sh
File metadata and controls
executable file
·125 lines (110 loc) · 4.23 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/bin/bash
# WolfProxy Installation Script
# (C) 2026 Wolf Software Systems Ltd
#
# This script builds and installs WolfProxy on the local machine
set -e
echo ""
echo " __ ______ _ ______ _____ _____ ______ ____ __"
echo " \ \ / / __ \| | | ____| __ \| __ \ / __ \ \ / /\ \ / /"
echo " \ \ /\ / / | | | | | |__ | |__) | |__) | | | \ V / \ \_/ / "
echo " \ \/ \/ /| | | | | | __| | ___/| _ /| | | |> < \ / "
echo " \ /\ / | |__| | |____| | | | | | \ \| |__| / . \ | | "
echo " \/ \/ \____/|______|_| |_| |_| \_\\\\____/_/ \_\ |_| "
echo ""
echo " (C) 2026 Wolf Software Systems Ltd - http://wolf.uk.com"
echo " Installation Script"
echo ""
# Function to detect OS and install build dependencies
install_build_deps() {
echo "Checking build dependencies..."
# Check if cc/gcc is available
if command -v cc >/dev/null 2>&1 || command -v gcc >/dev/null 2>&1; then
echo " Build tools already installed."
return 0
fi
echo " Build tools (cc/gcc) not found. Installing..."
# Detect package manager and install
if command -v apt-get >/dev/null 2>&1; then
# Debian/Ubuntu
echo " Detected Debian/Ubuntu - using apt"
apt-get update -qq
apt-get install -y build-essential pkg-config libssl-dev
elif command -v dnf >/dev/null 2>&1; then
# Fedora/RHEL 8+/CentOS Stream
echo " Detected Fedora/RHEL - using dnf"
dnf install -y gcc gcc-c++ make pkg-config openssl-devel
elif command -v yum >/dev/null 2>&1; then
# RHEL 7/CentOS 7
echo " Detected RHEL/CentOS - using yum"
yum install -y gcc gcc-c++ make pkg-config openssl-devel
elif command -v pacman >/dev/null 2>&1; then
# Arch Linux
echo " Detected Arch Linux - using pacman"
pacman -Sy --noconfirm base-devel openssl
elif command -v zypper >/dev/null 2>&1; then
# openSUSE
echo " Detected openSUSE - using zypper"
zypper install -y gcc gcc-c++ make pkg-config libopenssl-devel
else
echo " ERROR: Could not detect package manager."
echo " Please install build-essential/gcc manually:"
echo " Debian/Ubuntu: apt install build-essential pkg-config libssl-dev"
echo " Fedora/RHEL: dnf install gcc gcc-c++ make pkg-config openssl-devel"
exit 1
fi
echo " Build tools installed successfully."
}
# Source cargo environment if it exists (use . for POSIX compatibility)
if [ -f "$HOME/.cargo/env" ]; then
. "$HOME/.cargo/env"
fi
# Check for Rust - try common locations
if ! command -v cargo >/dev/null 2>&1; then
if [ -x "$HOME/.cargo/bin/cargo" ]; then
export PATH="$HOME/.cargo/bin:$PATH"
else
echo "Error: Rust/Cargo is not installed."
echo "Please install Rust from https://rustup.rs/"
exit 1
fi
fi
# Install build dependencies if needed (requires root)
if [ "$EUID" -eq 0 ]; then
install_build_deps
else
# Check if cc exists, warn if not
if ! command -v cc >/dev/null 2>&1 && ! command -v gcc >/dev/null 2>&1; then
echo "WARNING: Build tools (cc/gcc) not found."
echo "Run this script as root to auto-install, or manually install:"
echo " Debian/Ubuntu: sudo apt install build-essential pkg-config libssl-dev"
echo " Fedora/RHEL: sudo dnf install gcc gcc-c++ make pkg-config openssl-devel"
echo ""
fi
fi
echo "Step 1: Building WolfProxy (release mode)..."
cargo build --release
if [ ! -f "target/release/wolfproxy" ]; then
echo "Error: Build failed - binary not found"
exit 1
fi
echo ""
echo "Step 2: Build complete!"
echo " Binary: $(pwd)/target/release/wolfproxy"
echo " Size: $(du -h target/release/wolfproxy | cut -f1)"
echo ""
# Check if running as root for service installation
if [ "$EUID" -eq 0 ]; then
echo "Step 3: Installing systemd service..."
./install_service.sh
else
echo "Step 3: Skipping service installation (not running as root)"
echo ""
echo "To install as a systemd service, run:"
echo " sudo ./install_service.sh"
echo ""
echo "Or to run manually:"
echo " sudo ./target/release/wolfproxy"
fi
echo ""
echo "Installation complete!"