diff options
author | 2021-01-10 13:26:30 -0800 | |
---|---|---|
committer | 2021-01-10 17:04:58 -0800 | |
commit | 90f0359403fcbaffcddd49a1ca4ff55719ba95cb (patch) | |
tree | f24dcbfac34eefaa7a88037c894b2b7356c35819 /scripts | |
parent | Add 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-x | scripts/protoc.sh | 14 |
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" |