From f6016825d7dba6355ba1f9f29c141a4a886c5061 Mon Sep 17 00:00:00 2001 From: fred Date: Fri, 3 Dec 2021 23:59:57 +0100 Subject: [PATCH] IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID) --- ajouter_video.sh | 2 +- cron_MINUTE.sh | 2 +- zen/bash_template.sh | 4 ++-- zen/create_subkeys_for_my_friends.sh | 2 +- zen/gchange_INIT.sh | 2 +- zen/gchange_IPFS_swarm.sh | 2 +- zen/ipfs_FRIENDS_refresh.sh | 2 +- zen/ipfs_P2P_forward.sh | 2 +- zen/ipfs_SWARM_refresh.sh | 2 +- zen/ipns_TAG_refresh.sh | 2 +- zen/ipns_self_publish.sh | 2 +- zen/new_file_in_astroport.sh | 2 +- zen/tools/add_externIP_to_ipfstryme.sh | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/ajouter_video.sh b/ajouter_video.sh index 01b679b..fa5941b 100755 --- a/ajouter_video.sh +++ b/ajouter_video.sh @@ -52,7 +52,7 @@ large=$((width-300)) haut=$((height-200)) ######################################################################## -IPFSNODEID=$(ipfs --timeout=20s id -f='\n') +IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID) [[ -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_title ]] && XGUID="$(cat ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_title)" || XGUID="$(cat /etc/hostname)" [[ -f ~/.zen/ipfs/.$IPFSNODEID/_xbian.zuid ]] && XZUID=$(cat ~/.zen/ipfs/.$IPFSNODEID/_xbian.zuid) diff --git a/cron_MINUTE.sh b/cron_MINUTE.sh index 3f4f6bb..9f5de34 100755 --- a/cron_MINUTE.sh +++ b/cron_MINUTE.sh @@ -20,7 +20,7 @@ source $HOME/.profile #### CONTROL STATION IPFS DAEMON ## timeout is fixing ipfs minimum response time, before considering stuck process -IPFSNODEID=$(ipfs --timeout=20s id -f='\n') +IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID) howmany=$(cat /tmp/ipfs.timeout) if [[ ! $IPFSNODEID ]]; then ## wait a howmany timeout before restarting ipfs diff --git a/zen/bash_template.sh b/zen/bash_template.sh index 8dc21a2..a54db28 100755 --- a/zen/bash_template.sh +++ b/zen/bash_template.sh @@ -1,6 +1,6 @@ #!/bin/bash ######################################################################## -# Author: +# Author: # Version: 0.1 # License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/) ######################################################################## @@ -9,7 +9,7 @@ MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized ME="${0##*/}" YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) && [[ ! $YOU ]] && echo "ipfs NOT RUNNING. EXIT" && exit 1 G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) && [[ ! $G1PUB ]] && echo "ERREUR G1PUB. EXIT" && exit 1 -IPFSNODEID=$(ipfs id -f='\n') +IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID) [[ -f ~/.zen/ipfs/.$IPFSNODEID/_xbian.zuid ]] && AXID=$(cat ~/.zen/ipfs/.$IPFSNODEID/_xbian.zuid); [[ -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_title ]] && XZUID=$(cat ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_title) diff --git a/zen/create_subkeys_for_my_friends.sh b/zen/create_subkeys_for_my_friends.sh index c8ee27b..d5ab233 100755 --- a/zen/create_subkeys_for_my_friends.sh +++ b/zen/create_subkeys_for_my_friends.sh @@ -9,7 +9,7 @@ MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized ME="${0##*/}" YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) && [[ ! $YOU ]] && echo "ipfs NOT RUNNING. EXIT" && exit 1 G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) && [[ ! $G1PUB ]] && echo "ERREUR G1PUB. EXIT" && exit 1 -IPFSNODEID=$(ipfs id -f='\n') +IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID) ######################################################################## # SCAN AND MANAGE KEYS BETWEEN MOVIES & FRIENDS diff --git a/zen/gchange_INIT.sh b/zen/gchange_INIT.sh index b32d031..e8887a9 100755 --- a/zen/gchange_INIT.sh +++ b/zen/gchange_INIT.sh @@ -19,7 +19,7 @@ start=`date +%s` # INITIALISATION & CONTROL ######################################################################## YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1); -IPFSNODEID=$(ipfs --timeout=20s id -f='\n') +IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID) [[ ! $IPFSNODEID ]] && echo 'ERROR missing IPFS Node id !! IPFS is not installed !?' && exit 1 ######################################################################## diff --git a/zen/gchange_IPFS_swarm.sh b/zen/gchange_IPFS_swarm.sh index 1608097..7c6a93f 100755 --- a/zen/gchange_IPFS_swarm.sh +++ b/zen/gchange_IPFS_swarm.sh @@ -13,7 +13,7 @@ start=`date +%s` YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) && [[ ! $YOU ]] && echo "ipfs NOT RUNNING. EXIT" && exit 1 G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) && [[ ! $G1PUB ]] && echo "ERREUR G1PUB. EXIT" && exit 1 -IPFSNODEID=$(ipfs --timeout=20s id -f='\n') +IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID) [[ ! $IPFSNODEID ]] && echo 'ERROR missing IPFS Node id !! IPFS is not installed !?' && exit 1 # CLEAN "A_my_swarm.txt" and "A_swarm_map.txt" diff --git a/zen/ipfs_FRIENDS_refresh.sh b/zen/ipfs_FRIENDS_refresh.sh index dfd29f7..a485930 100755 --- a/zen/ipfs_FRIENDS_refresh.sh +++ b/zen/ipfs_FRIENDS_refresh.sh @@ -13,7 +13,7 @@ start=`date +%s` YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) && [[ ! $YOU ]] && echo "ipfs NOT RUNNING. EXIT" && exit 1 G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) && [[ ! $G1PUB ]] && echo "ERREUR G1PUB. EXIT" && exit 1 -IPFSNODEID=$(ipfs --timeout=20s id -f='\n') +IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID) [[ ! $IPFSNODEID ]] && echo 'ERROR missing IPFS Node id !! IPFS is not installed !?' && exit 1 ######################################################################## ######################################################################## diff --git a/zen/ipfs_P2P_forward.sh b/zen/ipfs_P2P_forward.sh index 40cc95e..184c456 100755 --- a/zen/ipfs_P2P_forward.sh +++ b/zen/ipfs_P2P_forward.sh @@ -9,7 +9,7 @@ MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized ######################################################################## YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) || er+=" ipfs daemon not running" -IPFSNODEID=$(ipfs --timeout=5s id -f='\n') || er+=" ipfs id problem" +IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID) || er+=" ipfs id problem" [[ "$YOU" == "" || "$IPFSNODEID" == "" ]] && echo "ERROR : $er " && exit 1 ######################################################################## # TODO ESTABLISH A PORT FORWARD STRATEGY (depending on Node Flavour) diff --git a/zen/ipfs_SWARM_refresh.sh b/zen/ipfs_SWARM_refresh.sh index e868982..025c928 100755 --- a/zen/ipfs_SWARM_refresh.sh +++ b/zen/ipfs_SWARM_refresh.sh @@ -13,7 +13,7 @@ start=`date +%s` YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) && [[ ! $YOU ]] && echo "ipfs NOT RUNNING. EXIT" && exit 1 G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) && [[ ! $G1PUB ]] && echo "ERREUR G1PUB. EXIT" && exit 1 -IPFSNODEID=$(ipfs --timeout=20s id -f='\n') +IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID) [[ ! $IPFSNODEID ]] && echo 'ERROR missing IPFS Node id !! IPFS is not installed !?' && exit 1 ######################################################################## ######################################################################## diff --git a/zen/ipns_TAG_refresh.sh b/zen/ipns_TAG_refresh.sh index 4bd6574..46f9ff3 100755 --- a/zen/ipns_TAG_refresh.sh +++ b/zen/ipns_TAG_refresh.sh @@ -20,7 +20,7 @@ countMErunning=$(ps auxf --sort=+utime | grep -w $ME | grep -v -E 'color=auto|gr ######################################################################## ######################################################################## -IPFSNODEID=$(ipfs --timeout=20s id -f='\n') +IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID) [[ ! $IPFSNODEID ]] && echo 'ERROR missing IPFS Node id !! IPFS is not installed !?' && exit 1 ######################################################################## [[ ! -f ~/.zen/secret.dunikey ]] && exit 1 diff --git a/zen/ipns_self_publish.sh b/zen/ipns_self_publish.sh index cf7bb43..0c9074e 100755 --- a/zen/ipns_self_publish.sh +++ b/zen/ipns_self_publish.sh @@ -6,7 +6,7 @@ ME="${0##*/}" countMErunning=$(ps auxf --sort=+utime | grep -w $ME | grep -v -E 'color=auto|grep' | wc -l) [[ $countMErunning -gt 2 ]] && echo "$ME already running $countMErunning time" && exit 0 ######################################################################## -IPFSNODEID=$(ipfs --timeout=20s id -f='\n') +IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID) [[ $IPFSNODEID == "" ]] && echo "ipfs TIMEOUT" && exit 1 ######################################################################## diff --git a/zen/new_file_in_astroport.sh b/zen/new_file_in_astroport.sh index 12e9a8c..f7dc423 100755 --- a/zen/new_file_in_astroport.sh +++ b/zen/new_file_in_astroport.sh @@ -15,7 +15,7 @@ countMErunning=$(ps auxf --sort=+utime | grep -w $ME | grep -v -E 'color=auto|gr start=`date +%s` YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1); -IPFSNODEID=$(ipfs --timeout=20s id -f='\n') +IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID) [[ ! $IPFSNODEID ]] && echo 'ERROR missing IPFS Node id !! IPFS is not responding !?' && exit 1 G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) # ~/.zen/ipfs/.${IPFSNODEID}/astroport/kodi/vstream/${PREFIX}ASTRXBIAN diff --git a/zen/tools/add_externIP_to_ipfstryme.sh b/zen/tools/add_externIP_to_ipfstryme.sh index a8dc5b5..5c280d4 100755 --- a/zen/tools/add_externIP_to_ipfstryme.sh +++ b/zen/tools/add_externIP_to_ipfstryme.sh @@ -9,7 +9,7 @@ MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized ME="${0##*/}" YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1); -IPFSNODEID=$(ipfs id -f='\n') +IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID) myIP=$(hostname -I | awk '{print $1}' | head -n 1) IamInLAN=$(echo $myIP | grep -E "(^127\.)|(^192\.168\.)|(^fd42\:)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/" )