-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinstall-linux.sh
90 lines (78 loc) · 2.79 KB
/
install-linux.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/bash
# exit on any error
set -e
if ! [ `command -v wget` ]; then
echo "Need 'wget' package to download files from github!"
exit 1
fi
echo -ne "Check-Ip installer for Linux/Termux\n"
sleep 2s
case $(uname -m) in
x86_64) ARCH="amd64"
echo "Downloading executable for: ${ARCH}"; sleep 1s
wget -O check-ip https://github.com/1ray-1/check-ip/releases/latest/download/check-ip-${ARCH}
;;
i386 | i686) ARCH="i386"
echo "Downloading executable for: ${ARCH}"; sleep 1s
wget -O check-ip https://github.com/1ray-1/check-ip/releases/latest/download/check-ip-${ARCH}
;;
arm64) ARCH="arm64"
echo "Downloading executable for: ${ARCH}"; sleep 1s
wget -O check-ip https://github.com/1ray-1/check-ip/releases/latest/download/check-ip-${ARCH}
;;
aarch64) ARCH="aarch64"
echo "Downloading executable for: ${ARCH}"; sleep 1s
wget -O check-ip https://github.com/1ray-1/check-ip/releases/latest/download/check-ip-${ARCH}
;;
*)
echo "Will compile it from source"; sleep 1s
wget https://raw.githubusercontent.com/1ray-1/check-ip/main/check-ip.c
if [ `command -v gcc` ]; then
gcc check-ip.c -o check-ip || echo "Something went wrong!"
elif [ `command -v clang` ]; then
clang check-ip.c -o check-ip || echo "Something went wrong!"
else
echo "Looks like C compiler is not installed or something went wrong!"
exit 1
fi
echo "Compiled successfully"
sleep 2s
;;
esac
chmod +x check-ip
# for android
if [ -d /data/data/com.termux/files/usr/bin/ ]; then
echo "Installing check-ip in /data/data/com.termux/files/usr/bin/";sleep 1s
# in case
if [ -f /data/data/com.termux/files/usr/bin/check-ip ]; then
echo "Hey '/data/data/com.termux/files/usr/bin/check-ip' already exists, will replace it. Press ENTER to continue"
read tmp
rm /data/data/com.termux/files/usr/bin/check-ip
fi
mv check-ip /data/data/com.termux/files/usr/bin/
# for linux
elif [ -d /usr/bin/ ]; then
echo "Installing check-ip in /usr/bin/";sleep 1s
if [ -f /usr/bin/check-ip ]; then
echo "Hey '/usr/bin/check-ip' already exists, will replace it. Press ENTER to continue"
read tmp
sudo rm /usr/bin/check-ip
fi
sudo mv check-ip /bin/
elif [ -d /bin/ ]; then
echo "Installing check-ip in /bin/";sleep 1s
if [ -f /bin/check-ip ]; then
echo "Hey '/bin/check-ip' already exists, will replace it. Press ENTER to continue"
read tmp
sudo rm /bin/check-ip
fi
sudo mv check-ip /bin/
else echo "Sorry, I don't know what to do."; exit 1
fi
if ! [ `command -v check-ip` ]; then
echo "Sorry, looks like 'check-ip' isn't installed!"
exit 1
fi
echo -ne "Done!\nType 'check-ip -h' to get started."
echo "Or read README.md for more info."
exit 0