summaryrefslogtreecommitdiffstats
path: root/scripts/sh/update_ergo.sh
diff options
context:
space:
mode:
authorGeorg Pfuetzenreuter2021-07-23 18:21:27 +0200
committerGeorg Pfuetzenreuter2021-07-23 18:21:27 +0200
commitbfe703327fda52dd601a878bbd70352ebbb92810 (patch)
tree212c5884681979f61c60c5c7bc6724abedf824a0 /scripts/sh/update_ergo.sh
parentc85c094f27483abb76a3cd4e1ed8fa8e88f3bd43 (diff)
downloadsystem-bfe703327fda52dd601a878bbd70352ebbb92810.tar.gz
system-bfe703327fda52dd601a878bbd70352ebbb92810.tar.bz2
system-bfe703327fda52dd601a878bbd70352ebbb92810.zip
Ergo deployment improvements, new Ergo update and Ergo removal scripts
Signed-off-by: Georg Pfuetzenreuter <georg@lysergic.dev>
Diffstat (limited to 'scripts/sh/update_ergo.sh')
-rwxr-xr-xscripts/sh/update_ergo.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/scripts/sh/update_ergo.sh b/scripts/sh/update_ergo.sh
new file mode 100755
index 0000000..289bd4b
--- /dev/null
+++ b/scripts/sh/update_ergo.sh
@@ -0,0 +1,26 @@
+#!/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
+if [ -f /opt/ergo/ergo-git/ergo ]
+then
+read -p "Update Ergo on this system? This will immediately stop Ergo if it is running. " -n 1 -r
+echo
+if [[ $REPLY =~ ^[Yy]$ ]]
+then
+systemctl stop ergo.service
+cd /opt/ergo/ergo-git
+rm -f ergo
+git pull
+sudo -u ergo make build
+sudo -u ergo /opt/ergo/ergo-git/ergo upgradedb --conf /opt/ergo/ircd.yaml
+systemctl start ergo.service
+fi
+else
+echo "Ergo does not seem to be installed. Consider deploy_ergo.sh."
+fi
+else
+echo "This is currently only compatible with Go $GOVER_REQ or higher. Consider deploy_go.sh."
+fi