Upgrade TW to latest version when moving PLAYER
This commit is contained in:
parent
62aa6cd563
commit
bbbc4174f6
|
@ -55,30 +55,36 @@ if [[ $SALT != "" && PEPPER != "" ]]; then
|
||||||
|
|
||||||
echo "SCANNING /ipns/${ASTRONAUTENS} for 180s"
|
echo "SCANNING /ipns/${ASTRONAUTENS} for 180s"
|
||||||
## GETTING LAST TW via IPFS or HTTP GW
|
## GETTING LAST TW via IPFS or HTTP GW
|
||||||
[[ $YOU ]] \
|
ipfs --timeout 180s cat /ipns/${ASTRONAUTENS} > ~/.zen/tmp/${MOATS}/TW/index.html
|
||||||
&& ipfs --timeout 180s cat /ipns/${ASTRONAUTENS} > ~/.zen/tmp/${MOATS}/TW/index.html
|
|
||||||
|
|
||||||
[[ $XDG_SESSION_TYPE == 'x11' || $XDG_SESSION_TYPE == 'wayland' ]] \
|
|
||||||
&& [[ -s ~/.zen/tmp/${MOATS}/TW/index.html ]] \
|
|
||||||
&& echo "TW FOUND ENTER 'yes' TO RESET TW. HIT ENTER TO KEEP IT." \
|
|
||||||
&& read ENTER
|
|
||||||
|
|
||||||
if [[ $ENTER != "" ]]; then
|
|
||||||
|
|
||||||
|
if [[ -s ~/.zen/tmp/${MOATS}/TW/index.html ]]; then
|
||||||
|
echo "TW FOUND... BACKUP TIDDLERS"
|
||||||
# BACKUP tiddlers
|
# BACKUP tiddlers
|
||||||
tiddlywiki --load ~/.zen/tmp/${MOATS}/TW/index.html --output ~/.zen/tmp \
|
tiddlywiki --load ~/.zen/tmp/${MOATS}/TW/index.html --output ~/.zen/tmp/${MOATS} \
|
||||||
--render '.' 'backup.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[!is[system]]'
|
--render '.' 'backup.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[!is[system]]'
|
||||||
rm ~/.zen/tmp/${MOATS}/TW/index.html
|
|
||||||
echo ">> Tiddlers Backup : ~/.zen/tmp/backup.json"
|
[[ -s ~/.zen/tmp/${MOATS}/backup.json ]] \
|
||||||
|
&& rm ~/.zen/tmp/${MOATS}/TW/index.html \
|
||||||
|
&& echo ">> Tiddlers Backup : ~/.zen/tmp/${MOATS}/backup.json" \
|
||||||
|
|| echo "ERROR EXTRACTING TIDDLERS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#############################################
|
#############################################
|
||||||
## AUCUN RESULTAT
|
## CREATE NEW TW FROM TEMPLATE
|
||||||
if [ ! -s ~/.zen/tmp/${MOATS}/TW/index.html ]; then
|
|
||||||
|
|
||||||
cp ${MY_PATH}/../templates/twuplanet.html ~/.zen/tmp/${MOATS}/TW/index.html
|
cp ${MY_PATH}/../templates/twuplanet.html ~/.zen/tmp/${MOATS}/TW/index.html
|
||||||
|
|
||||||
else
|
#### REFILL WITH BACKUP
|
||||||
|
if [[ -s ~/.zen/tmp/${MOATS}/backup.json ]]; then
|
||||||
|
|
||||||
|
tiddlywiki --load ~/.zen/tmp/${MOATS}/TW/index.html \
|
||||||
|
--import ~/.zen/tmp/backup.json "application/json" \
|
||||||
|
--output ~/.zen/tmp/${MOATS} --render "$:/core/save/all" "tw.html" "text/plain"
|
||||||
|
|
||||||
|
[[ -s ~/.zen/tmp/${MOATS}/tw.html ]] \
|
||||||
|
&& cp -f ~/.zen/tmp/${MOATS}/tw.html ~/.zen/tmp/${MOATS}/TW/index.html
|
||||||
|
|
||||||
|
echo "BACKUP RESTORED"
|
||||||
|
fi
|
||||||
#############################################
|
#############################################
|
||||||
# EXISTING TW : DATA TESTING & CACHE
|
# EXISTING TW : DATA TESTING & CACHE
|
||||||
rm -f ~/.zen/tmp/${MOATS}/Astroport.json
|
rm -f ~/.zen/tmp/${MOATS}/Astroport.json
|
||||||
|
@ -107,7 +113,7 @@ if [[ $SALT != "" && PEPPER != "" ]]; then
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
ipfs key rm ${MOATS} 2>/dev/null ## CLEANING MOATS KEY
|
ipfs key rm ${MOATS} 2>/dev/null ## CLEANING MOATS KEY
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue