zenith/docker_files/zenith-docker_0.6.0.0/setup_docker
Rene Vergara A b675854c49 zenith-install - Docker image generation added to this branch
Scripts to create the installer and the docker image
		 distribution packages included
2024-07-05 20:10:11 -04:00

58 lines
1.7 KiB
Text
Executable file

#/bin/bash
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
echo "Warning: Zenith folder already exist, this procedure will erase"
echo " all existing data inside it. (a Backup is recommended)."
read -r -p "Do you want to proceed ? [Y/n] " response
case "$response" in
[yY])
rm -rf $HOME/Zenith
;;
*)
echo "... Zenith docker image setup not completed."
exit
;;
esac
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."
echo "... creating Zenith folder"
mkdir $HOME/Zenith
cp cfg/zenith.cfg $HOME/Zenith/
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
echo "... copying runzenith to $HOME/.local/bin "
cp cfg/runzenith $HOME/.local/bin/
if ! ( echo $PATH | grep -q $HOME/.local/bin ); then
echo 'export PATH=$PATH;$HOME/.local/bin' | tee -a $HOME/.bashrc
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