-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·80 lines (66 loc) · 2.29 KB
/
install.sh
File metadata and controls
executable file
·80 lines (66 loc) · 2.29 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
#!/bin/bash
# Pulsarship Installation Script (Quiet Completions)
# Function to print error messages with red color
function print_error {
echo -e "\033[1;31m❌ ERROR: $1\033[0m"
}
# Function to print success messages with green color
function print_success {
echo -e "\033[1;32m✅ SUCCESS: $1\033[0m"
}
# Function to print info messages with blue color
function print_info {
echo -e "\033[1;34mℹ️ INFO: $1\033[0m"
}
# Function to print warning messages with yellow color
function print_warning {
echo -e "\033[1;33m⚠️ WARNING: $1\033[0m"
}
# Function to check if a command exists
function command_exists {
command -v "$1" &>/dev/null
}
# Ensure Git is installed
if ! command_exists git; then
print_error "Git is not installed. Please install Git first."
exit 1
fi
# Ensure Make or Go is installed
if ! command_exists make && ! command_exists go; then
print_error "Neither Make nor Go is installed. Please install one to proceed."
exit 1
fi
# Clone Pulsarship repo into temp dir
TMP_DIR=$(mktemp -d -t pulsarship-XXXXXX)
print_info "🚀 Cloning the Pulsarship repository into $TMP_DIR..."
git clone https://github.com/axrona/pulsarship "$TMP_DIR"
cd "$TMP_DIR"
# Build Pulsarship
if command_exists make; then
make install
else
go build -ldflags "\
-X 'main.version=$(git describe --tags --abbrev=0)' \
-X 'main.tag=$(git describe --tags --abbrev=0)' \
-X 'main.commit=$(git rev-parse --short HEAD)' \
-X 'main.buildTime=$(date -u +%Y-%m-%dT%H:%M:%SZ)' \
-X 'main.buildEnv=$(go version)'" \
-o pulsarship .
sudo install -Dm755 pulsarship "/usr/bin/pulsarship"
fi
# Install completions silently to system-wide paths
COMPLETION_DIRS=(
"/usr/share/bash-completion/completions"
"/usr/share/fish/vendor_completions.d"
"/usr/share/zsh/site-functions"
)
for dir in "${COMPLETION_DIRS[@]}"; do
if [ ! -d "$dir" ]; then
sudo install -dm755 "$dir"
fi
done
# Install completions for Bash, Fish, and Zsh silently
sudo bash -c 'pulsarship completion bash > /usr/share/bash-completion/completions/pulsarship'
sudo bash -c 'pulsarship completion fish > /usr/share/fish/vendor_completions.d/pulsarship.fish'
sudo bash -c 'pulsarship completion zsh > /usr/share/zsh/site-functions/_pulsarship'
print_success "🎉 Pulsarship installation completed!"