Add fine-grain ssb initialization (profile URLs) #12

Closed
be1 wants to merge 1 commits from (deleted):freeboxV6 into master
1 changed files with 35 additions and 9 deletions

View File

@ -7,6 +7,22 @@
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}"
nodename=""
localname=""
localport=""
scheme=""
# Options.
while getopts ":n:l:p:s:" option; do
case "$option" in
n) nodename=$OPTARG ;;
l) localname=$OPTARG ;;
p) localport=$OPTARG ;;
s) scheme=$OPTARG ;;
esac
done
shift $((OPTIND - 1))
echo '
########################################################################
# \\///
@ -35,14 +51,14 @@ echo '
# 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" == "" ]] && echo "ERROR missing IPFS Node id !! IPFS is not installed !?" && exit 1
########################################################################
ssbpub=$(sbotc whoami 2>/dev/null | jq -r .id)
[[ $ssbpub == "" ]] && echo "ERROR sbotc NOT running !! Please check it..." && exit 1
[[ "$ssbpub" == "" ]] && echo "ERROR sbotc NOT running !! Please check it..." && exit 1
########################################################################
[[ ! -f ~/.ssb/secret.dunikey ]] && $MY_PATH/tools/secret2dunikey.sh
g1pub=$(cat ~/.ssb/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
[[ $g1pub == "" ]] && echo "ERROR g1pub empty !! Please check it..." && exit 1
[[ "$g1pub" == "" ]] && echo "ERROR g1pub empty !! Please check it..." && exit 1
########################################################################
# GET NODE disk performance. TODO, publish and use as IPFS repartition
@ -117,10 +133,17 @@ $imagefile
$id : $type : $size bits
"
nodename=$(cat /etc/hostname)
extension=$(echo $nodename | cut -d '.' -f 2)
if [[ $extension == $nodename ]]; then
nodename=$nodename.home
if [[ -z $nodename ]]; then
nodename=$(cat /etc/hostname)
extension=$(echo $nodename | cut -d '.' -f 2)
if [[ "$extension" == "$nodename" ]]; then
PING=$(ping -c1 $nodename.local | fgrep from)
if [[ "$PING" != "" ]]; then
nodename=$nodename.local
else
nodename=$nodename.home
fi
fi
fi
########################################################################
@ -132,7 +155,7 @@ DUNITERNODE=$($MY_PATH/tools/duniter_getnode.sh)
silkajQuantitativeAmountPattern='Total\sQuantitative\s+=\s+(.*)\s+Ğ1'
if [[ $g1balance =~ $silkajQuantitativeAmountPattern ]]
then
myJune="${BASH_REMATCH[1]}"
myJune="${BASH_REMATCH[1]}"
else
myJune="0 June"
fi
@ -140,7 +163,10 @@ fi
# OLD ssb-server publish
# sbot publish --type about --about $ssbpub --description "[Astroport Node](https://astroport.com) [$ipfsnodeid](http://localhost:8080/ipns/$ipfsnodeid) - Wallet $g1pub - $diskperf" --name "$title" --image "$id"
# NEW sbotc publish to oasis
sbotc publish "{\"type\":\"about\",\"about\":\"$ssbpub\",\"description\":\"![QRCode]($qrid)\\n[Astroport #Swarm0 DEV Station](https://astroport.com)\\n - [Gchange](http://$nodename/gchange/#/app/wot/$g1pub) \\n - [Cesium - $myJune -](https://$nodename/cesium/#/app/wot/$g1pub/) \\n IPFS NODE ID : [$ipfsnodeid](http://localhost:8080/ipns/$ipfsnodeid) \\n DISK: $sizeAvail = $diskperf \\n - [LOVE Land entrance](http://$nodename/) \\n\",\"name\":\"$title\",\"image\":\"$id\"}"
[[ "$localname" == "" ]] && localname="localhost"
[[ "$localport" != "" ]] && localport=":$localport"
[[ "$scheme" == "" ]] && scheme="https"
sbotc publish "{\"type\":\"about\",\"about\":\"$ssbpub\",\"description\":\"![QRCode]($qrid)\\n[Astroport #Swarm0 DEV Station](https://astroport.com)\\n - [Gchange]($scheme://$nodename/gchange/#/app/wot/$g1pub) \\n - [Cesium - $myJune -]($scheme://$nodename/cesium/#/app/wot/$g1pub/) \\n IPFS NODE ID : [$ipfsnodeid](http://$localname$localport/ipns/$ipfsnodeid) \\n DISK: $sizeAvail = $diskperf \\n - [LOVE Land entrance]($scheme://$nodename/) \\n\",\"name\":\"$title\",\"image\":\"$id\"}"
# SSB PUBLISH G1 wallet silkaj balance