summaryrefslogtreecommitdiffstats
path: root/scripts/sh/deploy_ergo.sh
blob: 83b6b035d63e2fec333c3a6a0cfafe732f7e8a43 (plain)
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
#!/bin/sh
GOVER=`go version | { read _ _ v _; echo ${v#go}; }`
echo "Detected Go $GOVER"
GOVER_REQ="1.16.0"
if [ "$(printf '%s\n' "$GOVER_REQ" "$GOVER" | sort -V | head -n1)" = "$GOVER_REQ" ]
then
read -p "Deploy Ergo on this system? " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
zypper in --no-recommends -y git make
REPO="https://github.com/ergochat/ergo.git"
mkdir /opt/ergo
useradd -rUd /opt/ergo -s /bin/false ergo
chown ergo:ergo /opt/ergo
chmod 750 /opt/ergo
usermod -aG ergo pratyush
usermod -aG ergo georg
sudo -u ergo git clone $REPO /opt/ergo/ergo-git
cd /opt/ergo/ergo-git
sudo -u ergo make build
sudo -u ergo chmod +x ergo
ln -s /opt/ergo/ergo-git/ergo /opt/ergo/ergo
fi
else
echo "This is currently only compatible with Go 1.16.6 or higher. Consider deploy_go.sh."
fi