34 lines
950 B
Bash
Executable File
34 lines
950 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
SCRIPT=$0
|
|
EXAMPLE=$1
|
|
|
|
if [ $# -eq 0 ] || [ "$EXAMPLE" != "https" ] && [ "$EXAMPLE" != "grpcs" ]; then
|
|
echo "usage: $SCRIPT https|grpcs"
|
|
exit 1
|
|
fi
|
|
|
|
FEATURES=$(if [ "$EXAMPLE" == "https" ]; then echo "reqwest,occlum"; else echo "tonic,occlum"; fi)
|
|
|
|
occlum-cargo build --example mratls_"${EXAMPLE}"_client --features="$FEATURES"
|
|
strip target/x86_64-unknown-linux-musl/debug/examples/mratls_"${EXAMPLE}"_client
|
|
|
|
cat > client.yaml <<EOF
|
|
includes:
|
|
- base.yaml
|
|
targets:
|
|
- target: /bin
|
|
copy:
|
|
- files:
|
|
- ../target/x86_64-unknown-linux-musl/debug/examples/mratls_${EXAMPLE}_client
|
|
EOF
|
|
|
|
rm -rf client_instance && mkdir client_instance && cd client_instance
|
|
occlum init && rm -rf image
|
|
copy_bom -f ../client.yaml --root image --include-dir /opt/occlum/etc/template
|
|
occlum build --sign-key ../examples/signing_key.pem --enable-edmm Y
|
|
occlum package --debug client.tar.gz
|
|
|
|
occlum run /bin/mratls_${EXAMPLE}_client
|