~/.ipfs/config.new
This commit is contained in:
parent
85e241fd12
commit
703b30a9af
|
@ -56,7 +56,9 @@ ipfs bootstrap > /tmp/ipfs_swarm_peers
|
||||||
ipfs swarm peers >> /tmp/ipfs_swarm_peers
|
ipfs swarm peers >> /tmp/ipfs_swarm_peers
|
||||||
|
|
||||||
rm ~/.zen/A_peering_peers.txt
|
rm ~/.zen/A_peering_peers.txt
|
||||||
cp ~/.ipfs/config ~/.ipfs/config.bak
|
# cp ~/.ipfs/config ~/.ipfs/config.bak
|
||||||
|
[[ -f ~/.ipfs/config.bak ]] && cp ~/.ipfs/config.bak ~/.ipfs/config
|
||||||
|
rm ~/.ipfs/config.new
|
||||||
|
|
||||||
# for ipfsnodeid in $( (cat /tmp/ipfs_swarm_peers | grep -o '[^/]*$' && cat /tmp/A_swarm | grep -o '[^/]*$' ) | sort | uniq); ## TODO ACTIVATE IN DEFCON 4
|
# for ipfsnodeid in $( (cat /tmp/ipfs_swarm_peers | grep -o '[^/]*$' && cat /tmp/A_swarm | grep -o '[^/]*$' ) | sort | uniq); ## TODO ACTIVATE IN DEFCON 4
|
||||||
for ipfsnodeid in $(cat ~/.zen/ipfs_swarm/.*/tryme.addr | grep -o '[^/]*$' | sort | uniq);
|
for ipfsnodeid in $(cat ~/.zen/ipfs_swarm/.*/tryme.addr | grep -o '[^/]*$' | sort | uniq);
|
||||||
|
@ -144,15 +146,10 @@ do
|
||||||
echo "## CREATING Peering.Peer entries"
|
echo "## CREATING Peering.Peer entries"
|
||||||
################################################################
|
################################################################
|
||||||
Addr=$(echo "$peerline" | rev | cut -d '/' -f 2- | rev )
|
Addr=$(echo "$peerline" | rev | cut -d '/' -f 2- | rev )
|
||||||
IsAlreadythere=$(cat ~/.zen/A_peering_peers.txt | grep $ipfsnodeid)
|
IsAlreadythere=$(cat ~/.ipfs/config.new | grep $ipfsnodeid)
|
||||||
if [[ ! $IsAlreadythere ]]; then
|
if [[ ! $IsAlreadythere ]]; then
|
||||||
echo '{ "ID": "'$ipfsnodeid'", "Addrs": [] }' >> ~/.zen/A_peering_peers.txt
|
echo '{ "ID": "'$ipfsnodeid'", "Addrs": [] }' >> ~/.zen/A_peering_peers.txt
|
||||||
jq '.Peering.Peers? += { "ID": "'$ipfsnodeid'", "Addrs": [] }' ~/.ipfs/config > ~/.ipfs/config.new && cp ~/.ipfs/config.new ~/.ipfs/config
|
jq '.Peering.Peers? += { "Addrs": [], "ID": "'$ipfsnodeid'" }' ~/.ipfs/config > ~/.ipfs/config.new # && cp ~/.ipfs/config.new ~/.ipfs/config
|
||||||
else
|
|
||||||
####### ICI SE CONSTRUIT LA LISTE PEERING.PEERS conservée par IPFS
|
|
||||||
cat ~/.zen/A_peering_peers.txt | grep -Ev $ipfsnodeid > ~/.zen/A_peering_peers.txt # remove old line
|
|
||||||
echo "$IsAlreadythere" | jq -c --arg new "$Addr" '.Addrs? += [$new]' >> ~/.zen/A_peering_peers.txt # add new Addrs to previous line
|
|
||||||
echo "MUST add Addr using jq"
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else # if [[ "$myfriendpeer" != "" ]];
|
else # if [[ "$myfriendpeer" != "" ]];
|
||||||
|
|
Loading…
Reference in New Issue