-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
install.sh
61 lines (53 loc) · 1.69 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
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env bash
#
# This script is part of the MobSleuth project.
# https://github.com/adityatelange/MobSleuth
#
# This script clones the repository to the working directory.
GREEN='\033[0;32m'
NC='\033[0m' # No Color
WORKING_DIR=$HOME/MobSleuth
print_banner () {
printf """
╔╦╗┌─┐┌┐ ╔═╗┬ ┌─┐┬ ┬┌┬┐┬ ┬
║║║│ │├┴┐╚═╗│ ├┤ │ │ │ ├─┤
╩ ╩└─┘└─┘╚═╝┴─┘└─┘└─┘ ┴ ┴ ┴
\n"""
}
print_banner
# check if MobSleuth is already installed
if [ -d "$WORKING_DIR" ]; then
echo -e "${GREEN}[+] MobSleuth is already installed at $WORKING_DIR${NC}"
# ask confirmation for updating
echo -e "(Updating will not affect your existing data and only updates $WORKING_DIR/src)"
read -p "Do you want to update? (y/N) " -n 1 -r </dev/tty
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
echo -e "${GREEN}[+] Exiting...${NC}"
exit 1
fi
echo -e "${GREEN}[+] Updating MobSleuth...${NC}"
cd $WORKING_DIR/src
git reset --hard HEAD
git clean -f -d
git pull
echo -e "${GREEN}[+] Done!${NC}"
exit 1
else
echo -e "${GREEN}[+] MobSleuth will be installed at $WORKING_DIR${NC}"
# ask confirmation from the user
read -p "Do you want to continue? (y/N) " -n 1 -r </dev/tty
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
echo -e "${GREEN}[+] Exiting...${NC}"
exit 1
fi
rm -rf $WORKING_DIR/src
mkdir -p $WORKING_DIR
echo -e "${GREEN}[+] Cloning MobSleuth to $WORKING_DIR/src${NC}"
git clone https://github.com/adityatelange/MobSleuth $WORKING_DIR/src
echo -e "${GREEN}[+] Done!${NC}"
exit 1
fi