2023-05-17 21:11:56 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
lotus --version
|
|
|
|
|
2023-08-09 11:54:47 +00:00
|
|
|
# Loop until the daemon is started
|
|
|
|
echo "Waiting for miner to share peering info..."
|
|
|
|
while [ ! -f /root/.lotus-shared/miner.addr ]; do
|
|
|
|
sleep 5
|
|
|
|
done
|
|
|
|
echo "Resuming..."
|
2023-05-17 21:11:56 +00:00
|
|
|
|
|
|
|
# if not already initialized
|
2023-08-09 11:54:47 +00:00
|
|
|
if [ ! -f $LOTUS_PATH/config.toml ]; then
|
2023-05-17 21:11:56 +00:00
|
|
|
# init node config
|
2023-08-09 11:54:47 +00:00
|
|
|
mkdir $LOTUS_PATH
|
|
|
|
lotus config default > $LOTUS_PATH/config.toml
|
2023-05-17 21:11:56 +00:00
|
|
|
|
|
|
|
# add bootstrap peer info if available
|
|
|
|
if [ -f /root/.lotus-shared/miner.addr ]; then
|
|
|
|
MINER_ADDR=\"$(cat /root/.lotus-shared/miner.addr)\"
|
|
|
|
# add bootstrap peer id to config file
|
2023-08-09 11:54:47 +00:00
|
|
|
sed -i "/^\[Libp2p\]/a \ \ BootstrapPeers = [$MINER_ADDR]" $LOTUS_PATH/config.toml
|
2023-05-17 21:11:56 +00:00
|
|
|
else
|
|
|
|
echo "Bootstrap peer info not found, unable to configure. Manual peering will be required."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# start node
|
2023-08-09 11:54:47 +00:00
|
|
|
lotus daemon --genesis=/root/.lotus-shared/devgen.car
|