forked from axiom-team/astroport
33 lines
1.1 KiB
Bash
Executable File
33 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
########################################################################
|
|
# Author: Fred (support@qo-op.com)
|
|
# Version: 2020.12.06
|
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
|
########################################################################
|
|
# update_bashrc.sh
|
|
# Add $YOU $IPFSNODEID $G1PUB to ~/.bashrc
|
|
|
|
source ~/.bashrc
|
|
|
|
[[ $YOU != "" && $IPFSNODEID != "" && $G1PUB != "" ]] && er+="bashrc already updated"
|
|
|
|
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 id -f='<id>\n') || er+=" ipfs id problem"
|
|
|
|
[[ -f ~/.zen/secret.dunikey ]] && G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) || er+=" ~/.zen/secret.dunikey missing cannot find G1PUB"
|
|
|
|
[[ $er != "" ]] && echo "$er" && exit 1
|
|
|
|
echo "### ASTROPORT IDENTITY ###" >> ~/.bashrc
|
|
echo "YOU=$YOU" >> ~/.bashrc
|
|
echo "G1PUB=$G1PUB" >> ~/.bashrc
|
|
echo "IPFSNODEID=$IPFSNODEID" >> ~/.bashrc
|
|
|
|
source ~/.bashrc
|
|
|
|
echo "UPDATE ~/.bashrc OK"
|
|
tail -n 4 ~/.bashrc
|
|
|
|
exit 0
|