-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup-git.sh
executable file
·68 lines (58 loc) · 2.28 KB
/
setup-git.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
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
#!/bin/sh
install_git(){
echo "Installing Git>>> Installing Git automatically..."
# Check if Git is already installed
if command -v git >/dev/null 2>&1; then
echo "Installing Git>>> Git is already installed on your system."
return
fi
# Check the operating system
os=$(uname -s)
case "$os" in
Linux*)
# Check if the system is Ubuntu/Debian/Linux Mint/Pop_OS!
if command -v apt-get >/dev/null 2>&1; then
echo "Installing Git>>> Detected DEB-based system. Installing Git with APT..."
sudo apt-get update
sudo apt-get install -y git
return
fi
# Check if the system is Fedora/RHEL/CentOS Stream/Rocky Linux/Alma Linux
if command -v dnf >/dev/null 2>&1; then
echo "Installing Git>>> Detected RPM-based system. Installing Git with DNF..."
sudo dnf install -y git
return
fi
# Check if sys is Alpine-based
if command -v apk >/dev/null 2>&1; then
echo "Installing Git>>> Detected Alpine Linux. Installing Git wtih APK..."
doas apk add git
return
fi
# Add more Linux distributions here if needed
;;
Darwin*)
# Check if Homebrew is installed
if command -v brew >/dev/null 2>&1; then
echo "Installing Git>>> Detected macOS. Installing Git using Homebrew..."
brew install git
return
fi
;;
FreeBSD*)
echo "Installing Git>>> Detected FreeBSD. Installing Git..."
sudo pkg update
sudo pkg install -y git
return
;;
OpenBSD*)
echo "Installing Git>>> Detected OpenBSD. Installing Git..."
doas pkg_add git
return
;;
esac
# If none of the supported operating systems matched or installation encountered complications
echo "Installing Git>>> Uh-oh. We encountered an error when trying to install Git. Please repair or install Git manually."
exit 1
}
install_git && (git config --global user.email [email protected]; git config --global user.name noahdominic)