-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·82 lines (67 loc) · 2.08 KB
/
install
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
81
82
#!/bin/sh
# Script for installing GitMate
#
# This script can be executed via
# curl:
# curl -fsSL https://raw.githubusercontent.com/Terrorknubbel/gitmate/master/install | sh
# or wget:
# wget -qO- https://raw.githubusercontent.com/Terrorknubbel/gitmate/master/install | sh
# or httpie:
# http --download https://raw.githubusercontent.com/Terrorknubbel/gitmate/master/install | sh
YELLOW='\033[1;33m'
NC='\033[0m'
status_check() {
if command -v gitmate 2>&1 > /dev/null; then
printf "\n%s\n" "You already have ${BOLD}GitMate${RESET} installed."
printf "Run ${YELLOW}gitmate${NC} or ${YELLOW}gitm${NC} in your git project to get started"
exit 0
fi
}
unpack(){
tar -xzf gitmate.tar.gz
rm gitmate.tar.gz
rm LICENSE
}
move_to_path(){
printf "%s\n" "We require some permissions to move GitMate to /usr/bin"
if sudo mv gitmate /usr/bin; then
sudo ln -s gitmate /usr/bin/gitm
else
printf "\n%s\n" "Unknown error while installing gitmate"
exit 1
fi
}
set_permissions(){
if [ -f gitmate ] && ! chmod +x gitmate; then
printf "\n%s\n" "Unknown error while installing gitmate"
exit 1
fi
move_to_path
}
download_gitmate(){
GITMATE_HOST="https://github.com/Terrorknubbel/gitmate/releases/latest/download/gitmate_Linux_x86_64.tar.gz"
printf "\n%s\n" "Downloading GitMate from '${BOLD}$GITMATE_HOST${RESET}'…"
if curl -fsSL $GITMATE_HOST -o gitmate.tar.gz; then
unpack
set_permissions
else
printf "\n%s\n" "Unknown error while downloading GitMate"
exit 1
fi
}
main () {
status_check
download_gitmate
printf "${BOLD}${ORANGE_FG}%s\n" ""
printf "%s\n" " "
printf "%s\n" " _____ _ _ __ __ _ "
printf "%s\n" " / ____(_| | | \\/ | | | "
printf "%s\n" " | | __ _| |_| \\ / | __ _| |_ ___ "
printf "%s\n" " | | |_ | | __| |\\/| |/ _' | __/ _ \\ "
printf "%s\n" " | |__| | | |_| | | | (_| | || __/ "
printf "%s\n" " \\_____|_|\\__|_| |_|\\__,_|\\__\\___| "
printf "${RESET}\n%s" ""
printf "\t\t%s\n" ".... is now installed 🪄"
printf "Run ${YELLOW}gitmate${NC} or ${YELLOW}gitm${NC} in your git project to get started"
}
main