forked from cardano-scaling/hydra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprepare-devnet.sh
executable file
·24 lines (17 loc) · 955 Bytes
/
prepare-devnet.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
#!/usr/bin/env bash
# Prepare a "devnet" directory holding credentials, a dummy topology and
# "up-to-date" genesis files. If the directory exists, it is wiped out.
set -eo pipefail
BASEDIR=${BASEDIR:-$(realpath $(dirname $(realpath $0))/..)}
TARGETDIR=${TARGETDIR:-devnet}
[ -d "$TARGETDIR" ] && { echo "Cleaning up directory $TARGETDIR" ; rm -rf $TARGETDIR ; }
cp -af "$BASEDIR/hydra-cluster/config/devnet" "$TARGETDIR"
chmod -R u+w "$TARGETDIR"
cp -af "$BASEDIR/hydra-cluster/config/credentials" "$TARGETDIR"
chmod -R u+w "$TARGETDIR"
echo '{"Producers": []}' > "$TARGETDIR/topology.json"
sed -i.bak "s/\"startTime\": [0-9]*/\"startTime\": $(date +%s)/" "$TARGETDIR/genesis-byron.json" && \
sed -i.bak "s/\"systemStart\": \".*\"/\"systemStart\": \"$(date -u +%FT%TZ)\"/" "$TARGETDIR/genesis-shelley.json"
find $TARGETDIR -type f -name '*.skey' -exec chmod 0400 {} \;
mkdir "$TARGETDIR/ipc"
echo "Prepared devnet, you can start the cluster now"