-
Notifications
You must be signed in to change notification settings - Fork 83
/
build.sh
executable file
·140 lines (118 loc) · 5.61 KB
/
build.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#!/bin/bash
# Derived from script from https://install.zerotier.com
set -ex
<<ENDOFSIGSTART=
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
ENDOFSIGSTART=
export PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin
#
# ZeroTier install script
#
# All this script does is determine your OS and/or distribution and then add the correct
# repository or download the correct package and install it. It then starts the service
# and prints your device's ZeroTier address.
#
# Base URL for download.zerotier.com tree; see https://github.com/zerotier/download.zerotier.com if you want to mirror.
# Some things want http, some https, so we must specify both. Must include trailing /
ZT_BASE_URL_HTTPS='https://download.zerotier.com/'
ZT_BASE_URL_HTTP='http://download.zerotier.com/'
# Detect already-installed on Linux
if [ -f /usr/sbin/zerotier-one ]; then
echo '*** ZeroTier One appears to already be installed.'
exit 0
fi
rm -f /tmp/zt-gpg-key
echo '-----BEGIN PGP PUBLIC KEY BLOCK-----' >/tmp/zt-gpg-key
cat >>/tmp/zt-gpg-key << END_OF_KEY
Comment: GPGTools - https://gpgtools.org
mQINBFdQq7oBEADEVhyRiaL8dEjMPlI/idO8tA7adjhfvejxrJ3Axxi9YIuIKhWU
5hNjDjZAiV9iSCMfJN3TjC3EDA+7nFyU6nDKeAMkXPbaPk7ti+Tb1nA4TJsBfBlm
CC14aGWLItpp8sI00FUzorxLWRmU4kOkr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YAQoACQUCV1CrugIbDAAK
CRAWVxmII+UqYWSSEACxaR/hhr8xUIXkIV52BeD+2BOS8FNOi0aM67L4fEVplrsV
Op9fvAnUNmoiQo+RFdUdaD2Rpq+yUjQHHbj92mlk6Cmaon46wU+5bAWGYpV1Uf+o
wbKw1Xv83Uj9uHo7zv9WDtOUXUiTe/S792icTfRYrKbwkfI8iCltgNhTQNX0lFX/
Sr2y1/dGCTCMEuA/ClqGKCm9lIYdu+4z32V9VXTSX85DsUjLOCO/hl9SHaelJgmi
IJzRY1XLbNDK4IH5eWtbaprkTNIGt00QhsnM5w+rn1tO80giSxXFpKBE+/pAx8PQ
RdVFzxHtTUGMCkZcgOJolk8y+DJWtX8fP+3a4Vq11a3qKJ19VXk3qnuC1aeW7OQF
j6ISyHsNNsnBw5BRaS5tdrpLXw6Z7TKr1eq+FylmoOK0pIw5xOdRmSVoFm4lVcI5
e5EwB7IIRF00IFqrXe8dCT0oDT9RXc6CNh6GIs9D9YKwDPRD/NKQlYoegfa13Jz7
S3RIXtOXudT1+A1kaBpGKnpXOYD3w7jW2l0zAd6a53AAGy4SnL1ac4cml76NIWiF
m2KYzvMJZBk5dAtFa0SgLK4fg8X6Ygoo9E0JsXxSrW9I1JVfo6Ia//YOBMtt4XuN
Awqahjkq87yxOYYTnJmr2OZtQuFboymfMhNqj3G2DYmZ/ZIXXPgwHx0fnd3R0Q==
=JgAv
END_OF_KEY
echo '-----END PGP PUBLIC KEY BLOCK-----' >>/tmp/zt-gpg-key
echo '*** Detecting Linux Distribution'
echo
baseurl="${ZT_BASE_URL_HTTP}redhat/el/7"
rpm --import /tmp/zt-gpg-key
rm -f /tmp/zerotier.repo
echo '[zerotier]' >/tmp/zerotier.repo
echo 'name=ZeroTier, Inc. RPM Release Repository' >>/tmp/zerotier.repo
echo "baseurl=$baseurl" >>/tmp/zerotier.repo
echo 'enabled=1' >>/tmp/zerotier.repo
echo 'gpgcheck=1' >>/tmp/zerotier.repo
mv -f /tmp/zerotier.repo /etc/yum.repos.d/zerotier.repo
chown 0 /etc/yum.repos.d/zerotier.repo
chgrp 0 /etc/yum.repos.d/zerotier.repo
# Avoid uid and gid conflicts in Ubuntu Docker hosts
groupadd -g 2000 zerotier-one
useradd -u 2000 -g 2000 zerotier-one
groupadd -g 2001 ztncui
useradd -u 2001 -g 2001 ztncui
echo
echo '*** Installing zerotier-one package...'
dnf install -y zerotier-one
rm -f /tmp/zt-gpg-key
if [ ! -e /usr/sbin/zerotier-one ]; then
echo
echo '*** Package installation failed! Unfortunately there may not be a package'
echo '*** for your architecture or distribution. For the source go to:'
echo '*** https://github.com/zerotier/ZeroTierOne'
echo
exit 1
else
echo '*** ZeroTier One is installed ***'
fi
touch /var/lib/zerotier-one/authtoken.secret
chown zerotier-one.zerotier-one /var/lib/zerotier-one/authtoken.secret
chmod 640 /var/lib/zerotier-one/authtoken.secret
dnf install https://download.key-networks.com/el7/ztncui/1/ztncui-release-1-1.noarch.rpm -y
dnf install ztncui -y
dnf install sudo -y
rm -f /var/lib/zerotier-one/authtoken.secret
echo 'HTTPS_PORT=3443' > /opt/key-networks/ztncui/.env