forked from axiom-team/astrXbian
Version: 0.2
This commit is contained in:
parent
597e4a59cf
commit
2b4652ea6c
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
########################################################################
|
########################################################################
|
||||||
# Author: Fred (support@qo-op.com)
|
# Author: Fred (support@qo-op.com)
|
||||||
# Version: 2020.11.30
|
# Version: 0.2
|
||||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||||
########################################################################
|
########################################################################
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
MY_PATH="`dirname \"$0\"`" # relative
|
||||||
|
@ -13,7 +13,7 @@ ME="${0##*/}"
|
||||||
# If NODE is from "A_boostrap_nodes.txt" then auto-linking
|
# If NODE is from "A_boostrap_nodes.txt" then auto-linking
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# ENVIRONEMENT DETECTION + IPFS ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_info
|
# INITIALISATION & CONTROL
|
||||||
########################################################################
|
########################################################################
|
||||||
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1);
|
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='<id>\n')
|
IPFSNODEID=$(ipfs id -f='<id>\n')
|
||||||
|
@ -22,86 +22,81 @@ IPFSNODEID=$(ipfs id -f='<id>\n')
|
||||||
[[ ! -f ~/.zen/secret.dunikey ]] && echo "Missing ~/.zen/secret.dunikey. EXIT" && exit 1
|
[[ ! -f ~/.zen/secret.dunikey ]] && echo "Missing ~/.zen/secret.dunikey. EXIT" && exit 1
|
||||||
G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
|
G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
|
||||||
[[ $G1PUB == "" ]] && echo "ERROR G1PUB empty !! EXIT" && exit 1
|
[[ $G1PUB == "" ]] && echo "ERROR G1PUB empty !! EXIT" && exit 1
|
||||||
########################################################################
|
|
||||||
|
|
||||||
# GET NODE disk performance. TODO, publish and use as IPFS repartition
|
########################################################################
|
||||||
|
# NODE DISK PERFORMANCE
|
||||||
[[ -f ~/.ipfs/test.disk ]] && rm -f ~/.ipfs/test.disk
|
[[ -f ~/.ipfs/test.disk ]] && rm -f ~/.ipfs/test.disk
|
||||||
diskperf=$(dd if=/dev/zero of=~/.ipfs/test.disk bs=10M count=1 oflag=dsync 2>&1 | tail -n 1 | sed s/\,\ /\ -/g | cut -d '-' -f 4)
|
diskperf=$(dd if=/dev/zero of=~/.ipfs/test.disk bs=10M count=1 oflag=dsync 2>&1 | tail -n 1 | sed s/\,\ /\ -/g | cut -d '-' -f 4)
|
||||||
echo "DISK PERFORMANCE TESTING : $diskperf"
|
echo "DISK PERFORMANCE TESTING : $diskperf"
|
||||||
|
|
||||||
# IPFS LOCAL REPOSITORY for Node Identity
|
########################################################################
|
||||||
|
# CREATNG IPFS LOCAL REPOSITORY for Node G1 Identity : G1SSB
|
||||||
mkdir -p ~/.zen/ipfs/.$IPFSNODEID/G1SSB
|
mkdir -p ~/.zen/ipfs/.$IPFSNODEID/G1SSB
|
||||||
|
|
||||||
# create IPFSTRYME public address file
|
########################################################################
|
||||||
|
# CREATING MY tryme.addr
|
||||||
~/.zen/astrXbian/zen/tools/add_externIP_to_ipfstryme.sh
|
~/.zen/astrXbian/zen/tools/add_externIP_to_ipfstryme.sh
|
||||||
cat ~/.zen/ipfs/.${IPFSNODEID}/tryme.addr
|
cat ~/.zen/ipfs/.${IPFSNODEID}/tryme.addr
|
||||||
|
|
||||||
|
########################################################################
|
||||||
################################
|
|
||||||
# ADD GCHANGE+ informations
|
# ADD GCHANGE+ informations
|
||||||
|
########################################################################
|
||||||
GCHANGE="https://data.gchange.fr"
|
GCHANGE="https://data.gchange.fr"
|
||||||
|
|
||||||
# PREPARE title
|
# CREATE _g1.gchange_title
|
||||||
# Made from Gchange+ profile tittle and city OR user@hostname
|
rm -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_title
|
||||||
title=$(curl -s ${GCHANGE}/user/profile/${G1PUB} | jq -r '._source.title')
|
title=$(curl -s ${GCHANGE}/user/profile/${G1PUB} | jq -r '._source.title')
|
||||||
[[ -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna ]] && uidna=$(cat ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna)
|
[[ $title ]] && echo "$title" > ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_title
|
||||||
|
|
||||||
# Put in .$IPFSNODEID INDEX: _g1.uidna & _g1.cesium_name (used by Minetest flavour and others)
|
|
||||||
[[ $uidna ]] && echo "$uidna" > ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.uidna
|
|
||||||
[[ $title ]] && echo "$title" > ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_name
|
|
||||||
|
|
||||||
[[ $uidna ]] && [[ "$title" == "null" ]] && title="Station $uidna"
|
|
||||||
[[ "$title" == "null" ]] && title="Station $USER@$(hostname)"
|
|
||||||
|
|
||||||
|
# CREATE _g1.astroport_title
|
||||||
|
rm -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.astroport_title
|
||||||
|
title="Station $USER@$(hostname)"
|
||||||
city=$(curl -s ${GCHANGE}/user/profile/${G1PUB} | jq -r '._source.city')
|
city=$(curl -s ${GCHANGE}/user/profile/${G1PUB} | jq -r '._source.city')
|
||||||
[[ "$city" != "null" ]] && title="$title in $city"
|
[[ "$city" != "null" ]] && title="$title in $city"
|
||||||
|
echo "$title" > ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.astroport_title
|
||||||
|
|
||||||
|
# DESACTIVATED
|
||||||
|
# CREATE "_g1.gchange_geoPoint.lat" AND "_g1.gchange_geoPoint.lon"
|
||||||
|
# rm -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_geoPoint.lat
|
||||||
|
# echo $(curl -s ${GCHANGE}/user/profile/${G1PUB} | jq '._source.geoPoint.lat') > ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_geoPoint.lat
|
||||||
|
# rm -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_geoPoint.lon
|
||||||
|
# echo $(curl -s ${GCHANGE}/user/profile/${G1PUB} | jq '._source.geoPoint.lon') > ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_geoPoint.lon
|
||||||
|
|
||||||
# ADD "cesium_geoPoint.lat" AND "cesium_geoPoint.lon" messages in SSB feed
|
# CREATE _g1.gchange_avatar.png
|
||||||
# This way any SSB account is connected to its Cesium+ Geolocalisation.
|
|
||||||
geopointlat=$(curl -s ${GCHANGE}/user/profile/${G1PUB} | jq '._source.geoPoint.lat')
|
|
||||||
geopointlon=$(curl -s ${GCHANGE}/user/profile/${G1PUB} | jq '._source.geoPoint.lon')
|
|
||||||
|
|
||||||
# REFRESH Cesium+ Avatar image
|
|
||||||
curl -s ${GCHANGE}/user/profile/${G1PUB} | jq -r '._source.avatar._content' | base64 -d > "/home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_avatar.png"
|
curl -s ${GCHANGE}/user/profile/${G1PUB} | jq -r '._source.avatar._content' | base64 -d > "/home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_avatar.png"
|
||||||
|
|
||||||
# Get nodename
|
# CREATE _nodename
|
||||||
[[ -f /home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_nodename ]] && nodename=$(cat /home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_nodename)
|
[[ -f /home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_nodename ]] && nodename=$(cat /home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_nodename)
|
||||||
if [[ $nodename == "" ]]; then
|
if [[ $nodename == "" ]]; then
|
||||||
nodename=$(cat /etc/hostname)
|
nodename=$(hostname)
|
||||||
extension=$(echo $nodename | cut -d '.' -f 2)
|
extension=$(echo $nodename | cut -d '.' -f 2)
|
||||||
if [[ $extension == $nodename ]]; then
|
if [[ $extension == $nodename ]]; then
|
||||||
nodename=$nodename.home
|
nodename=$nodename.home
|
||||||
fi
|
fi
|
||||||
echo "$nodename" > /home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_nodename
|
echo "$nodename" > ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_nodename
|
||||||
fi
|
fi
|
||||||
########################################################################
|
########################################################################
|
||||||
# DUNITER G1 Wallet balance
|
# DUNITER G1 Wallet balance
|
||||||
export LC_ALL=C.UTF-8 #attipix
|
export LC_ALL=C.UTF-8 #attipix
|
||||||
export LANG=C.UTF-8 #attipix
|
export LANG=C.UTF-8 #attipix
|
||||||
|
|
||||||
# COPY NODE G1SSB ID to IPFS
|
# _g1.pubkey
|
||||||
echo "$G1PUB" > ~/.zen/ipfs/.${IPFSNODEID}/G1SSB/_g1.pubkey
|
echo "$G1PUB" > ~/.zen/ipfs/.${IPFSNODEID}/G1SSB/_g1.pubkey
|
||||||
|
# IPFS Adresses
|
||||||
# IPFS Node PUBLISH Adresses so Pub can become bootstrap for ${g1author}
|
|
||||||
ipfs id | jq -r .Addresses[] > ~/.zen/ipfs/.${IPFSNODEID}/Addresses
|
ipfs id | jq -r .Addresses[] > ~/.zen/ipfs/.${IPFSNODEID}/Addresses
|
||||||
|
# IPFS AgentVersion
|
||||||
# IPFS Node PUBLISH AgentVersion & repo.stat
|
|
||||||
ipfs id | jq -r .AgentVersion > ~/.zen/ipfs/.${IPFSNODEID}/AgentVersion
|
ipfs id | jq -r .AgentVersion > ~/.zen/ipfs/.${IPFSNODEID}/AgentVersion
|
||||||
|
# IPFS repo.stat
|
||||||
ipfs repo stat > ~/.zen/ipfs/.${IPFSNODEID}/repo.stat
|
ipfs repo stat > ~/.zen/ipfs/.${IPFSNODEID}/repo.stat
|
||||||
|
# NODE disk.perf
|
||||||
echo "$diskperf" > ~/.zen/ipfs/.${IPFSNODEID}/disk.perf
|
echo "$diskperf" > ~/.zen/ipfs/.${IPFSNODEID}/disk.perf
|
||||||
|
# NODE disk.bytes
|
||||||
echo $(df ~/.ipfs/ | tail -n 1 | awk '{print $4}') > ~/.zen/ipfs/.${IPFSNODEID}/disk.bytes
|
echo $(df ~/.ipfs/ | tail -n 1 | awk '{print $4}') > ~/.zen/ipfs/.${IPFSNODEID}/disk.bytes
|
||||||
|
|
||||||
|
|
||||||
## PUBLISH ~/.zen/ipfs on self key IPNS
|
|
||||||
IWALLETS=$(ipfs add -rHq ~/.zen/ipfs | tail -n 1)
|
|
||||||
NODEIPNS=$(ipfs name publish --allow-offline --quieter /ipfs/$IWALLETS)
|
|
||||||
|
|
||||||
###
|
###
|
||||||
#### FRIENDS && BOOTSTRAP ipfstryme MESSAGE sending procedure
|
#### FRIENDS && BOOTSTRAP ipfstryme MESSAGE sending procedure
|
||||||
########################################################################
|
########################################################################
|
||||||
# GET LIST of issuer(s) who likes me
|
# GET LIST of issuer(s) who likes me & A_boostrap_nodes.txt
|
||||||
for liking_me in $(~/.zen/astrXbian/zen/jaklis/jaklis.py like | jq -r '.likes[].issuer' && cat ~/.zen/astrXbian/A_boostrap_nodes.txt | grep -Ev "#");
|
for liking_me in $(~/.zen/astrXbian/zen/jaklis/jaklis.py like | jq -r '.likes[].issuer' && cat ~/.zen/astrXbian/A_boostrap_nodes.txt | grep -Ev "#");
|
||||||
do
|
do
|
||||||
# BOOTSTRAP AUTO LIKE BACK
|
# BOOTSTRAP AUTO LIKE BACK
|
||||||
|
@ -117,7 +112,7 @@ do
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# CHECk if I am liking him either
|
# CHECKING IF WE LIKE EACH OTHER
|
||||||
friend_of_mine=$(~/.zen/astrXbian/zen/jaklis/jaklis.py like -p $liking_me | jq -r '.yours');
|
friend_of_mine=$(~/.zen/astrXbian/zen/jaklis/jaklis.py like -p $liking_me | jq -r '.yours');
|
||||||
if [[ $friend_of_mine != null ]]
|
if [[ $friend_of_mine != null ]]
|
||||||
then
|
then
|
||||||
|
@ -143,4 +138,8 @@ if [[ -f ~/.zen/astroport.py ]]; then
|
||||||
cp -f ~/.zen/astroport.py ~/.kodi/addons/plugin.video.vstream/resources/sites/
|
cp -f ~/.zen/astroport.py ~/.kodi/addons/plugin.video.vstream/resources/sites/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
## PUBLISH ~/.zen/ipfs on self key IPNS
|
||||||
|
IWALLETS=$(ipfs add -rHq ~/.zen/ipfs | tail -n 1)
|
||||||
|
NODEIPNS=$(ipfs name publish --allow-offline --quieter /ipfs/$IWALLETS)
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in New Issue