forked from ali-hv/comsu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·39 lines (33 loc) · 1.01 KB
/
install.sh
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
#!/bin/bash
# Detect package manager
if command -v apt-get &> /dev/null; then
INSTALL_CMD="sudo apt-get update && sudo apt-get install -y jq"
elif command -v pacman &> /dev/null; then
INSTALL_CMD="sudo pacman -S --noconfirm jq"
elif command -v dnf &> /dev/null; then
INSTALL_CMD="sudo dnf install -y jq"
elif command -v brew &> /dev/null; then
INSTALL_CMD="brew install jq"
else
echo "Unsupported package manager."
exit 1
fi
# Install jq if not already installed
if ! command -v jq &> /dev/null; then
echo "Installing jq..."
eval "$INSTALL_CMD"
else
echo "jq is already installed."
fi
# Create directory for shared files
SHARE_DIR="/usr/local/share/git-comsu"
if [ ! -d "$SHARE_DIR" ]; then
sudo mkdir -p "$SHARE_DIR"
fi
# Copy prompt to the shared directory
sudo cp prompt "$SHARE_DIR/"
# Make git-comsu executable and copy to /usr/local/bin
sudo cp git-comsu /usr/local/bin/git-comsu
sudo chmod +x /usr/local/bin/git-comsu
echo
echo "Installation completed. You can now run 'git comsu'."