-
Notifications
You must be signed in to change notification settings - Fork 19
/
statusnook.sh
executable file
·67 lines (53 loc) · 1.4 KB
/
statusnook.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
#!/bin/bash
PORT=80
for arg in "$@"
do
case $arg in
-port)
PORT="$2"
shift
shift
;;
esac
done
useradd statusnook --system -m
cd /home/statusnook
case $(uname -m) in
x86_64)
goarch="amd64"
;;
aarch64)
goarch="arm64"
;;
*)
echo "unknown arch"
exit 1
;;
esac
curl -fsSL https://get.statusnook.com/statusnook_linux_${goarch}_v0.3.0 -o /home/statusnook/statusnook
chmod +x /home/statusnook/statusnook
cat <<EOF >/etc/systemd/system/statusnook.service
[Unit]
Description=Statusnook
After=network.target
[Service]
Type=simple
Restart=always
User=statusnook
WorkingDirectory=/home/statusnook
ExecStart=/home/statusnook/statusnook --port $PORT
EOF
if [ "$PORT" -eq 80 ]; then
echo -e "AmbientCapabilities=CAP_NET_BIND_SERVICE\n" >> /etc/systemd/system/statusnook.service
else
echo -e "" >> /etc/systemd/system/statusnook.service
fi
cat <<EOF >>/etc/systemd/system/statusnook.service
[Install]
WantedBy=multi-user.target
EOF
systemctl enable statusnook > /dev/null 2>&1
systemctl start statusnook
echo "Self-signed certificate SHA-256 fingerprint: $(su - statusnook -c "/home/statusnook/statusnook -generate-self-signed-cert")"
echo -e '\n\033[0;32mStatusnook successfully installed!\033[0m'
echo "To finalize your Statusnook instance setup, navigate to https://<your-ip-address-or-domain> in a web browser"