aboutsummaryrefslogtreecommitdiff
path: root/run_server.sh
diff options
context:
space:
mode:
Diffstat (limited to 'run_server.sh')
-rwxr-xr-xrun_server.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/run_server.sh b/run_server.sh
new file mode 100755
index 0000000..cc74379
--- /dev/null
+++ b/run_server.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+SERVER_DIR=$"./src/server/"
+SERVER_NAME=$"server"
+SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}")
+
+cd "${SCRIPT_DIR}" || exit
+if ! (npm run build) ; then
+ printf "\x1b[31mnpm build failed! stopping\n\x1b[0m" >&2
+ exit 1
+fi
+
+if ! (cd "${SERVER_DIR}" && go build && mv "${SERVER_NAME}" ../../); then
+ printf "\x1b[31mgo build failed! stopping\n\x1b[0m" >&2
+ exit 1
+fi
+
+if ! (sudo setcap 'cap_net_bind_service=+ep' "${SERVER_NAME}"); then
+ # We don't return here because this might not be necessary.
+ printf "\x1b[31mfailed to provide setcap privileges to binary\x1b[0m" >&2
+fi
+
+./${SERVER_NAME}