-
Notifications
You must be signed in to change notification settings - Fork 32
/
dupmn_install.sh
62 lines (50 loc) · 2.57 KB
/
dupmn_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
62
#!/bin/bash
readonly GRAY='\e[1;30m'
readonly GREEN='\e[1;32m'
readonly YELLOW='\e[1;33m'
readonly CYAN='\e[1;36m'
readonly NC='\e[0m'
function echo_json_upd() {
echo -e "$1"
[[ -t 3 ]] && echo -e "{\"message\":\"$(echo "$1" | sed 's/\\e\[[0-9;]*m//g')\",\"retcode\":$2}" >&3
}
echo -e "\n===================================================\
\n ${GRAY}██████╗ ██╗ ██╗██████╗ ${NC}███╗ ███╗███╗ ██╗ \
\n ${GRAY}██╔══██╗██║ ██║██╔══██╗${NC}████╗ ████║████╗ ██║ \
\n ${GRAY}██║ ██║██║ ██║██████╔╝${NC}██╔████╔██║██╔██╗ ██║ \
\n ${GRAY}██║ ██║██║ ██║██╔═══╝ ${NC}██║╚██╔╝██║██║╚██╗██║ \
\n ${GRAY}██████╔╝╚██████╔╝██║ ${NC}██║ ╚═╝ ██║██║ ╚████║ \
\n ${GRAY}╚═════╝ ╚═════╝ ╚═╝ ${NC}╚═╝ ╚═╝╚═╝ ╚═══╝ \
\n ╗ made by ${GREEN}neo3587${NC} ╔\
\n Source: ${CYAN}https://github.com/neo3587/dupmn${NC}\
\n FAQs: ${CYAN}https://github.com/neo3587/dupmn/wiki/FAQs${NC}\
\n BTC Donations: ${YELLOW}3F6J19DmD5jowwwQbE9zxXoguGPVR716a7${NC}\
\n===================================================\
\n "
dupmn_update=$(curl -s https://raw.githubusercontent.com/neo3587/dupmn/master/dupmn.sh)
if [[ -f /usr/bin/dupmn && ! $(diff -q <(echo "$dupmn_update") /usr/bin/dupmn) ]]; then
echo_json_upd "${GREEN}dupmn${NC} is already updated to the last version" 0
else
echo -e "Checking needed dependencies..."
if [[ ! $(command -v lsof) ]]; then
echo -e "Installing ${CYAN}lsof${NC}..."
sudo apt-get install lsof
fi
if [[ ! $(command -v curl) ]]; then
echo -e "Installing ${CYAN}curl${NC}..."
sudo apt-get install curl
fi
if [[ ! -d ~/.dupmn ]]; then
mkdir ~/.dupmn
fi
touch ~/.dupmn/dupmn.conf
update=$([[ -f /usr/bin/dupmn ]] && echo "1" || echo "0")
echo "$dupmn_update" > /usr/bin/dupmn
chmod +x /usr/bin/dupmn
if [[ $update == "1" ]]; then
echo_json_upd "${GREEN}dupmn${NC} updated to the last version, pretty fast, right?" 1
else
echo_json_upd "${GREEN}dupmn${NC} installed, pretty fast, right?" 2
fi
fi
echo ""