forked from axiom-team/astroport
refresh full bootstrap
This commit is contained in:
parent
8d155a01c2
commit
bfc5b6048f
|
@ -16,16 +16,8 @@ ME="${0##*/}"
|
|||
# ex: ./'$ME'
|
||||
# SYNC IPFS SWARM PEERS SHARED DATA .Qm****
|
||||
########################################################################'
|
||||
export YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1);
|
||||
[[ $YOU == "" ]] && echo "Please run ipfs daemon" && exit 1
|
||||
########################################################################
|
||||
# ENVIRONEMENT DETECTION + IPFS ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_info
|
||||
########################################################################
|
||||
IPFSNODEID=$(ipfs id -f='<id>\n')
|
||||
[[ $IPFSNODEID == "" ]] && echo "ERROR missing IPFS Node id !! IPFS is not installed !?" && exit 1
|
||||
########################################################################
|
||||
[[ ! -f ~/.ssb/secret.dunikey ]] && $MY_PATH/tools/secret2dunikey.sh
|
||||
G1PUB=$(cat ~/.ssb/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
|
||||
export YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1)
|
||||
export IPFSNODEID=$(ipfs id -f='<id>\n')
|
||||
########################################################################
|
||||
|
||||
mkdir -p ~/.zen/ipfs_swarm
|
||||
|
@ -37,7 +29,7 @@ _|_| | __) __)\/\//--\| \| | | \|_| | \|___)| |
|
|||
'
|
||||
echo "I am $IPFSNODEID"
|
||||
|
||||
## CHANNELS SWARM INDEX COPY PROCEDURE
|
||||
## TODO CHANNELS SWARM INDEX COPY PROCEDURE
|
||||
## SIGNAL ~/.zen/g1sms/ TODO
|
||||
|
||||
echo "PUBLISHING MY OWN /home/$YOU/.zen/ipfs/ to SWARM"
|
||||
|
@ -53,20 +45,20 @@ count=1
|
|||
for peer in $(ipfs swarm peers);
|
||||
do
|
||||
id=$(echo "$peer" | grep 'ip4' | awk -F '/' '{print $7}')
|
||||
# FULL REFRESH (allow deletion, for DEV period)
|
||||
# TODO: COMMENT TO LOWER DISK USAGE
|
||||
[[ "$id" == "" ]] && id=$(echo "$peer" | grep 'ip6' | awk -F '/' '{print $7}')
|
||||
[[ "$id" == "" ]] && echo "WARNING! ID empty for $peer " && continue
|
||||
|
||||
echo " ($count) Refreshing /home/$YOU/.zen/ipfs_swarm/.$id"
|
||||
rm -Rf /home/$YOU/.zen/ipfs_swarm/.$id
|
||||
$MY_PATH/tools/timeout.sh -t 30 ipfs get --output=/home/$YOU/.zen/ipfs_swarm/ /ipns/$id
|
||||
|
||||
|
||||
#### IPFS SWARM - BLOB SHAPING CONTROL -
|
||||
#### IPFS SWARM SHAPING CONTROL
|
||||
### CHECK Astroport Station Database Coherence?
|
||||
if [[ ! -d /home/$YOU/.zen/ipfs_swarm/.$id ]]; then
|
||||
echo "WARNING! $peer is NOT an Astroport Station !!"
|
||||
ipfs swarm disconnect $peer
|
||||
ipfs bootstrap rm $peer
|
||||
# TODO bannish with firewall ?
|
||||
fi
|
||||
|
||||
### Is "ipfs_swarm/.$id/G1SSB/_ssb.whoami" my SSB friend??
|
||||
|
|
|
@ -30,13 +30,12 @@ ME="${0##*/}"
|
|||
########################################################################
|
||||
|
||||
########################################################################
|
||||
# ENVIRONEMENT DETECTION + IPFS ~/.zen/ipfs/.$ipfsnodeid/G1SSB/_info
|
||||
# ENVIRONEMENT DETECTION + IPFS ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_info
|
||||
########################################################################
|
||||
ipfsnodeid=$(ipfs id -f='<id>\n')
|
||||
[[ $ipfsnodeid == "" ]] && echo "ERROR missing IPFS Node id !! IPFS is not installed !?" && exit 1
|
||||
IPFSNODEID=$(ipfs id -f='<id>\n')
|
||||
[[ $IPFSNODEID == "" ]] && echo "ERROR missing IPFS Node id !! IPFS is not installed !?" && exit 1
|
||||
########################################################################
|
||||
[[ ! -f ~/.ssb/secret.dunikey ]] && $MY_PATH/tools/secret2dunikey.sh
|
||||
g1pub=$(cat ~/.ssb/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
|
||||
WHOAMI=$(sbotc whoami | jq -r .id)
|
||||
########################################################################
|
||||
|
||||
echo '
|
||||
|
@ -51,22 +50,21 @@ EXTEND IPFS SWARM and SHAPE IT FROM (ssb_INIT.sh) FRIENDS
|
|||
Search "ipfstryme" message type in SSB feed
|
||||
'
|
||||
|
||||
self=$(sbotc whoami | jq -r .id)
|
||||
|
||||
# GET /tmp/ssb-friends.txt
|
||||
sbotc query.read '{"query":[{"$filter":{"value":{"author": "'"$self"'", "content":{"type":"contact"}}}}]}' | jq -r '.value?.content?.contact' > /tmp/ssb-friends.txt
|
||||
sbotc query.read '{"query":[{"$filter":{"value":{"author": "'"$WHOAMI"'", "content":{"type":"contact"}}}}]}' | jq -r '.value?.content?.contact' > /tmp/ssb-friends.txt
|
||||
|
||||
# GET /tmp/ssb-NOTfriends.txt
|
||||
sbotc links "{\"source\": \"${self}\", \"rel\": \"contact\", \"values\": true, \"reverse\": true}" | jq -c . | grep 'blocking":true' | jq -r .dest > /tmp/ssb-NOTfriends.txt
|
||||
|
||||
# Force Strict #swarm0 !!
|
||||
# ipfs bootstrap rm --all
|
||||
sbotc links "{\"source\": \"${WHOAMI}\", \"rel\": \"contact\", \"values\": true, \"reverse\": true}" | jq -c . | grep 'blocking":true' | jq -r .dest > /tmp/ssb-NOTfriends.txt
|
||||
|
||||
count=1
|
||||
########################################################################
|
||||
# Let's look if our SSB Friends ARE "IPFS swarm connected"
|
||||
########################################################################
|
||||
for SSBFRIEND in $(cat /tmp/ssb-friends.txt); do
|
||||
|
||||
# Force Strict #swarm0 !!
|
||||
[[ $count == 1 ]] && ipfs bootstrap rm --all
|
||||
|
||||
### GET SSB "ipfstryme" message type !!! Astroport Node should have publish it during "ssb_INIT.sh"
|
||||
TRYME=$(sbotc query.read '{"query":[{"$filter":{"value":{"author": "'"$SSBFRIEND"'", "content":{"type":"ipfstryme"}}}}]}' | jq -r .value?.content?.text | tail -n 1)
|
||||
|
||||
|
@ -76,6 +74,10 @@ for SSBFRIEND in $(cat /tmp/ssb-friends.txt); do
|
|||
## ADD Friend to our IPFS swarm
|
||||
[[ $TRYME ]] && echo "Friend $TRYME" && ipfs swarm connect $TRYME && ipfs bootstrap add $TRYME
|
||||
|
||||
[[ ! $TRYME ]] && echo "ERROR $SSBFRIEND NOT PUBLISHING ipfstryme"
|
||||
|
||||
count=$((count+1))
|
||||
|
||||
done
|
||||
|
||||
ipfs swarm peers
|
||||
|
|
Loading…
Reference in New Issue