forked from axiom-team/astroport
41 lines
1.3 KiB
Bash
41 lines
1.3 KiB
Bash
|
#!/bin/bash
|
||
|
################################################################################
|
||
|
# Author: Fred (support@qo-op.com)
|
||
|
# Version: 0.1
|
||
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||
|
# BACKUP G1sms+ current Devlt code and push it with NODE_G1AUTHFILE encryption to IPFS
|
||
|
################################################################################
|
||
|
## GET LATEST DEV $ROOT
|
||
|
source ./shell/init.sh
|
||
|
source ./shell/functions.sh
|
||
|
now=$(date +%Y-%m-%d)
|
||
|
dir=$(pwd | awk 'BEGIN { FS = "/" } ; {print $4}')
|
||
|
cd ..
|
||
|
|
||
|
publish=$(cat "./$dir/_official")
|
||
|
maillon=$(cat "./$dir/_chain")
|
||
|
if [[ "$publish" == "" ]]; then lev="ipfs"; hash="$maillon"; else lev="ipns"; hash="$publish"; fi
|
||
|
|
||
|
su $YOU -c "ipfs get --output=./ /$lev/$hash"
|
||
|
|
||
|
if [[ -f "./CODE/G1sms+.latest.tgz" ]]; then
|
||
|
echo "TODAY CODE FOUND... UNTAR in ls ./TODAY"
|
||
|
mkdir -p ./TODAY
|
||
|
cd TODAY
|
||
|
tar xvzf ../CODE/G1sms+.latest.tgz
|
||
|
# KEEP LOCAL NODE init.sh
|
||
|
if [[ ! -f "./$dir/shell/init.sh" ]]; then echo "backup restore problem..."; exit; fi
|
||
|
echo "REMOVE DEFAULT INIT..."
|
||
|
rm -f ./$dir/shell/init.sh
|
||
|
|
||
|
echo "DIFFERENCES ENTRE LES 2 VERSIONS:"
|
||
|
diff ./$dir/ ../$dir/
|
||
|
|
||
|
echo "VOULEZ VOUS METTRE A JOUR? Saisissez OUI"
|
||
|
read QUOI
|
||
|
if [[ "$QUOI" == "OUI" ]]; then sudo cp -Rf . ..; else echo "ANNULATION UPDATE"; exit; fi
|
||
|
|
||
|
fi
|
||
|
|
||
|
|