-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·50 lines (41 loc) · 1.13 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
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
# TITLE: gitback
# DESC: git based backup utility/manager
# LATEST UPDATE: 3/19/2024
# AUTHOR: N-coder82
#!/bin/bash
# Colors
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
# Checking for dependencies
whereis shc &> /dev/null
if [ $? -ne 0 ]; then
echo -e "${RED}Install shc at https://github.com/neurobin/shc${NC}"
fi
# Function to clone and build gitback
install_gitback() {
git clone "https://github.com/N-coder82/gitback.git" &> /dev/null
cd gitback
make install &> /dev/null
}
# Function to get user input and save it to gitbackrepo file
save_input_to_file() {
read -p "$(echo -e "${YELLOW}Enter your backup repository ==>${NC} ")" input
echo "$input" > ~/.gitback/backuprepo
}
# Cleanup function
cleanup() {
cd ..
rm -rf gitback
}
# Main script
echo -e "${YELLOW}Getting and building executable...${NC}"
install_gitback
mkdir -p ~/.gitback
save_input_to_file
echo -e "${YELLOW}Cleaning up...${NC}"
cleanup
echo -e "${GREEN}Finished!${NC}"
echo -e "${RED}The executable can be found in /usr/local/bin, to uninstall delete .gitback and /usr/local/bin/gitback.${NC}"