forked from axiom-team/astroport
401 lines
12 KiB
Bash
Executable File
401 lines
12 KiB
Bash
Executable File
#!/bin/bash
|
|
{
|
|
########################################################################
|
|
MY_PATH="`dirname \"$0\"`" # relative
|
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
|
ME="${0##*/}"
|
|
|
|
if [[ "$1" == "RAZ" ]]; then
|
|
echo "~/.SSB_ORIGIN is made for $(whoami)"
|
|
[[ -d ~/.ssb_$(whoami) ]] && mv ~/.ssb_$(whoami) ~/.SSB_ORIGIN
|
|
rm -Rf ~/.ssb*
|
|
else
|
|
echo '
|
|
########################################################################
|
|
# \\///
|
|
# qo-op
|
|
############# '$MY_PATH/$ME'
|
|
########################################################################
|
|
# Make Astroport Station Account
|
|
#
|
|
# You should already be runing ipfs daemon
|
|
|
|
########################################################################
|
|
# - Install silkaj youtube-dl & sbotc
|
|
# - Backup any ~/.ssb to ~/.ssb_$USER
|
|
# - Creates ~/.ssb_astroport and link it to ~/.ssb
|
|
# - Ask for credentials (or auto)
|
|
# - CREATE "~/.ssb/secret" & "~/.ssb/secret.dunikey" of you
|
|
# !!! KEEP CREDENTIALS IN ~/.zen/secret.astroport.key
|
|
########################################################################
|
|
# UnInstall and Recover your ~/.ssb_$USER
|
|
# cd && rm -Rf ~/.zen && rm ~/.ssb && mv ~/.ssb_$USER ~/.ssb
|
|
########################################################################
|
|
I encourage you to read any code you download.
|
|
This one is not perfect, but will not harm your system...
|
|
|
|
Install IPFS (compatible with ARM and X64)
|
|
curl -s https://git.p2p.legal/axiom-team/astroport/raw/master/.install/ipfs_alone.sh | bash
|
|
|
|
HIT ENTER TO CONTINUE
|
|
'
|
|
read letsgo
|
|
fi
|
|
# "ipfs daemon" MUST be RUNNING
|
|
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1)
|
|
[[ "$YOU" == "" ]] && echo "EXIT! PLEASE INSTALL & RUN ipfs daemon WITH curl -s https://git.p2p.legal/axiom-team/astroport/raw/master/.install/ipfs_alone.sh | bash " && exit 1
|
|
|
|
# ~/.zen is ASTROPORT living place.
|
|
[[ ! -d ~/.zen/astroport ]] && mkdir -p ~/.zen/astroport
|
|
|
|
# IS git THERE ?
|
|
[[ ! $(which git) ]] && sudo apt install git -y
|
|
[[ ! $(which figlet) ]] && sudo apt install figlet -y
|
|
[[ ! $(which lolcat) ]] && sudo apt install lolcat -y
|
|
|
|
# USE git pull OR git clone
|
|
if [[ -f ~/.zen/astroport/install.sh ]]; then
|
|
cd ~/.zen/astroport && git pull
|
|
else
|
|
cd ~/.zen
|
|
git clone https://git.p2p.legal/axiom-team/astroport.git
|
|
fi
|
|
|
|
cd ~/.zen/astroport
|
|
# LETS GO
|
|
# Install nvm
|
|
echo '
|
|
__ _
|
|
____ ____ ____/ /__ (_)____
|
|
/ __ \/ __ \/ __ / _ \ / / ___/
|
|
/ / / / /_/ / /_/ / __/ / (__ )
|
|
/_/ /_/\____/\__,_/\___/ __/ /____/
|
|
/___/
|
|
|
|
' | lolcat
|
|
if [[ ! $(which node) ]]; then
|
|
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash
|
|
source ~/.bashrc
|
|
export NVM_DIR="$HOME/.nvm"
|
|
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
|
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
|
source ~/.bashrc
|
|
nvm install 12
|
|
nvm use 12
|
|
fi
|
|
|
|
echo '
|
|
____ ___ _____ _________
|
|
/ __ \/ | / ___// _/ ___/
|
|
/ / / / /| | \__ \ / / \__ \
|
|
/ /_/ / ___ |___/ // / ___/ /
|
|
\____/_/ |_/____/___//____/
|
|
|
|
' | lolcat
|
|
|
|
nodename=$(curl -s https://git.p2p.legal/axiom-team/astroport/raw/master/zen/tools/nodename | bash)
|
|
|
|
if [[ ! $(which oasis) ]]; then
|
|
echo "INSTALL.... http://$nodename"
|
|
# echo "ENTER Station accessible Network name !!! Suggestion : $nodename"
|
|
# read nodename
|
|
# Install nvm
|
|
if [[ ! $(which node) || ! $(which npm) ]]; then
|
|
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash
|
|
source ~/.bashrc
|
|
export NVM_DIR="$HOME/.nvm"
|
|
nvm install --lts
|
|
fi
|
|
npm -g install sodium-native ssb-backlinks ssb-ws ssb-links ssb-query ssb-secret-blob ssb-private
|
|
npm -g install fraction/oasis#semver:
|
|
npm -g install ssb-server ## ADD SSB-SERVER FOR PRIVATE SSB MESSAGING (TODO: integrate Feedless modules on LOVELand Portal)
|
|
else
|
|
echo "Stopping OASIS"
|
|
ssbD=$(ps auxf --sort=+utime | grep -w oasis | grep -v -E 'color=auto|grep' | awk '{print $2}')
|
|
ssbD+=$(ps auxf --sort=+utime | grep -w ssb-server | grep -v -E 'color=auto|grep' | awk '{print $2}')
|
|
|
|
for tokill in $ssbD; do
|
|
kill -9 $tokill
|
|
done
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
# INSTALL Silkaj, CLI for Duniter
|
|
echo '**************************************************************
|
|
__ ___
|
|
(_ | | |/ /\ |
|
|
__) _|_ |_ |\ /--\ \_|
|
|
|
|
#Duniter communication client...
|
|
' | lolcat
|
|
|
|
sudo apt update || true
|
|
sudo apt install ssmtp mpack libffi-dev build-essential qrencode jq bc gawk -y
|
|
|
|
export PATH=$PATH:~/.local/bin
|
|
if [[ ! $(which silkaj) ]]; then
|
|
libzzz=$(sudo apt-cache search libsodium | awk '{print $1}' | grep libsodium2)
|
|
[[ $libzzz == "" ]] && libzzz=$(sudo apt-cache search libsodium | awk '{print $1}' | grep libsodium1)
|
|
sudo apt install $libzzz -y
|
|
sudo apt install python3-pip python3-setuptools python3-wheel -y
|
|
pip3 install base58
|
|
pip3 install silkaj --user
|
|
echo 'PATH=$PATH:~/.local/bin' >> ~/.bashrc && source ~/.bashrc
|
|
fi
|
|
|
|
# INSTALL sbotc
|
|
echo '
|
|
__ __
|
|
_____/ /_ ____ / /______
|
|
/ ___/ __ \/ __ \/ __/ ___/
|
|
(__ ) /_/ / /_/ / /_/ /__
|
|
/____/_.___/\____/\__/\___/
|
|
|
|
ScuttleButt communication client...
|
|
' | lolcat
|
|
if [[ ! $(which sbotc) ]]; then
|
|
sudo apt install libsodium-dev build-essential imagemagick -y
|
|
cd /tmp/
|
|
git clone https://git.scuttlebot.io/%25133ulDgs%2FoC1DXjoK04vDFy6DgVBB%2FZok15YJmuhD5Q%3D.sha256 sbotc
|
|
cd sbotc
|
|
make
|
|
sudo make install
|
|
cd ~/.zen/astroport
|
|
fi
|
|
|
|
|
|
echo '
|
|
__ __
|
|
____ ______/ /__________ ____ ____ _____/ /_
|
|
/ __ `/ ___/ __/ ___/ __ \/ __ \/ __ \/ ___/ __/
|
|
/ /_/ (__ ) /_/ / / /_/ / /_/ / /_/ / / / /_
|
|
\__,_/____/\__/_/ \____/ .___/\____/_/ \__/
|
|
/_/
|
|
|
|
ONBOARDING activation... linking ~/.ssb to ~/.ssb_astroport
|
|
|
|
' | lolcat
|
|
# CREATE ~/.ssb_astroport
|
|
[[ ! -d ~/.ssb_astroport ]] && mkdir -p ~/.ssb_astroport
|
|
|
|
# If exists backup ~/.ssb to ~/.ssb_$USER SSB (one time only !)
|
|
[[ -d ~/.ssb_$USER ]] && echo "BACKUP already existing... Restore it : rm -Rf ~/.ssb && mv ~/.ssb_$USER ~/.ssb # and Try again..." && exit 1
|
|
|
|
if [[ -d ~/.ssb ]]; then
|
|
[[ -f ~/.ssb/manifest.json ]] && cp -f ~/.ssb/manifest.json ~/.ssb_astroport/
|
|
[[ -f ~/.ssb/conn.json ]] && cp -f ~/.ssb/conn.json ~/.ssb_astroport/
|
|
[[ -f ~/.ssb/gossip.json ]] && cp -f ~/.ssb/gossip.json ~/.ssb_astroport/
|
|
fi
|
|
|
|
# BACKUP ACTUAL SSB ACCOUNT
|
|
[[ -d ~/.ssb ]] && mv ~/.ssb ~/.ssb_$USER
|
|
|
|
# Symlink ~/.ssb -> ~/.ssb_astroport
|
|
[[ -L ~/.ssb ]] && rm ~/.ssb
|
|
[[ -d ~/.ssb_astroport ]] && ln -s ~/.ssb_astroport ~/.ssb
|
|
|
|
cd ~/.ssb/
|
|
|
|
[[ ! -f ~/.ssb/manifest.json ]] && cp ~/.zen/astroport/.install/templates/ssb/manifest.json ~/.ssb/ && echo "manifest.json OK"
|
|
|
|
echo '>>>>>>> METAVERSE KEY CREATION <<<<<<<<
|
|
|
|
__ __ ____
|
|
__/ // /_______ ______ __________ ___ / __ \
|
|
/_ _ __/ ___/ | /| / / __ `/ ___/ __ `__ \/ / / /
|
|
/_ _ __(__ )| |/ |/ / /_/ / / / / / / / / /_/ /
|
|
/_//_/ /____/ |__/|__/\__,_/_/ /_/ /_/ /_/\____/
|
|
|
|
KEY
|
|
|
|
CHOOSE YOU LOGIN (min 8 car. best is more than 6 words!!)...
|
|
or LEAVE BLANK and HIT ENTER FOR diceware AUTO GENERATION
|
|
' | lolcat
|
|
read salt
|
|
[[ $salt != "" ]] && echo "CHOOSE PASSWORD?" && read pepper && [[ $pepper == "" ]] && exit 1
|
|
|
|
if [[ "$salt" == "" && "$pepper" == "" ]]; then
|
|
|
|
echo '
|
|
._ _ ._ _ ._ _ _ ._ o _
|
|
| | | | | (/_ | | | (_) | | | (_
|
|
|
|
diceware passphrase generator...' | lolcat
|
|
# INSTALL diceware files ## TODO REPLACE WITH ipfs links
|
|
|
|
[[ ! -f ~/.zen/astroport/zen/tools/diceware.sh ]] \
|
|
&& mkdir -p ~/.zen/astroport/zen/tools/ \
|
|
&& curl -s https://git.p2p.legal/axiom-team/astroport/raw/master/zen/tools/diceware.sh -o ~/.zen/astroport/zen/tools/diceware.sh \
|
|
&& chmod +x ~/.zen/astroport/zen/tools/diceware.sh
|
|
|
|
[[ ! -f ~/.zen/astroport/zen/tools/diceware-wordlist.txt ]] \
|
|
&& curl -s https://git.p2p.legal/axiom-team/astroport/raw/master/zen/tools/diceware-wordlist.txt -o ~/.zen/astroport/zen/tools/diceware-wordlist.txt
|
|
|
|
# LOGIN (=SALT)
|
|
salt="$(~/.zen/astroport/zen/tools/diceware.sh 6 | xargs)"
|
|
# PASS (=PEPPER)
|
|
pepper="$(~/.zen/astroport/zen/tools/diceware.sh 4 | xargs)"
|
|
|
|
fi
|
|
echo "........."
|
|
|
|
rm -f ~/.zen/secret.astroport.key
|
|
echo "#20200606 ASTROPORT METAVERSE #SWARM0 IDENTITY
|
|
ZENID=\"$salt\"
|
|
ZENPWD=\"$pepper\"" > ~/.zen/secret.astroport.key
|
|
sleep 1
|
|
|
|
# CREATE ~/.ssb/secret.dunikey
|
|
python3 ~/.zen/astroport/zen/tools/key_create_dunikey.py "$salt" "$pepper"
|
|
sleep 1
|
|
[[ ! -f /tmp/secret.dunikey ]] && echo "AARRRRGGG problem happens making your secret.dunikey" && exit 1
|
|
[[ -f /tmp/secret.dunikey ]] && rm -f ~/.ssb/secret.dunikey && mv /tmp/secret.dunikey ~/.ssb/secret.dunikey
|
|
|
|
# CREATE SSB secret
|
|
g1pub=$(cat ~/.ssb/secret.dunikey | grep "pub" | cut -d ' ' -f 2)
|
|
echo "G1PUB=\"$g1pub\"" >> ~/.zen/secret.astroport.key
|
|
|
|
g1priv=$(cat ~/.ssb/secret.dunikey | grep "sec" | cut -d ' ' -f 2)
|
|
ssbpub=$(echo $g1pub | base58 -d | base64)
|
|
ssbpriv=$(echo $g1priv | base58 -d | base64 | tr -d "\n" )
|
|
|
|
rm -f ~/.ssb/secret
|
|
cat > ~/.ssb/secret <<EOF
|
|
# THIS KEY IS YOURS! REMIND IT AND KEEP IT SAFE AS A REAL WALLET
|
|
{
|
|
"curve": "ed25519",
|
|
"public": "${ssbpub}.ed25519",
|
|
"private": "${ssbpriv}.ed25519",
|
|
"id": "@${ssbpub}.ed25519"
|
|
}
|
|
|
|
# WARNING! It's vital that you DO NOT edit OR share your secret name
|
|
# ONLY Share your public name : @${ssbpub}.ed25519
|
|
# AND Public G1 WALLET : $g1pub
|
|
|
|
EOF
|
|
|
|
echo "WHOAMI=\"@$ssbpub.ed25519\"" >> ~/.zen/secret.astroport.key
|
|
|
|
echo "
|
|
_
|
|
|__|_ \ / _ o | _.
|
|
|_ |_ \/ (_) | | (_|
|
|
|
|
Your Identity is created !!
|
|
REMEMBER TO KEEP your secret files SECRET !!!
|
|
|
|
Your public name : @${ssbpub}.ed25519
|
|
Your G1 WALLET : $g1pub
|
|
|
|
"
|
|
|
|
chmod 400 ~/.ssb/secret
|
|
chmod 400 ~/.ssb/secret.dunikey
|
|
|
|
echo '
|
|
__
|
|
__________/ /_
|
|
/ ___/ ___/ __ \
|
|
(__ |__ ) /_/ /
|
|
/____/____/_.___/
|
|
|
|
NEW IDENTITY ACTIVATED in ~/.ssb/secret
|
|
|
|
' | lolcat
|
|
|
|
echo '
|
|
_________
|
|
/ ____< /
|
|
/ / __ / /
|
|
/ /_/ // /
|
|
\____//_/
|
|
|
|
IDENTITY CREATED in ~/.ssb/secret.dunikey
|
|
|
|
Install https://cesium.app to use it !!
|
|
|
|
' | lolcat
|
|
|
|
cat ~/.zen/secret.astroport.key
|
|
|
|
echo '
|
|
|
|
Now you are going to join #Swarm0 IPFS Metaverse
|
|
ACTIVATE METAVERSE #SWARM0 INIT SEQUENCE...
|
|
ALPHA - ALPHA - ALPHA - ALPHA
|
|
|
|
'
|
|
echo "Starting SSB SERVER... wait 10 seconds..."
|
|
ssb-server start &
|
|
|
|
sleep 10
|
|
|
|
##echo "Starting OASIS..."
|
|
## Don't ...
|
|
## oasis --allow-host $nodename --host $nodename &
|
|
#sleep 7
|
|
|
|
# Intall Patchwork
|
|
#### ARM / X64 NOT USED THERE
|
|
MACHINE_TYPE=`uname -m`
|
|
[ ${MACHINE_TYPE:0:3} == 'arm' ] && isARM="YES"
|
|
if [[ ! $isARM="YES" ]]; then
|
|
if [[ ! $(which ssb-patchwork) ]]; then
|
|
wget https://github.com/ssbc/patchwork/releases/download/v3.18.0/ssb-patchwork_3.18.0_amd64.deb -O /tmp/patchwork.deb
|
|
sudo dpkg -i /tmp/patchwork.deb
|
|
sleep 1
|
|
rm /tmp/patchwork.deb
|
|
|
|
## npm install way
|
|
##npm install --global ssb-patchwork
|
|
sleep 2
|
|
|
|
# Start Patchwork
|
|
#[[ $(which ssb-patchwork) ]] && ssb-patchwork || echo -e "${c_red}Patchwork is not installed$c_"
|
|
fi
|
|
fi
|
|
|
|
~/.zen/astroport/zen/ssb_INIT.sh
|
|
~/.zen/astroport/zen/cron_VRFY.sh
|
|
|
|
echo -e "Finished...
|
|
|
|
########################################################################
|
|
${c_light}IF SOMETHING WENT WRONG REPORT AN ISSUE
|
|
https://git.p2p.legal/axiom-team/astroport/issues$c_
|
|
########################################################################
|
|
MAKE SOME TEST
|
|
|
|
1. Test IPFS Layer
|
|
ipfs id
|
|
|
|
2. Test SSB Layer
|
|
sbotc whoami
|
|
|
|
3. Test G1 Layer
|
|
silkaj balance $g1pub
|
|
|
|
4. Test #Swarm0 Activation
|
|
crontab -l
|
|
|
|
5. Test OASIS
|
|
WARNING: If tour installation is working on Pathwork, Oasis is disabled
|
|
http://$nodename:3000
|
|
|
|
IF EVERYTHING IS OK
|
|
ADD oasis TO YOUR system AUTOSTART !!!
|
|
oasis --allow-host $nodename --host $nodename
|
|
|
|
THANK YOU. Now it is time to connect to your friends...
|
|
|
|
6. ADD ScuttleButt PUB Invitation (With Oasis: http://$nodename:3000/settings)
|
|
${c_light}oasis.astroport.com:8008:@UeiA9iqZ0/XTjmYBht230KGr44bsr+Tl5BXSUDFv8vo=.ed25519~xfUSq/J2zLeFwrvvHie4iXI/GAzybUu7Zs9T7/PgZ+w= $c_
|
|
|
|
"
|
|
exit 0
|
|
}
|