-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall_siege.sh
More file actions
executable file
·67 lines (54 loc) · 1.51 KB
/
Copy pathinstall_siege.sh
File metadata and controls
executable file
·67 lines (54 loc) · 1.51 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
#!/usr/bin/env bash
set -e
echo "Installing siege..."
# Create directories
mkdir -p "$HOME/.local/bin"
# Download
cd /tmp
echo "Downloading siege..."
if ! wget -q --show-progress https://github.com/JoeDog/siege/releases/download/v4.1.5/siege-4.1.5.tar.gz; then
echo "Trying alternate download source..."
wget -q --show-progress http://download.joedog.org/siege/siege-latest.tar.gz || {
echo "✗ Failed to download siege"
exit 1
}
fi
echo "Extracting..."
tar -xzf siege-*.tar.gz
cd siege-*/
echo "Configuring..."
./configure --prefix="$HOME/.local" > /dev/null
echo "Compiling..."
make > /dev/null
make install > /dev/null
# Function to add PATH safely
add_to_path() {
local file="$1"
local line='export PATH="$HOME/.local/bin:$PATH"'
if [ -f "$file" ]; then
if ! grep -Fxq "$line" "$file"; then
echo "" >> "$file"
echo "# Added by siege installer" >> "$file"
echo "$line" >> "$file"
echo "✓ Updated $file"
else
echo "✓ PATH already set in $file"
fi
fi
}
# Bash users
add_to_path "$HOME/.bashrc"
# Zsh users (correct files)
add_to_path "$HOME/.zprofile"
add_to_path "$HOME/.zshrc"
# Update PATH for current shell
export PATH="$HOME/.local/bin:$PATH"
# Test installation
if command -v siege >/dev/null 2>&1; then
siege --version
echo "✓ Siege installed successfully!"
echo "ℹ Restart your terminal or run: source ~/.zprofile"
else
echo "✗ Siege installation failed"
exit 1
fi