forked from P3TERX/script
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathffsend.sh
57 lines (53 loc) · 1.63 KB
/
ffsend.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
#!/usr/bin/env bash
#=================================================
# https://github.com/P3TERX/script
# File name: ffsend.sh
# Description: Install the latest version ffsend
# System Required: Debian/Ubuntu or other
# Version: 1.1
# Lisence: MIT
# Author: P3TERX
# Blog: https://p3terx.com
#=================================================
[ $(uname) != Linux ] && {
echo -e "This operating system is not supported."
exit 1
}
Green_font_prefix="\033[32m"
Red_font_prefix="\033[31m"
Green_background_prefix="\033[42;37m"
Red_background_prefix="\033[41;37m"
Font_color_suffix="\033[0m"
INFO="[${Green_font_prefix}INFO${Font_color_suffix}]"
ERROR="[${Red_font_prefix}ERROR${Font_color_suffix}]"
ARCH=$(uname -m)
if [[ ${ARCH} != "x86_64" ]]; then
echo -e "${ERROR} This architecture is not supported."
exit 1
fi
echo -e "${INFO} Download ffsend ..."
wget -nv -O- https://api.github.com/repos/timvisee/ffsend/releases/latest |
grep "browser_download_url.*linux-x64-static\"" |
cut -d '"' -f 4 |
wget -nv -O ffsend -i-
[ -s ffsend ] && echo -e "${INFO} ffsend download successful !" || {
echo -e "${ERROR} Unable to download ffsend, network failure or other error."
exit 1
}
chmod +x ffsend
if [[ $1 = "install" ]]; then
echo -e "${INFO} Install ffsend ..."
[ $EUID != 0 ] && {
SUDO=sudo
echo -e "${INFO} You may need to enter a password to authorize."
}
$SUDO mv -vf ffsend /usr/local/bin && {
echo -e "${INFO} ffsend successful installation !"
ffsend --version
} || {
echo -e "${ERROR} ffsend installation failed !"
exit 1
}
else
./ffsend --version
fi