-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·80 lines (71 loc) · 3.37 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
set -e
apt update -yy
apt install -yy curl screen htop git build-essential
useradd -m topsnek
su - topsnek -c bash <<ENDOFSCRIPT
set -ex
mkdir -p logs
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
. "/home/topsnek/.cargo/env"
mkdir -p .ssh
cat > .ssh/id_rsa <<ENDOFKEY
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn
NhAAAAAwEAAQAAAYEA4YBvIVCI/GiM6nyDGH9kJvhUAIHdAO12gxnNhoXN3CD9Bf5vV7st
eoFpiZ3G93Ff4kHan4Hi8fCsmO0HMKxHL/e4L8psUlNV3aculUBKDBdNgLG8z3yoz4ST+F
mYz0ePdw8Nqt+70kLB6WbuNtJ1Kasi3ZV1CiSfA6oZ1/R+WvLmvwWbqOFs+ePt7NWF1doB
dNhOuiZMJ/0Z8NWwwiv+RQ05bCmCkUuBD3/V4QYRlVTXqJuYV/JhrPikYq+sU23L2F9Cql
XGpJbGnJkpAM29ghfcunO43PSN+qX9F5mmSFzmvlPIduySBHUZkRBEOc/90Q/DIj7vMaUv
PPUx461OFa11Tz2yP9oaHFXzRMzLYLwgXXuX/JD/ZjsXmogZ9FFP2kw7psyav7al1iVeC0
oxV9dxPvFU/K0p+w56a0FNDLeyhHhBtuFawSe4fC0wACY5gr264uVH4kTPp2xyP1US1wph
uNGiBjy2DzLW0oG8l+DbJuMU5Uow1osQdNYXw5Sh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igjTy3k4onOZvAgD9PDltBiypOcqWdAAAA
wQC//17jNGBscPu9KsySYU6lv9Bwf4GScuy9eRM1SC1wQYVD0QAArPpHYcrMKXHago76Q0
V2y2hIN+C/fSQUT6Lkigyg0wtFsVseDDZ/PEJjJoOqcwHsuPLFCSkVL1meEyYCN97poBp/
XKvWDLNkkFbmQVwH1jvQLNSXIlWMJLk1isXQm0yp/zQO0T/CPgfJmEdbwWnIfWBi7JtkyS
xGOWUdaccLLd9fT/dvLwFjN29gKFDH/OL3ECQxB/r75LcxdHEAAADBAPNs516RMWj3ZbSb
73ZF2wkPGLX5zE6VmSgp13IYm7Bp7XDyy7nfwaiAQkjqIOZrx15l+zByQ/+A7XRGhAVg9z
qrPg5hkaI1FoA5ELGpmv9lhgQmGcZp/NkO0ZQj/fxC2SuhwfKOLxR3TGiaD8eiIsNhgcLA
YUn25dUrIYm32e24lnos0Z6ISYoRJ+dhYzHYok4Q7QcuS9DrnCkkFLkVRl6weJXdvZv1d7
Va+u3ZAUolQthrXnm2ye4n9eEJSZ/BbQAAAMEA7SaBG+qGtStNpwIeYsbTKfkA9odu7B+E
Bqe2DDgB4uksPDgLJfGYuG4zZ27yVVUJwr7CAg8wK2aLSqrSF92qCD1GcdZLertcf0ODsS
hDCthvohNSVs7gtkoFEZZwOwY5c05+WuwSAvr8tHVrAKEba9uViy4i6FWuMfSXG44tMp3M
qcC6Iv56sp+ggMpf97a7aapS9gI7xZePyuGTDfgwrZ0bhGwNRgql0K1MFxYaklMUNzlS+4
yjZF/uPY2FbROFAAAACndpbUBtZXJrZWw=
-----END OPENSSH PRIVATE KEY-----
ENDOFKEY
chmod 0600 .ssh/id_rsa
ssh-keyscan github.com > .ssh/known_hosts
git clone [email protected]:wvdschel/topsnek.git
cd topsnek
cargo build --release
ENDOFSCRIPT
cp /home/topsnek/topsnek/target/release/topsnek-server /usr/bin
cat > /etc/systemd/system/topsnek.service <<ENDOFSERVICE
[Unit]
Description=topsnek
[Service]
WorkingDirectory=/home/topsnek/
User=topsnek
ExecStart=/usr/bin/topsnek-server 0.0.0.0
[Install]
WantedBy=multi-user.target
ENDOFSERVICE
systemctl daemon-reload
systemctl enable topsnek.service
systemctl start topsnek.service