-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathapploader.common.template
45 lines (37 loc) · 1.35 KB
/
apploader.common.template
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env bash
{% if buildtype != "release" %}
set -x
{% endif %}
set -e
# Export distro-specific paths (typically `PYTHONPATH` and `PKG_CONFIG_PATH`)
{% block path %}{% endblock %}
# Note: default to SGX if Gramine mode (`direct`, `sgx`) wasn't specified
GRAMINE_EXEC=gramine-sgx
# TODO: remove GSC_PAL in GSC v1.9
if [ -n "$GSC_PAL" ] && [ -n "$GRAMINE_MODE" ]; then
echo "ERROR: GSC_PAL and GRAMINE_MODE environment variables cannot be set together."
exit 1
fi
if [ -n "$GSC_PAL" ]; then
echo "WARNING: GSC_PAL environment variable is deprecated in v1.8 and will be removed in v1.9."
echo " Use instead the GRAMINE_MODE={direct|sgx} environment variable."
# legacy logic was peculiar: if GSC_PAL != Linux-SGX then we set Gramine to `gramine-direct`
if [ "$GSC_PAL" == "Linux-SGX" ]; then
GRAMINE_EXEC=gramine-sgx
else
GRAMINE_EXEC=gramine-direct
fi
fi
if [ -n "$GRAMINE_MODE" ]; then
if [ "$GRAMINE_MODE" == "sgx" ]; then
GRAMINE_EXEC=gramine-sgx
elif [ "$GRAMINE_MODE" == "direct" ]; then
GRAMINE_EXEC=gramine-direct
else
echo "ERROR: unrecognized GRAMINE_MODE; can only be 'direct' or 'sgx'."
exit 1
fi
fi
exec ${GRAMINE_EXEC} /gramine/app_files/entrypoint \
{% if insecure_args %}{{ binary_arguments | map('shlex_quote') | join(' ') }} \
"${@}"{% endif %}