2024-07-16 01:11:26 +00:00
|
|
|
#!/bin/bash
|
2024-07-12 17:32:59 +00:00
|
|
|
ZVERSION="0.6.0.0"
|
|
|
|
echo
|
|
|
|
echo "Zenith Full Node Docker Image Setup"
|
|
|
|
echo
|
|
|
|
echo "... testing if docker service is active.."
|
|
|
|
if systemctl is-active --quiet docker; then
|
|
|
|
if [ -d $HOME"/Zenith" ]; then
|
2024-07-16 15:35:02 +00:00
|
|
|
echo "Warning: Zenith configuration already exist, this procedure will create"
|
|
|
|
echo " a new configuration file. Your previous configurarion "
|
|
|
|
echo " will be saved as 'previous-zenith.cfg'. (a Backup is recommended)."
|
2024-07-12 17:32:59 +00:00
|
|
|
read -r -p "Do you want to proceed ? [Y/n] " response
|
|
|
|
case "$response" in
|
|
|
|
[yY])
|
2024-07-16 15:35:02 +00:00
|
|
|
if [ -f $HOME/Zenith/previous-zenith.cfg ]; then
|
|
|
|
rm $HOME/Zenith/previous-zenith.cfg
|
|
|
|
fi
|
|
|
|
mv $HOME/Zenith/zenith.cfg $HOME/Zenith/previous-zenith.cfg
|
2024-07-12 17:32:59 +00:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "... Zenith docker image setup not completed."
|
|
|
|
exit
|
|
|
|
;;
|
|
|
|
esac
|
2024-07-16 15:35:02 +00:00
|
|
|
else
|
|
|
|
echo "... creating Zenith folder"
|
|
|
|
mkdir -p $HOME/Zenith/assets
|
2024-07-12 17:32:59 +00:00
|
|
|
fi
|
|
|
|
if docker image ls | grep -q "zenith-docker" ; then
|
|
|
|
echo "... removing previous docker image"
|
|
|
|
docker rmi -f "zenith-docker:"$ZVERSION
|
|
|
|
fi
|
|
|
|
echo "... loading zenith-docker:"$ZVERSION" image"
|
|
|
|
docker load < zenith-docker_$ZVERSION.tar
|
|
|
|
echo "... docker image zenith-docker:"$ZVERSION" loaded."
|
2024-07-16 01:11:26 +00:00
|
|
|
echo "... creating default configuration"
|
2024-07-12 17:32:59 +00:00
|
|
|
cp cfg/zenith.cfg $HOME/Zenith/
|
2024-07-16 01:11:26 +00:00
|
|
|
cp -r /assets/ $HOME/Zenith/assets
|
2024-07-12 17:32:59 +00:00
|
|
|
if ! [ -d $HOME/.local/bin ]; then
|
|
|
|
echo "... creating $HOME/.local/bin folder"
|
|
|
|
mkdir -p $HOME/.local/bin
|
|
|
|
else
|
|
|
|
echo "... $HOME/.local/bin exists"
|
|
|
|
fi
|
|
|
|
if [ -f $HOME/.local/bin/runzenith ]; then
|
|
|
|
rm $HOME/.local/bin/runzenith
|
|
|
|
fi
|
2024-07-16 01:11:26 +00:00
|
|
|
echo "... copying runzenith to $HOME/.local/bin"
|
2024-07-12 17:32:59 +00:00
|
|
|
cp cfg/runzenith $HOME/.local/bin/
|
|
|
|
if echo $PATH | grep -q $HOME/.local/bin ; then
|
2024-07-16 01:11:26 +00:00
|
|
|
echo PATH=$PATH:$HOME/.local/bin | tee -a $HOME/.bashrc
|
2024-07-12 17:32:59 +00:00
|
|
|
echo "Reloading configuration ...."
|
|
|
|
source $HOME/.bashrc
|
|
|
|
fi
|
|
|
|
echo "... PATH=$PATH"
|
|
|
|
echo
|
|
|
|
echo "To start zenith execute 'runzenith' from the command line."
|
|
|
|
else
|
|
|
|
echo "... Docker service is not active"
|
|
|
|
echo "... Please activate Docker service first."
|
|
|
|
fi
|
|
|
|
echo
|
|
|
|
echo "Done"
|
|
|
|
echo
|