GPS & LOWMODE patch

This commit is contained in:
fred 2023-10-26 14:41:38 +02:00
parent 442ceb04d4
commit aedd8e1b52
3 changed files with 11 additions and 28 deletions

View File

@ -19,14 +19,10 @@ mv ~/.zen/coucou ~/.zen/tmp/coucou
## IPFS DAEMON STATUS
LOWMODE=$(sudo systemctl status ipfs | grep disabled) ## IPFS DISABLED - START ONLY FOR SYNC -
[[ $LOWMODE == "" ]] && LOWMODE=$(ipfs swarm peers 2>&1 | grep Error) ## IPFS IS STOPPED
[[ $LOWMODE == "" ]] && LOWMODE=$(ipfs --timeout 10s swarm peers 2>&1 | grep Error) ## IPFS IS STOPPED
[[ ! $isLAN ]] && LOWMODE="" ## LOWMODE ONLY FOR LAN STATION
# echo "$USER ALL=(ALL) NOPASSWD:/bin/systemctl" | (sudo su -c 'EDITOR="tee" visudo -f /etc/sudoers.d/systemctl')
if [[ $LOWMODE != "" ]]; then
sudo systemctl start ipfs && sleep 10
else
sudo systemctl restart ipfs && sleep 10
fi
sudo systemctl restart ipfs && sleep 10
espeak "CODE git pull" > /dev/null 2>&1

View File

@ -81,29 +81,26 @@ for PLAYER in ${PLAYERONE[@]}; do
rm -Rf ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/
mkdir -p ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/
################### GET LATEST TW
echo "Getting latest online TW..."
LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2)
echo "/ipns/${ASTRONAUTENS} ON $LIBRA"
## IPFS / HTTP / LOCAL
#~ DISABLED || curl -m 60 -so ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html "$LIBRA/ipns/${ASTRONAUTENS}" \
# || cp ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html
echo "/ipns/${ASTRONAUTENS}"
rm ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html 2>/dev/null
ipfs --timeout 480s get -o ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html /ipns/${ASTRONAUTENS}
## PLAYER TW IS ONLINE ?
if [ ! -s ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html ]; then
NOWCHAIN=$(cat ~/.zen/game/players/${PLAYER}/ipfs/moa/.chain)
LASTCHAIN=$(cat ~/.zen/game/players/${PLAYER}/ipfs/moa/.chain.* | tail -n 1)
echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
echo "ERROR_PLAYERTW_OFFLINE : /ipns/${ASTRONAUTENS}"
echo "------------------------------------------------"
echo "MANUAL PROCEDURE NEEDED"
echo ">> MANUAL CONTROL NEEDED"
echo "------------------------------------------------"
echo "${myIPFS}/ipfs/${LASTCHAIN}"
echo "LAST : ${myIPFS}/ipfs/${LASTCHAIN}"
echo "NOW : ${myIPFS}/ipfs/${NOWCHAIN}"
echo ""
echo "ipfs name publish --key=${PLAYER} /ipfs/${LASTCHAIN}"
echo "ipfs name publish --key=${PLAYER} /ipfs/${NOWCHAIN}"
echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
continue

View File

@ -31,17 +31,7 @@ sudo bash install.sh
# Test & clean
[[ $(ipfs --version) ]] \
&& rm -Rf ~/.zen/tmp/kubo*
[[ $XDG_SESSION_TYPE == 'x11' ]] && xdg-open https://www.openstreetmap.org
echo "OUVREZ https://www.openstreetmap.org"
echo "ET CALIBREZ LA SYNCHRO 20H12 AVEC LE TEMPS NATUREL"
echo "SAISIR LES COORD. GPS DE VOTRE STATION IPFS (ex: 48.87039, 2.31673)"
read GPS
[[ $GPS == "" ]] && GPS="48.87039, 2.31673"
mkdir -p ~/.zen/
echo "$GPS" > ~/.zen/GPS
&& rm -Rf ~/.zen/tmp/kubo* \
|| echo "problem occured"
exit 0