-
Notifications
You must be signed in to change notification settings - Fork 2
/
start-kbs.sh
executable file
·55 lines (45 loc) · 1.1 KB
/
start-kbs.sh
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
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
SCRIPT_PATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
# Load VM configuration
source "${SCRIPT_PATH}/vm.conf"
FLUSH_DB=0
function usage
{
echo -e "usage: $0 [OPTION...]"
echo -e ""
echo -e "Start Key Broker Server and SVSM proxy for QEMU"
echo -e ""
echo -e " -f, --flush-db flush the entire KBS database"
echo -e " -h, --help print this help"
}
while [ "$1" != "" ]; do
case $1 in
-f | --flush-db )
FLUSH_DB=1
;;
-h | --help )
usage
exit
;;
* )
echo -e "\nParameter not found: $1\n"
usage
exit 1
esac
shift
done
pushd "${SCRIPT_PATH}/kbs/reference-kbs"
if [ "${FLUSH_DB}" == "1" ]; then
rm -f db/diesel/db.sqlite
fi
cargo run &
popd
# Wait till the server is listening on port 8000
while ! netstat -tna | grep 'LISTEN\>' | grep -q ':8000\>'; do
sleep 1
done
set -x
pushd "${SCRIPT_PATH}/kbs/kbc"
RUST_LOG=info cargo run --example=svsm-proxy -- --unix "${PROXY_SOCK}" --url "${KBS_URL}" -f
popd
kill "$(jobs -p)"