-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·31 lines (23 loc) · 931 Bytes
/
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
#!/bin/sh
version=$(curl --silent "https://api.github.com/repos/rockstaedt/commit-message-check/releases/latest" |
grep '"tag_name":' |
sed -E 's/.*"([^"]+)".*/\1/')
echo "-> Installing commit-message-check ${version}"
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
os="linux"
elif [[ "$OSTYPE" == "darwin"* ]]; then
os="darwin"
else
echo "ERROR - Could not determine operating system. Please download binary manually."
exit
fi
os="${os}-$(uname -m)"
binary="commit-message-check-${version}-${os}"
url="https://github.com/rockstaedt/commit-message-check/releases/latest/download/${binary}"
curl -o commit-message-check -L $url && chmod +x ./commit-message-check
if !(grep -Fxq "commit-message-check" .gitignore); then
read -e -p "Do you want to add the binary to gitignore? (y/n) " choice
[[ "$choice" == [Yy]* ]] && echo "\ncommit-message-check" >> .gitignore
fi
./commit-message-check setup
rm ./install.sh