diff options
| author | Nicolas James <Eele1Ephe7uZahRie@tutanota.com> | 2025-02-13 18:04:18 +1100 |
|---|---|---|
| committer | Nicolas James <Eele1Ephe7uZahRie@tutanota.com> | 2025-02-13 18:04:18 +1100 |
| commit | 93dfe2be64e8658839bcfe5356adf35f8cde7075 (patch) | |
| tree | c60b1e20d569b74dbde85123e1b2bf3590c66244 /run_server.sh | |
initial commit
Diffstat (limited to 'run_server.sh')
| -rwxr-xr-x | run_server.sh | 23 |
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} |
