-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshell.sh
More file actions
executable file
·45 lines (35 loc) · 1.05 KB
/
shell.sh
File metadata and controls
executable file
·45 lines (35 loc) · 1.05 KB
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
#!/bin/bash
set -e
if ! [ -f ./tmp/server.db ]; then
./test.sh || true
fi
export RUSTBACKTRACE=1
export RUST_LOG="secrets=debug"
export PATH=$PATH:$(pwd)/target/debug
export server="secrets-server -d ./tmp/server.db"
export client="secrets"
export david="$client --db=./tmp/client-david.db -p pass:password_david"
export CLIENT_DAVID="$david"
export florence="$client --db=./tmp/client-florence.db -p pass:password_florence"
export CLIENT_FLORENCE="$florence"
export bob="$client --db=./tmp/client-bob.db -p pass:password_bob"
export CLIENT_BOB="$bob"
$server server &
SERVER_PID=$!
echo started server at $SERVER_PID
# kill it when we're done
trap "ps -p $SERVER_PID > /dev/null && kill $SERVER_PID" EXIT
# make sure it launched
sleep 0.5
if ! ps -p $SERVER_PID > /dev/null; then
echo "server didn't start"
exit 1
fi
echo entering shell
export PS1="(secrets)\$ $PS1"
echo " " server: $server
echo " " client: $client
echo " " david: $david
echo " " florence: $florence
# don't `exec` here or the `trap` won't fire
bash --noprofile --norc