From 29e74e358535ea861b014de9777e29683f19ca40 Mon Sep 17 00:00:00 2001 From: qo-op Date: Sun, 6 Dec 2020 01:54:01 +0100 Subject: [PATCH] .install/update_bashrc.sh --- .install/update_bashrc.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 .install/update_bashrc.sh diff --git a/.install/update_bashrc.sh b/.install/update_bashrc.sh new file mode 100755 index 0000000..b7cd17d --- /dev/null +++ b/.install/update_bashrc.sh @@ -0,0 +1,26 @@ +#!/bin/bash +######################################################################## +# Author: Fred (support@qo-op.com) +# Version: 2020.12.06 +# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/) +######################################################################## +# Add $YOU $IPFSNODEID $G1PUB to ~/.bashrc + +source ~/.bashrc +[[ $YOU != "" && $IPFSNODEID != "" && $G1PUB != "" ]] && echo "bashrc already updated" && exit 1 + +echo "### ASTROPORT IDENTITY ###" >> ~/.bashrc + +export 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" +[[ $er == "" ]] && echo "export YOU=$YOU" >> ~/.bashrc + +# IPFS layer ID is $YOU Swarm peer ID +export IPFSNODEID=$(ipfs id -f='\n') || er+=" ipfs id problem" +[[ $er == "" ]] && echo "export IPFSNODEID=$IPFSNODEID" >> ~/.bashrc + +# G1PUB is $YOU Zen Wallet (#libremoney) +export G1PUB=$(cat ~/.ssb/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) || er+=" ~/.ssb/secret.dunikey problem" +[[ $er == "" ]] && echo "export G1PUB=$G1PUB" >> ~/.bashrc + +source ~/.bashrc +exit 0