-
Notifications
You must be signed in to change notification settings - Fork 2
/
install.sh
executable file
·42 lines (33 loc) · 1 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
#!/usr/bin/env sh
set -eu
VERSION="0.1.1"
# Monschool Agent easy install script.
# See https://github.com/fossunited/monschool-agent/ for detailed installation steps.
check_dependencies() {
if ! command -v curl > /dev/null; then
echo "curl is not installed."
exit 1
fi
}
download_binary() {
mkdir -p /tmp/monschool-agent
cd /tmp/monschool-agent ; curl -sL https://github.com/fossunited/monschool-agent/releases/download/v${VERSION}/monschool-agent_${VERSION}_linux_amd64.tar.gz | tar xz
}
binary_path() {
mv /tmp/monschool-agent/monschool-agent.bin /usr/bin
}
setup_config() {
mkdir -p /etc/monschool-agent
mv /tmp/monschool-agent/config.sample.toml /etc/monschool-agent/config.toml
}
setup_systemd() {
mv /tmp/monschool-agent/deployment/monschool-agent.service /etc/systemd/system/monschool-agent.service
systemctl daemon-reload
systemctl enable --now monschool-agent
systemctl status monschool-agent
}
check_dependencies
download_binary
binary_path
setup_config
setup_systemd