corda/sgx-jvm/with_aesmd.sh

35 lines
1.1 KiB
Bash
Raw Normal View History

2017-07-04 15:38:33 +00:00
#!/bin/bash
set -euo pipefail
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
AESM_DIR=$SCRIPT_DIR/build/aesm/$TIMESTAMP
mkdir -p $AESM_DIR
SERVICE_FILES="aesm_service le_prod_css.bin libsgx_le.signed.so libsgx_pce.signed.so libsgx_pve.signed.so libsgx_qe.signed.so"
2017-07-06 09:06:01 +00:00
sed -e "s:@aesm_folder@:$AESM_DIR:" $SCRIPT_DIR/linux-sgx/build/linux/aesmd.service | sed -e '/InaccessibleDirectories=/d' | sed -e "s!^\\[Service\\]![Service]\nEnvironment=LD_LIBRARY_PATH=$SCRIPT_DIR/linux-sgx/build/linux:$SCRIPT_DIR/dependencies/root/usr/lib/x86_64-linux-gnu:$SCRIPT_DIR/dependencies/root/lib/x86_64-linux-gnu\nStandardOutput=journal\nStandardError=journal!" > $AESM_DIR/aesmd.service
2017-07-04 15:38:33 +00:00
for FILE in $SERVICE_FILES
do
ln -s $SCRIPT_DIR/linux-sgx/build/linux/$FILE $AESM_DIR/$FILE
done
sudo systemctl --runtime link $AESM_DIR/aesmd.service
function finish {
sudo systemctl stop aesmd
sudo systemctl --runtime disable aesmd
}
trap finish EXIT
sudo systemctl start aesmd
2017-07-06 09:06:01 +00:00
# Wait until aesmd is up
while ! netstat -a --unix | grep sgx_aesm
do
sleep 1
done
2017-07-04 15:38:33 +00:00
$@