-
Notifications
You must be signed in to change notification settings - Fork 169
/
install.sh
executable file
·62 lines (51 loc) · 1.14 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
62
#!/usr/bin/env bash
# determine system arch
ARCH=
if [ "$(uname -m)" == 'x86_64' ]
then
ARCH=amd64
elif [ "$(uname -m)" == 'aarch64' ]
then
ARCH=arm64
elif [ "$(uname -m)" == 'i386' ] || [ "$(uname -m)" == 'i686' ]
then
ARCH=386
else
ARCH=arm
fi
ARCHIVE=ngrok-v3-stable-linux-$ARCH.tgz
DOWNLOAD_URL=https://bin.equinox.io/c/bNyj1mQVY4c/$ARCHIVE
if [ ! $(which wget) ]; then
echo 'Please install wget package'
exit 1
fi
if [ ! $(which git) ]; then
echo 'Please install git package'
exit 1
fi
if (( $EUID != 0 )); then
echo "Please run as root"
exit 1
fi
if [ -z "$1" ]; then
echo "./install.sh <your_authtoken>"
exit 1
fi
if [ ! -e ngrok.service ]; then
git clone --depth=1 https://github.com/vincenthsu/systemd-ngrok.git
cd systemd-ngrok
fi
cp ngrok.service /lib/systemd/system/
mkdir -p /opt/ngrok
cp ngrok.yml /opt/ngrok
sed -i "s/<add_your_token_here>/$1/g" /opt/ngrok/ngrok.yml
cd /opt/ngrok
echo "Downloading ngrok for $ARCH . . ."
wget $DOWNLOAD_URL
tar xzf $ARCHIVE
rm $ARCHIVE
chmod +x ngrok
systemctl enable ngrok.service
systemctl start ngrok.service
echo "Done installing ngrok"
exit 0