astroport/git-install.sh

28 lines
955 B
Bash
Raw Normal View History

2020-03-19 18:34:03 +01:00
#!/bin/bash
# Check if this script is not execute inside astroport folder
[[ $(basename "$PWD") == "astroport" ]] && echo "DO NOT EXECUTE THIS SCRIPT INSIDE ASTROPORT FOLDER!" && exit 1
2020-03-19 18:50:37 +01:00
[[ -d astroport ]] && rm -rf astroport && echo "astroport folder has been deleted."
2020-03-19 18:34:03 +01:00
[[ -z $(which git) ]] && echo "installation de git..." && sudo apt install git
2020-03-19 19:17:55 +01:00
isp2plegal=$(nc -zv -w 1 192.168.9.19 3000 2<&1)
if [[ "$isp2plegal" =~ "(?) open" ]]; then
2020-03-19 19:08:12 +01:00
isp2plegalbool=true
giturl="http://192.168.9.19:3000"
else
isp2plegalbool=false
giturl="https://git.p2p.legal"
fi
2020-03-19 18:34:03 +01:00
git clone $giturl/axiom-team/astroport.git
cd astroport
2020-03-19 19:08:12 +01:00
[[ $isp2plegalbool == true ]] && sed -i 's/https:\/\/git.p2p.legal/http:\/\/192.168.9.19:3000/g' .gitmodules && echo "Infra p2p.legal detected, switch remotes submodules"
2020-03-19 22:42:18 +01:00
echo -e '#!/bin/bash\n./git-update.sh' > .git/hooks/post-merge
2020-03-19 18:34:03 +01:00
git submodule update --init --recursive
source ./git-update.sh
2020-03-19 18:34:03 +01:00
echo "Astroport ready to go!"
exit 0