This repository has been archived on 2023-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
2022-02-12 22:12:18 +01:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
if [ -e /etc/systemd/system/lix.service ]; then
|
|
|
|
systemctl stop lix
|
|
|
|
fi
|
|
|
|
|
2022-07-31 16:01:52 +02:00
|
|
|
if [ -z ${lix_version} ] || [ "${lix_version}" = "latest" ]; then
|
|
|
|
lix_version=$(curl -s https://api.github.com/repos/SimonN/LixD/releases/latest | jq -r '.["tag_name"]' | cut -c2-)
|
|
|
|
fi
|
|
|
|
|
2022-02-12 22:12:18 +01:00
|
|
|
# Install Lix
|
|
|
|
mkdir -p ${TMPDIR:-/tmp}/lix-build
|
|
|
|
cd ${TMPDIR:-/tmp}/lix-build
|
|
|
|
if [ -d LixD ]; then
|
|
|
|
rm -rf LixD
|
|
|
|
fi
|
|
|
|
git clone --branch v${lix_version} https://github.com/SimonN/LixD.git
|
|
|
|
cd LixD/src/server
|
|
|
|
dub build
|
|
|
|
mkdir -p /opt/lix-${lix_version}
|
|
|
|
cp ../../bin/server /opt/lix-${lix_version}
|
|
|
|
rm -rf ${TMPDIR:-/tmp}/lix-build
|
|
|
|
|
|
|
|
# Create SystemD unit
|
|
|
|
cat > /etc/systemd/system/lix.service <<EOF
|
|
|
|
[Unit]
|
|
|
|
Description=Lix server
|
|
|
|
After=network.target
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
ExecStart=/opt/lix-${lix_version}/server
|
|
|
|
Restart=on-failure
|
|
|
|
User=${systemuser}
|
|
|
|
|
|
|
|
[Install]
|
|
|
|
WantedBy=multi-user.target
|
|
|
|
EOF
|
|
|
|
|
|
|
|
systemctl daemon-reload
|
|
|
|
systemctl enable --now lix.service
|
|
|
|
|
|
|
|
# Add firewall rules
|
|
|
|
firewall-cmd --zone=public --add-port=22934/udp --permanent
|