aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2021-01-10 13:26:30 -0800
committerGravatar MarkKoz <[email protected]>2021-01-10 17:04:58 -0800
commit90f0359403fcbaffcddd49a1ca4ff55719ba95cb (patch)
treef24dcbfac34eefaa7a88037c894b2b7356c35819 /scripts
parentAdd protobuf as a dependency (diff)
Compile the NsJail config protobuf into Python code
Include a helper shell script for compilation.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/protoc.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/scripts/protoc.sh b/scripts/protoc.sh
new file mode 100755
index 0000000..5771b95
--- /dev/null
+++ b/scripts/protoc.sh
@@ -0,0 +1,14 @@
+#!/usr/bin/env sh
+
+set -eu
+
+URL='https://raw.githubusercontent.com/google/nsjail/2.9/config.proto'
+SRC_DIR='snekbox'
+FILE_NAME='config'
+PROTO_PATH="${SRC_DIR}/${FILE_NAME}.proto"
+
+curl -SsL "${URL}" -o "${PROTO_PATH}"
+protoc --proto_path="${SRC_DIR}" --python_out="${SRC_DIR}" "${PROTO_PATH}"
+
+rm -f "${PROTO_PATH}"
+mv -f "${SRC_DIR}/${FILE_NAME}_pb"*.py "${SRC_DIR}/${FILE_NAME}.py"