SWARM & NODE_G1PUBKEY
This commit is contained in:
parent
c82d96394f
commit
bf94b41551
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
##################################################################
|
##################################################################
|
||||||
# Author: Fred (support@qo-op.com)
|
# Author: Fred (support@qo-op.com)
|
||||||
# Version: 0.1
|
# Version: 0.2
|
||||||
# License: GPL (http://www.google.com/search?q=GPL)
|
# License: GPL (http://www.google.com/search?q=GPL)
|
||||||
##################################################################
|
##################################################################
|
||||||
# CHECK & WARN | CREATE Keys (gpg encrypt, G1wallet, IPNS publish)
|
# CHECK & WARN | CREATE Keys (gpg encrypt, G1wallet, IPNS publish)
|
||||||
|
@ -9,37 +9,17 @@
|
||||||
|
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
MY_PATH="`dirname \"$0\"`" # relative
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||||
if [[ -f $MY_PATH/.profile ]]; then
|
if [[ -f $MY_PATH/.install/.GPATH ]]; then source $MY_PATH/.install/.GPATH; fi
|
||||||
source $MY_PATH/.profile
|
if [[ -f $MY_PATH/../.install/.GPATH ]]; then source $MY_PATH/../.install/.GPATH; fi
|
||||||
elif [[ -f $MY_PATH/../.profile ]]; then
|
|
||||||
source $MY_PATH/../.profile
|
|
||||||
else
|
|
||||||
echo -e "${c_red}Le .profile n'existe pas$c_"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
|
YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
|
||||||
IPFSNODEID=$(su $YOU -c "ipfs id -f='<id>\n'")
|
IPFSNODEID=$(su $YOU -c "ipfs id -f='<id>\n'")
|
||||||
NANODATE=$(date -u +%s%N) #1569692075385428020
|
NANODATE=$(date -u +%s%N) #1569692075385428020
|
||||||
|
|
||||||
##########################################################
|
|
||||||
# CHECK LAST TIME NODE HAD ACTION : Calibrate NANODATE
|
|
||||||
if [[ -f ./wallets/.$IPFSNODEID/_nanodate ]]; then
|
|
||||||
last=$(cat ./wallets/.$IPFSNODEID/_nanodate)
|
|
||||||
timediff=$( echo "${NANODATE} - ${last}" | bc -l )
|
|
||||||
# Get median nanodate before
|
|
||||||
# NODE TIME SYNC 600 milliards de nanosecondes = 600 s = 10 mn
|
|
||||||
if [[ $timediff -gt 600000000000 ]]; then
|
|
||||||
# RUN & LOG ntpdate
|
|
||||||
log "__SUB:ntpdate pool.ntp.org: $timediff $(ntpdate pool.ntp.org)"
|
|
||||||
export NANODATE=$(date -u +%s%N)
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
# G1sms+ Node KEYS (G1wallet, gpg, IPNS)
|
# G1sms+ Node KEYS (G1wallet, gpg, IPNS)
|
||||||
##################################################################
|
##################################################################
|
||||||
export GPGPASS=$(cat "/home/$YOU/.ipfs/config" | jq '.Identity.PrivKey' | sed s/\"//g)
|
export GPGPASS=$(cat "/home/$YOU/.ipfs/config" | jq '.Identity.PrivKey' | sed s/\"//g) #"
|
||||||
if [ ! $GPGPASS ]; then echo "FATAL ERROR:: IPFS Node.Identity.PrivKey GPGPASS EMPTY"; exit; fi
|
if [ ! $GPGPASS ]; then echo "FATAL ERROR:: IPFS Node.Identity.PrivKey GPGPASS EMPTY"; exit; fi
|
||||||
|
|
||||||
# GET SWARM KEY G1sms+ .ipfs/swarm.key
|
# GET SWARM KEY G1sms+ .ipfs/swarm.key
|
||||||
|
@ -53,8 +33,9 @@ if [ ! $SWARMKEY ]; then echo "FATAL ERROR:: .ipfs/swarm.key EMPTY"; exit; fi
|
||||||
#
|
#
|
||||||
# CLEF G1 DU SWARM
|
# CLEF G1 DU SWARM
|
||||||
SWARM_G1PUBKEY=$(cat "${GPATH}/g1sms.pub.key")
|
SWARM_G1PUBKEY=$(cat "${GPATH}/g1sms.pub.key")
|
||||||
|
SWARM_G1AUTHFILE="${GPATH}/g1sms.priv.key"
|
||||||
|
|
||||||
# CLEF G1 NODE = CLEF G1 SWARM
|
# CLEF G1 NODE = CLEF G1 SWARM !!
|
||||||
if [[ ! -e "./g1sms.preoni.pub.key" && -f "./g1sms.priv.key" ]]; then
|
if [[ ! -e "./g1sms.preoni.pub.key" && -f "./g1sms.priv.key" ]]; then
|
||||||
log "__SUB:initkeys.sh: Linking preoni Keys to SWARM G1 Keys"
|
log "__SUB:initkeys.sh: Linking preoni Keys to SWARM G1 Keys"
|
||||||
ln -s ./g1sms.priv.key ./g1sms.preoni.priv.key
|
ln -s ./g1sms.priv.key ./g1sms.preoni.priv.key
|
||||||
|
@ -116,16 +97,27 @@ else
|
||||||
|
|
||||||
# CREATE preoni FILES
|
# CREATE preoni FILES
|
||||||
mv ./authfile ./g1sms.preoni.priv.key
|
mv ./authfile ./g1sms.preoni.priv.key
|
||||||
echo NODE_G1PUBKEY > ./g1sms.preoni.pub.key
|
echo $NODE_G1PUBKEY > ./g1sms.preoni.pub.key
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
## INIT NODE G1 PUB & PRIV KEY
|
||||||
NODE_G1PUBKEY=$(cat "${GPATH}/g1sms.preoni.pub.key")
|
NODE_G1PUBKEY=$(cat "${GPATH}/g1sms.preoni.pub.key")
|
||||||
NODE_G1AUTHFILE="${GPATH}/g1sms.preoni.priv.key"
|
NODE_G1AUTHFILE="${GPATH}/g1sms.preoni.priv.key"
|
||||||
|
|
||||||
|
##########################################################
|
||||||
# MEMORIZE NODE NANODATE EXECUTION TIME (for ntpdate regular sync)
|
# MEMORIZE NODE NANODATE EXECUTION TIME (for ntpdate regular sync)
|
||||||
echo $NANODATE > ./wallets/.$IPFSNODEID/_nanodate
|
if [[ -f ./wallets/.$IPFSNODEID/_nanodate ]]; then
|
||||||
|
last=$(cat ./wallets/.$IPFSNODEID/_nanodate)
|
||||||
|
timediff=$( echo "${NANODATE} - ${last}" | bc -l )
|
||||||
|
# NODE TIME SYNC 600 milliards de nanosecondes = 600 s = 10 mn
|
||||||
|
if [[ $timediff -gt 600000000000 ]]; then
|
||||||
|
# RUN & LOG ntpdate
|
||||||
|
log "__SUB:ntpdate pool.ntp.org: $timediff $(ntpdate pool.ntp.org)"
|
||||||
|
export NANODATE=$(date -u +%s%N)
|
||||||
|
fi
|
||||||
|
echo $NANODATE > ./wallets/.$IPFSNODEID/_nanodate
|
||||||
|
fi
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
#INFORM ABOUT NODE CAPACITIES
|
#INFORM ABOUT NODE CAPACITIES
|
||||||
|
|
Loading…
Reference in New Issue