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
$MY_PATH/TUBE.copy.sh ~/.zen/tmp/astro/index.html $PLAYER
echo "DIFFERENCE ?"
diff ~/.zen/tmp/astro/index.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
echo "Upgrade TW local copy..."
cp ~/.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)
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
else
echo "No change since last Refresh"
fi
fi
TW=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ipfs/moa/index.html | tail -n 1)
ipfs name publish --key=$PLAYER /ipfs/$TW
echo "================================================"
echo "$PLAYER : http://127.0.0.1:8080/ipns/$ASTRONAUTENS"
echo "================================================"
done

View File

@ -42,35 +42,42 @@ do
$MY_PATH/TUBE.copy.sh ~/.zen/tmp/work/index.html $voeu
echo "DIFFERENCE ?"
diff ~/.zen/tmp/work/index.html ~/.zen/game/world/$voeu/index.html
echo "Update local copy"
# Update local copy
cp ~/.zen/tmp/work/index.html ~/.zen/game/world/$voeu/index.html
DIFF=$(diff ~/.zen/tmp/work/index.html ~/.zen/game/world/$voeu/index.html)
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
else
echo "No change since last Refresh"
fi
fi
# RECORDING BLOCKCHAIN TIC
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)
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
rm -Rf ~/.zen/tmp/work
if [[ -d ~/.zen/game/players/$PLAYER/voeux/$voeu ]]; then
echo "==========================="
echo "Voeu$W : commande de suppression"
echo "ipfs key rm $voeu
rm -Rf ~/.zen/game/world/$voeu
rm -Rf ~/.zen/game/players/$PLAYER/voeux/$voeu"
echo "==========================="
# read QUOI
# [[ "$QUOI" != "" ]] && ipfs key rm $voeu && rm -Rf ~/.zen/game/world/$voeu && rm -Rf ~/.zen/game/players/$PLAYER/voeux/$voeu && echo "SUPRESSION OK"
fi
# if [[ -d ~/.zen/game/players/$PLAYER/voeux/$voeu ]]; then
# echo "==========================="
# echo "Voeu$W : commande de suppression"
# echo "ipfs key rm $voeu
# rm -Rf ~/.zen/game/world/$voeu
# rm -Rf ~/.zen/game/players/$PLAYER/voeux/$voeu"
# echo "==========================="
# fi
echo "================================================"
echo "$W : http://127.0.0.1:8080/ipns/$voeuns"
echo "================================================"
done
exit 0