better control for backup

This commit is contained in:
fred 2022-08-28 19:18:46 +02:00
parent abab3a9012
commit 5e473db7e6
2 changed files with 33 additions and 21 deletions

View File

@ -35,16 +35,21 @@ for PLAYER in $(ls ~/.zen/game/players/); do
## Replace tube links with downloaded video ## Replace tube links with downloaded video
$MY_PATH/TUBE.copy.sh ~/.zen/tmp/astro/index.html $PLAYER $MY_PATH/TUBE.copy.sh ~/.zen/tmp/astro/index.html $PLAYER
echo "DIFFERENCE ?" echo "DIFFERENCE ?"
diff ~/.zen/tmp/astro/index.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html DIFF=$(diff ~/.zen/tmp/astro/index.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html)
echo "Upgrade TW local copy..." if [[ $DIFF ]]; then
echo "Backup & Upgrade TW local copy..."
cp -f ~/.zen/game/players/$PLAYER/ipfs/moa/index.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.backup.html
cp ~/.zen/tmp/astro/index.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html cp ~/.zen/tmp/astro/index.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
else
echo "No change since last Refresh"
fi
fi fi
TW=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ipfs/moa/index.html | tail -n 1) TW=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ipfs/moa/index.html | tail -n 1)
ipfs name publish --key=$PLAYER /ipfs/$TW ipfs name publish --key=$PLAYER /ipfs/$TW
echo "================================================"
echo "$PLAYER : http://127.0.0.1:8080/ipns/$ASTRONAUTENS" echo "$PLAYER : http://127.0.0.1:8080/ipns/$ASTRONAUTENS"
echo "================================================"
done done

View File

@ -42,35 +42,42 @@ do
$MY_PATH/TUBE.copy.sh ~/.zen/tmp/work/index.html $voeu $MY_PATH/TUBE.copy.sh ~/.zen/tmp/work/index.html $voeu
echo "DIFFERENCE ?" echo "DIFFERENCE ?"
diff ~/.zen/tmp/work/index.html ~/.zen/game/world/$voeu/index.html DIFF=$(diff ~/.zen/tmp/work/index.html ~/.zen/game/world/$voeu/index.html)
echo "Update local copy"
# Update local copy if [[ $DIFF ]]; then
echo "Backup & Upgrade TW local copy..."
cp -f ~/.zen/game/world/$voeu/index.html ~/.zen/game/world/$voeu/index.backup.html
cp ~/.zen/tmp/work/index.html ~/.zen/game/world/$voeu/index.html cp ~/.zen/tmp/work/index.html ~/.zen/game/world/$voeu/index.html
else
echo "No change since last Refresh"
fi
fi fi
# RECORDING BLOCKCHAIN TIC # RECORDING BLOCKCHAIN TIC
MOATS=$(date -u +"%Y%m%d%H%M%S%4N") MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
cp ~/.zen/game/world/$voeu/.chain ~/.zen/game/world/$voeu/.chain.old [[ $DIFF ]] && cp ~/.zen/game/world/$voeu/.chain ~/.zen/game/world/$voeu/.chain.old
IPUSH=$(ipfs add -Hq ~/.zen/game/world/$voeu/index.html | tail -n 1) IPUSH=$(ipfs add -Hq ~/.zen/game/world/$voeu/index.html | tail -n 1)
ipfs name publish --key=${voeu} /ipfs/$IPUSH 2>/dev/null ipfs name publish --key=${voeu} /ipfs/$IPUSH 2>/dev/null
echo $IPUSH > ~/.zen/game/world/$voeu/.chain [[ $DIFF ]] && echo $IPUSH > ~/.zen/game/world/$voeu/.chain
echo $MOATS > ~/.zen/game/world/$voeu/.moats echo $MOATS > ~/.zen/game/world/$voeu/.moats
rm -Rf ~/.zen/tmp/work rm -Rf ~/.zen/tmp/work
if [[ -d ~/.zen/game/players/$PLAYER/voeux/$voeu ]]; then # if [[ -d ~/.zen/game/players/$PLAYER/voeux/$voeu ]]; then
echo "===========================" # echo "==========================="
echo "Voeu$W : commande de suppression" # echo "Voeu$W : commande de suppression"
echo "ipfs key rm $voeu # echo "ipfs key rm $voeu
rm -Rf ~/.zen/game/world/$voeu # rm -Rf ~/.zen/game/world/$voeu
rm -Rf ~/.zen/game/players/$PLAYER/voeux/$voeu" # rm -Rf ~/.zen/game/players/$PLAYER/voeux/$voeu"
echo "===========================" # echo "==========================="
# read QUOI # fi
# [[ "$QUOI" != "" ]] && ipfs key rm $voeu && rm -Rf ~/.zen/game/world/$voeu && rm -Rf ~/.zen/game/players/$PLAYER/voeux/$voeu && echo "SUPRESSION OK"
fi
echo "================================================"
echo "$W : http://127.0.0.1:8080/ipns/$voeuns" echo "$W : http://127.0.0.1:8080/ipns/$voeuns"
echo "================================================"
done done
exit 0 exit 0